From fc78880defcc1030555557d8e2eb0f4cfabb69c8 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 31 Mar 2025 18:29:47 +0000 Subject: [PATCH] CodeGen from PR 33586 in Azure/azure-rest-api-specs Merge 62b9bdccffef720abb98542aeacba00972fadb9d into a2cf44d885881e99850cbdb0d86b817c5489def2 --- .../tsp-location.yaml | 7 +- .../Azure.AI.Assistants.sln | 56 + sdk/ai/Azure.AI.Assistants/CHANGELOG.md | 11 + .../Azure.AI.Assistants/Directory.Build.props | 6 + sdk/ai/Azure.AI.Assistants/README.md | 107 + .../src/Azure.AI.Assistants.csproj | 20 + .../src/Generated/.Serialization.cs | 132 + sdk/ai/Azure.AI.Assistants/src/Generated/.cs | 57 + .../src/Generated/AIAssistantClient.cs | 6005 +++++ .../src/Generated/AIAssistantClientOptions.cs | 37 + .../AIAssistantsClientBuilderExtensions.cs | 46 + .../src/Generated/AIAssistantsModelFactory.cs | 1072 + .../AISearchIndexResource.Serialization.cs | 197 + .../src/Generated/AISearchIndexResource.cs | 94 + .../src/Generated/Agent.Serialization.cs | 379 + .../src/Generated/Agent.cs | 238 + .../src/Generated/AgentObject.cs | 48 + .../src/Generated/AgentStreamEvent.cs | 137 + .../Generated/AgentThread.Serialization.cs | 215 + .../src/Generated/AgentThread.cs | 110 + ...gentThreadCreationOptions.Serialization.cs | 215 + .../Generated/AgentThreadCreationOptions.cs | 83 + .../src/Generated/AgentThreadObject.cs | 48 + .../AgentsApiResponseFormat.Serialization.cs | 149 + .../src/Generated/AgentsApiResponseFormat.cs | 68 + .../Generated/AgentsApiResponseFormatMode.cs | 51 + .../AgentsApiToolChoiceOptionMode.cs | 51 + .../AgentsNamedToolChoice.Serialization.cs | 157 + .../src/Generated/AgentsNamedToolChoice.cs | 76 + .../Generated/AgentsNamedToolChoiceType.cs | 66 + .../src/Generated/AzureAISearchQueryType.cs | 60 + .../AzureAISearchResource.Serialization.cs | 159 + .../src/Generated/AzureAISearchResource.cs | 72 + ...ureAISearchToolDefinition.Serialization.cs | 126 + .../Generated/AzureAISearchToolDefinition.cs | 29 + .../AzureFunctionBinding.Serialization.cs | 150 + .../src/Generated/AzureFunctionBinding.cs | 80 + .../src/Generated/AzureFunctionBindingType.cs | 48 + ...AzureFunctionStorageQueue.Serialization.cs | 150 + .../Generated/AzureFunctionStorageQueue.cs | 82 + ...ureFunctionToolDefinition.Serialization.cs | 134 + .../Generated/AzureFunctionToolDefinition.cs | 44 + ...ngGroundingToolDefinition.Serialization.cs | 134 + .../Generated/BingGroundingToolDefinition.cs | 44 + ...InterpreterToolDefinition.Serialization.cs | 126 + .../CodeInterpreterToolDefinition.cs | 29 + ...deInterpreterToolResource.Serialization.cs | 184 + .../Generated/CodeInterpreterToolResource.cs | 77 + .../CreateAgentRequest.Serialization.cs | 379 + .../src/Generated/CreateAgentRequest.cs | 189 + .../CreateMessageRequest.Serialization.cs | 215 + .../src/Generated/CreateMessageRequest.cs | 121 + .../CreateRunRequest.Serialization.cs | 530 + .../src/Generated/CreateRunRequest.cs | 281 + ...CreateThreadAndRunRequest.Serialization.cs | 513 + .../Generated/CreateThreadAndRunRequest.cs | 274 + .../CreateThreadRequest.Serialization.cs | 215 + .../src/Generated/CreateThreadRequest.cs | 83 + ...ctorStoreFileBatchRequest.Serialization.cs | 199 + .../CreateVectorStoreFileBatchRequest.cs | 83 + ...ateVectorStoreFileRequest.Serialization.cs | 175 + .../Generated/CreateVectorStoreFileRequest.cs | 81 + .../CreateVectorStoreRequest.Serialization.cs | 255 + .../src/Generated/CreateVectorStoreRequest.cs | 95 + .../src/Generated/Docs/AIAssistantClient.xml | 6647 ++++++ .../src/Generated/DoneEvent.cs | 48 + .../src/Generated/ErrorEvent.cs | 48 + .../src/Generated/File.Serialization.cs | 164 + .../Azure.AI.Assistants/src/Generated/File.cs | 98 + .../FileSearchRankingOptions.Serialization.cs | 150 + .../src/Generated/FileSearchRankingOptions.cs | 81 + ...FileSearchToolCallContent.Serialization.cs | 150 + .../Generated/FileSearchToolCallContent.cs | 80 + .../FileSearchToolCallContentType.cs | 48 + .../FileSearchToolDefinition.Serialization.cs | 141 + .../src/Generated/FileSearchToolDefinition.cs | 34 + ...archToolDefinitionDetails.Serialization.cs | 164 + .../FileSearchToolDefinitionDetails.cs | 77 + .../FileSearchToolResource.Serialization.cs | 184 + .../src/Generated/FileSearchToolResource.cs | 85 + .../src/Generated/FileState.cs | 75 + .../Generated/FunctionName.Serialization.cs | 142 + .../src/Generated/FunctionName.cs | 75 + .../FunctionToolDefinition.Serialization.cs | 134 + .../src/Generated/FunctionToolDefinition.cs | 44 + .../src/Generated/IncompleteDetailsReason.cs | 51 + .../IncompleteRunDetails.Serialization.cs | 142 + .../src/Generated/IncompleteRunDetails.cs | 72 + .../src/Generated/Internal/Argument.cs | 129 + .../Internal/ChangeTrackingDictionary.cs | 167 + .../Generated/Internal/ChangeTrackingList.cs | 153 + .../Internal/ModelSerializationExtensions.cs | 399 + .../MultipartFormDataRequestContent.cs | 203 + .../src/Generated/Internal/Optional.cs | 51 + .../Internal/Utf8JsonRequestContent.cs | 55 + ...ternalAgentDeletionStatus.Serialization.cs | 158 + .../Generated/InternalAgentDeletionStatus.cs | 85 + .../InternalAgentDeletionStatusObject.cs | 48 + ...alAzureFunctionDefinition.Serialization.cs | 158 + .../InternalAzureFunctionDefinition.cs | 89 + ...nterpreterToolCallDetails.Serialization.cs | 160 + .../InternalCodeInterpreterToolCallDetails.cs | 95 + ...nternalFileDeletionStatus.Serialization.cs | 158 + .../Generated/InternalFileDeletionStatus.cs | 85 + .../InternalFileDeletionStatusObject.cs | 48 + .../InternalFileListResponse.Serialization.cs | 160 + .../src/Generated/InternalFileListResponse.cs | 81 + .../InternalFileListResponseObject.cs | 48 + ...nternalFunctionDefinition.Serialization.cs | 168 + .../Generated/InternalFunctionDefinition.cs | 115 + ...alMessageImageFileDetails.Serialization.cs | 142 + .../InternalMessageImageFileDetails.cs | 75 + ...nternalMessageTextDetails.Serialization.cs | 160 + .../Generated/InternalMessageTextDetails.cs | 95 + ...geTextFileCitationDetails.Serialization.cs | 150 + .../InternalMessageTextFileCitationDetails.cs | 82 + ...essageTextFilePathDetails.Serialization.cs | 142 + .../InternalMessageTextFilePathDetails.cs | 75 + ...edFunctionToolCallDetails.Serialization.cs | 150 + ...InternalRequiredFunctionToolCallDetails.cs | 82 + ...epFunctionToolCallDetails.Serialization.cs | 170 + .../InternalRunStepFunctionToolCallDetails.cs | 88 + ...lSubmitToolOutputsDetails.Serialization.cs | 152 + .../InternalSubmitToolOutputsDetails.cs | 88 + .../src/Generated/ListSortOrder.cs | 51 + .../MessageAttachment.Serialization.cs | 197 + .../src/Generated/MessageAttachment.cs | 121 + .../Generated/MessageContent.Serialization.cs | 134 + .../src/Generated/MessageContent.cs | 69 + .../Generated/MessageDelta.Serialization.cs | 160 + .../src/Generated/MessageDelta.cs | 94 + .../MessageDeltaChunk.Serialization.cs | 158 + .../src/Generated/MessageDeltaChunk.cs | 87 + .../src/Generated/MessageDeltaChunkObject.cs | 48 + .../MessageDeltaContent.Serialization.cs | 136 + .../src/Generated/MessageDeltaContent.cs | 80 + ...sageDeltaImageFileContent.Serialization.cs | 147 + .../Generated/MessageDeltaImageFileContent.cs | 41 + ...ltaImageFileContentObject.Serialization.cs | 145 + .../MessageDeltaImageFileContentObject.cs | 65 + ...essageDeltaTextAnnotation.Serialization.cs | 137 + .../Generated/MessageDeltaTextAnnotation.cs | 80 + .../MessageDeltaTextContent.Serialization.cs | 147 + .../src/Generated/MessageDeltaTextContent.cs | 41 + ...ageDeltaTextContentObject.Serialization.cs | 170 + .../MessageDeltaTextContentObject.cs | 78 + ...extFileCitationAnnotation.Serialization.cs | 195 + .../MessageDeltaTextFileCitationAnnotation.cs | 53 + ...eCitationAnnotationObject.Serialization.cs | 156 + ...geDeltaTextFileCitationAnnotationObject.cs | 69 + ...ltaTextFilePathAnnotation.Serialization.cs | 195 + .../MessageDeltaTextFilePathAnnotation.cs | 53 + ...tFilePathAnnotationObject.Serialization.cs | 145 + ...essageDeltaTextFilePathAnnotationObject.cs | 65 + ...TextUrlCitationAnnotation.Serialization.cs | 176 + .../MessageDeltaTextUrlCitationAnnotation.cs | 54 + ...ltaTextUrlCitationDetails.Serialization.cs | 153 + .../MessageDeltaTextUrlCitationDetails.cs | 79 + .../MessageImageFileContent.Serialization.cs | 134 + .../src/Generated/MessageImageFileContent.cs | 44 + .../MessageIncompleteDetails.Serialization.cs | 142 + .../src/Generated/MessageIncompleteDetails.cs | 72 + .../MessageIncompleteDetailsReason.cs | 60 + .../src/Generated/MessageRole.cs | 51 + .../src/Generated/MessageStatus.cs | 54 + .../src/Generated/MessageStreamEvent.cs | 60 + .../MessageTextAnnotation.Serialization.cs | 137 + .../src/Generated/MessageTextAnnotation.cs | 83 + .../MessageTextContent.Serialization.cs | 134 + .../src/Generated/MessageTextContent.cs | 44 + ...extFileCitationAnnotation.Serialization.cs | 176 + .../MessageTextFileCitationAnnotation.cs | 64 + ...ageTextFilePathAnnotation.Serialization.cs | 176 + .../MessageTextFilePathAnnotation.cs | 55 + ...TextUrlCitationAnnotation.Serialization.cs | 176 + .../MessageTextUrlCitationAnnotation.cs | 55 + ...ageTextUrlCitationDetails.Serialization.cs | 153 + .../MessageTextUrlCitationDetails.cs | 79 + ...osoftFabricToolDefinition.Serialization.cs | 134 + .../MicrosoftFabricToolDefinition.cs | 44 + .../ModifyVectorStoreRequest.Serialization.cs | 213 + .../src/Generated/ModifyVectorStoreRequest.cs | 74 + .../src/Generated/OpenAIFile.Serialization.cs | 217 + .../src/Generated/OpenAIFile.cs | 113 + .../src/Generated/OpenAIFileObject.cs | 48 + .../src/Generated/OpenAIFilePurpose.cs | 66 + ...OpenAIPageableListOfAgent.Serialization.cs | 190 + .../Generated/OpenAIPageableListOfAgent.cs | 101 + .../OpenAIPageableListOfAgentObject.cs | 48 + ...enAIPageableListOfRunStep.Serialization.cs | 190 + .../Generated/OpenAIPageableListOfRunStep.cs | 101 + .../OpenAIPageableListOfRunStepObject.cs | 48 + ...geableListOfThreadMessage.Serialization.cs | 190 + .../OpenAIPageableListOfThreadMessage.cs | 101 + ...OpenAIPageableListOfThreadMessageObject.cs | 48 + ...AIPageableListOfThreadRun.Serialization.cs | 190 + .../OpenAIPageableListOfThreadRun.cs | 101 + .../OpenAIPageableListOfThreadRunObject.cs | 48 + ...PageableListOfVectorStore.Serialization.cs | 190 + .../OpenAIPageableListOfVectorStore.cs | 101 + ...ableListOfVectorStoreFile.Serialization.cs | 190 + .../OpenAIPageableListOfVectorStoreFile.cs | 101 + ...enAIPageableListOfVectorStoreFileObject.cs | 48 + .../OpenAIPageableListOfVectorStoreObject.cs | 48 + ...enApiAnonymousAuthDetails.Serialization.cs | 126 + .../Generated/OpenApiAnonymousAuthDetails.cs | 29 + .../OpenApiAuthDetails.Serialization.cs | 135 + .../src/Generated/OpenApiAuthDetails.cs | 69 + .../src/Generated/OpenApiAuthType.cs | 59 + ...nApiConnectionAuthDetails.Serialization.cs | 134 + .../Generated/OpenApiConnectionAuthDetails.cs | 44 + ...iConnectionSecurityScheme.Serialization.cs | 142 + .../OpenApiConnectionSecurityScheme.cs | 75 + ...OpenApiFunctionDefinition.Serialization.cs | 176 + .../Generated/OpenApiFunctionDefinition.cs | 134 + ...OpenApiManagedAuthDetails.Serialization.cs | 134 + .../Generated/OpenApiManagedAuthDetails.cs | 44 + ...nApiManagedSecurityScheme.Serialization.cs | 142 + .../Generated/OpenApiManagedSecurityScheme.cs | 75 + .../OpenApiToolDefinition.Serialization.cs | 134 + .../src/Generated/OpenApiToolDefinition.cs | 44 + .../Generated/RequiredAction.Serialization.cs | 133 + .../src/Generated/RequiredAction.cs | 69 + .../RequiredFunctionToolCall.Serialization.cs | 140 + .../src/Generated/RequiredFunctionToolCall.cs | 47 + .../RequiredToolCall.Serialization.cs | 135 + .../src/Generated/RequiredToolCall.cs | 83 + .../src/Generated/ResponseFormat.cs | 51 + .../ResponseFormatJsonSchema.Serialization.cs | 168 + .../src/Generated/ResponseFormatJsonSchema.cs | 115 + ...ponseFormatJsonSchemaType.Serialization.cs | 150 + .../Generated/ResponseFormatJsonSchemaType.cs | 80 + .../ResponseFormatJsonSchemaTypeType.cs | 48 + .../src/Generated/RunAdditionalFieldList.cs | 48 + .../RunCompletionUsage.Serialization.cs | 158 + .../src/Generated/RunCompletionUsage.cs | 84 + .../src/Generated/RunError.Serialization.cs | 150 + .../src/Generated/RunError.cs | 82 + .../src/Generated/RunStatus.cs | 69 + .../src/Generated/RunStep.Serialization.cs | 377 + .../src/Generated/RunStep.cs | 178 + ...StepAzureAISearchToolCall.Serialization.cs | 151 + .../Generated/RunStepAzureAISearchToolCall.cs | 50 + ...StepBingGroundingToolCall.Serialization.cs | 151 + .../Generated/RunStepBingGroundingToolCall.cs | 50 + ...odeInterpreterImageOutput.Serialization.cs | 134 + .../RunStepCodeInterpreterImageOutput.cs | 44 + ...InterpreterImageReference.Serialization.cs | 142 + .../RunStepCodeInterpreterImageReference.cs | 75 + ...pCodeInterpreterLogOutput.Serialization.cs | 134 + .../RunStepCodeInterpreterLogOutput.cs | 44 + ...epCodeInterpreterToolCall.Serialization.cs | 140 + .../RunStepCodeInterpreterToolCall.cs | 50 + ...InterpreterToolCallOutput.Serialization.cs | 134 + .../RunStepCodeInterpreterToolCallOutput.cs | 69 + .../RunStepCompletionUsage.Serialization.cs | 158 + .../src/Generated/RunStepCompletionUsage.cs | 84 + .../Generated/RunStepDelta.Serialization.cs | 149 + .../src/Generated/RunStepDelta.cs | 73 + .../RunStepDeltaChunk.Serialization.cs | 158 + .../src/Generated/RunStepDeltaChunk.cs | 87 + .../src/Generated/RunStepDeltaChunkObject.cs | 48 + ...terpreterDetailItemObject.Serialization.cs | 170 + ...tepDeltaCodeInterpreterDetailItemObject.cs | 82 + ...odeInterpreterImageOutput.Serialization.cs | 147 + .../RunStepDeltaCodeInterpreterImageOutput.cs | 41 + ...erpreterImageOutputObject.Serialization.cs | 145 + ...epDeltaCodeInterpreterImageOutputObject.cs | 65 + ...aCodeInterpreterLogOutput.Serialization.cs | 143 + .../RunStepDeltaCodeInterpreterLogOutput.cs | 41 + ...eltaCodeInterpreterOutput.Serialization.cs | 136 + .../RunStepDeltaCodeInterpreterOutput.cs | 80 + ...taCodeInterpreterToolCall.Serialization.cs | 153 + .../RunStepDeltaCodeInterpreterToolCall.cs | 46 + .../RunStepDeltaDetail.Serialization.cs | 134 + .../src/Generated/RunStepDeltaDetail.cs | 69 + ...epDeltaFileSearchToolCall.Serialization.cs | 153 + .../RunStepDeltaFileSearchToolCall.cs | 46 + .../RunStepDeltaFunction.Serialization.cs | 179 + .../src/Generated/RunStepDeltaFunction.cs | 73 + ...StepDeltaFunctionToolCall.Serialization.cs | 153 + .../Generated/RunStepDeltaFunctionToolCall.cs | 46 + ...nStepDeltaMessageCreation.Serialization.cs | 141 + .../Generated/RunStepDeltaMessageCreation.cs | 34 + ...eltaMessageCreationObject.Serialization.cs | 145 + .../RunStepDeltaMessageCreationObject.cs | 65 + .../RunStepDeltaToolCall.Serialization.cs | 139 + .../src/Generated/RunStepDeltaToolCall.cs | 89 + ...unStepDeltaToolCallObject.Serialization.cs | 151 + .../Generated/RunStepDeltaToolCallObject.cs | 43 + .../Generated/RunStepDetails.Serialization.cs | 134 + .../src/Generated/RunStepDetails.cs | 69 + .../Generated/RunStepError.Serialization.cs | 150 + .../src/Generated/RunStepError.cs | 81 + .../src/Generated/RunStepErrorCode.cs | 51 + ...RunStepFileSearchToolCall.Serialization.cs | 140 + .../Generated/RunStepFileSearchToolCall.cs | 50 + ...pFileSearchToolCallResult.Serialization.cs | 183 + .../RunStepFileSearchToolCallResult.cs | 93 + ...FileSearchToolCallResults.Serialization.cs | 167 + .../RunStepFileSearchToolCallResults.cs | 80 + .../RunStepFunctionToolCall.Serialization.cs | 140 + .../src/Generated/RunStepFunctionToolCall.cs | 50 + ...tepMessageCreationDetails.Serialization.cs | 134 + .../RunStepMessageCreationDetails.cs | 44 + ...pMessageCreationReference.Serialization.cs | 142 + .../RunStepMessageCreationReference.cs | 75 + ...epMicrosoftFabricToolCall.Serialization.cs | 151 + .../RunStepMicrosoftFabricToolCall.cs | 50 + .../src/Generated/RunStepObject.cs | 48 + ...RunStepSharepointToolCall.Serialization.cs | 151 + .../Generated/RunStepSharepointToolCall.cs | 50 + .../src/Generated/RunStepStatus.cs | 60 + .../src/Generated/RunStepStreamEvent.cs | 66 + .../RunStepToolCall.Serialization.cs | 141 + .../src/Generated/RunStepToolCall.cs | 83 + .../RunStepToolCallDetails.Serialization.cs | 144 + .../src/Generated/RunStepToolCallDetails.cs | 57 + .../src/Generated/RunStepType.cs | 51 + .../src/Generated/RunStreamEvent.cs | 75 + .../SharepointToolDefinition.Serialization.cs | 134 + .../src/Generated/SharepointToolDefinition.cs | 44 + .../SubmitToolOutputsAction.Serialization.cs | 134 + .../src/Generated/SubmitToolOutputsAction.cs | 44 + ...itToolOutputsToRunRequest.Serialization.cs | 175 + .../SubmitToolOutputsToRunRequest.cs | 80 + .../ThreadDeletionStatus.Serialization.cs | 158 + .../src/Generated/ThreadDeletionStatus.cs | 85 + .../Generated/ThreadDeletionStatusObject.cs | 48 + .../Generated/ThreadMessage.Serialization.cs | 376 + .../src/Generated/ThreadMessage.cs | 167 + .../src/Generated/ThreadMessageObject.cs | 48 + .../ThreadMessageOptions.Serialization.cs | 215 + .../src/Generated/ThreadMessageOptions.cs | 121 + .../src/Generated/ThreadRun.Serialization.cs | 650 + .../src/Generated/ThreadRun.cs | 343 + .../src/Generated/ThreadRunObject.cs | 48 + .../src/Generated/ThreadStreamEvent.cs | 48 + .../Generated/ToolConnection.Serialization.cs | 142 + .../src/Generated/ToolConnection.cs | 75 + .../ToolConnectionList.Serialization.cs | 159 + .../src/Generated/ToolConnectionList.cs | 72 + .../Generated/ToolDefinition.Serialization.cs | 141 + .../src/Generated/ToolDefinition.cs | 69 + .../src/Generated/ToolOutput.Serialization.cs | 156 + .../src/Generated/ToolOutput.cs | 69 + .../Generated/ToolResources.Serialization.cs | 179 + .../src/Generated/ToolResources.cs | 77 + .../TruncationObject.Serialization.cs | 165 + .../src/Generated/TruncationObject.cs | 91 + .../src/Generated/TruncationStrategy.cs | 51 + .../UnknownMessageContent.Serialization.cs | 126 + .../src/Generated/UnknownMessageContent.cs | 28 + ...nknownMessageDeltaContent.Serialization.cs | 132 + .../Generated/UnknownMessageDeltaContent.cs | 29 + ...essageDeltaTextAnnotation.Serialization.cs | 132 + .../UnknownMessageDeltaTextAnnotation.cs | 29 + ...nownMessageTextAnnotation.Serialization.cs | 132 + .../Generated/UnknownMessageTextAnnotation.cs | 29 + ...UnknownOpenApiAuthDetails.Serialization.cs | 126 + .../Generated/UnknownOpenApiAuthDetails.cs | 28 + .../UnknownRequiredAction.Serialization.cs | 126 + .../src/Generated/UnknownRequiredAction.cs | 28 + .../UnknownRequiredToolCall.Serialization.cs | 132 + .../src/Generated/UnknownRequiredToolCall.cs | 29 + ...InterpreterToolCallOutput.Serialization.cs | 126 + ...ownRunStepCodeInterpreterToolCallOutput.cs | 28 + ...eltaCodeInterpreterOutput.Serialization.cs | 132 + ...nknownRunStepDeltaCodeInterpreterOutput.cs | 29 + ...UnknownRunStepDeltaDetail.Serialization.cs | 126 + .../Generated/UnknownRunStepDeltaDetail.cs | 28 + ...knownRunStepDeltaToolCall.Serialization.cs | 138 + .../Generated/UnknownRunStepDeltaToolCall.cs | 30 + .../UnknownRunStepDetails.Serialization.cs | 126 + .../src/Generated/UnknownRunStepDetails.cs | 28 + .../UnknownRunStepToolCall.Serialization.cs | 132 + .../src/Generated/UnknownRunStepToolCall.cs | 29 + .../UnknownToolDefinition.Serialization.cs | 126 + .../src/Generated/UnknownToolDefinition.cs | 28 + ...reChunkingStrategyRequest.Serialization.cs | 126 + ...knownVectorStoreChunkingStrategyRequest.cs | 28 + ...eChunkingStrategyResponse.Serialization.cs | 126 + ...nownVectorStoreChunkingStrategyResponse.cs | 28 + .../UpdateAgentRequest.Serialization.cs | 374 + .../src/Generated/UpdateAgentRequest.cs | 179 + ...preterToolResourceOptions.Serialization.cs | 159 + ...pdateCodeInterpreterToolResourceOptions.cs | 66 + ...SearchToolResourceOptions.Serialization.cs | 159 + .../UpdateFileSearchToolResourceOptions.cs | 66 + .../UpdateMessageRequest.Serialization.cs | 167 + .../src/Generated/UpdateMessageRequest.cs | 66 + .../UpdateRunRequest.Serialization.cs | 167 + .../src/Generated/UpdateRunRequest.cs | 66 + .../UpdateThreadRequest.Serialization.cs | 190 + .../src/Generated/UpdateThreadRequest.cs | 78 + ...pdateToolResourcesOptions.Serialization.cs | 179 + .../Generated/UpdateToolResourcesOptions.cs | 83 + .../UploadFileRequest.Serialization.cs | 191 + .../src/Generated/UploadFileRequest.cs | 85 + .../Generated/VectorStore.Serialization.cs | 291 + .../src/Generated/VectorStore.cs | 132 + ...toChunkingStrategyRequest.Serialization.cs | 126 + .../VectorStoreAutoChunkingStrategyRequest.cs | 29 + ...oChunkingStrategyResponse.Serialization.cs | 126 + ...VectorStoreAutoChunkingStrategyResponse.cs | 29 + ...reChunkingStrategyRequest.Serialization.cs | 134 + .../VectorStoreChunkingStrategyRequest.cs | 69 + .../VectorStoreChunkingStrategyRequestType.cs | 51 + ...eChunkingStrategyResponse.Serialization.cs | 134 + .../VectorStoreChunkingStrategyResponse.cs | 69 + ...VectorStoreChunkingStrategyResponseType.cs | 51 + .../VectorStoreConfiguration.Serialization.cs | 152 + .../src/Generated/VectorStoreConfiguration.cs | 79 + ...VectorStoreConfigurations.Serialization.cs | 150 + .../Generated/VectorStoreConfigurations.cs | 82 + .../VectorStoreDataSource.Serialization.cs | 150 + .../src/Generated/VectorStoreDataSource.cs | 84 + .../VectorStoreDataSourceAssetType.cs | 54 + ...VectorStoreDeletionStatus.Serialization.cs | 158 + .../Generated/VectorStoreDeletionStatus.cs | 85 + .../VectorStoreDeletionStatusObject.cs | 48 + ...ctorStoreExpirationPolicy.Serialization.cs | 150 + .../Generated/VectorStoreExpirationPolicy.cs | 78 + .../VectorStoreExpirationPolicyAnchor.cs | 48 + .../VectorStoreFile.Serialization.cs | 219 + .../src/Generated/VectorStoreFile.cs | 139 + .../VectorStoreFileBatch.Serialization.cs | 189 + .../src/Generated/VectorStoreFileBatch.cs | 106 + .../Generated/VectorStoreFileBatchObject.cs | 48 + .../Generated/VectorStoreFileBatchStatus.cs | 57 + .../VectorStoreFileCount.Serialization.cs | 180 + .../src/Generated/VectorStoreFileCount.cs | 96 + ...orStoreFileDeletionStatus.Serialization.cs | 158 + .../VectorStoreFileDeletionStatus.cs | 85 + .../VectorStoreFileDeletionStatusObject.cs | 48 + .../VectorStoreFileError.Serialization.cs | 150 + .../src/Generated/VectorStoreFileError.cs | 81 + .../src/Generated/VectorStoreFileErrorCode.cs | 54 + .../src/Generated/VectorStoreFileObject.cs | 48 + .../src/Generated/VectorStoreFileStatus.cs | 57 + .../Generated/VectorStoreFileStatusFilter.cs | 57 + .../src/Generated/VectorStoreObject.cs | 48 + ...icChunkingStrategyOptions.Serialization.cs | 150 + ...ectorStoreStaticChunkingStrategyOptions.cs | 87 + ...icChunkingStrategyRequest.Serialization.cs | 134 + ...ectorStoreStaticChunkingStrategyRequest.cs | 44 + ...cChunkingStrategyResponse.Serialization.cs | 134 + ...ctorStoreStaticChunkingStrategyResponse.cs | 44 + .../src/Generated/VectorStoreStatus.cs | 54 + .../src/Properties/AssemblyInfo.cs | 11 + .../tests/Azure.AI.Assistants.Tests.csproj | 20 + .../Samples/Samples_AIAssistantClient.cs | 7046 ++++++ sdk/ai/Azure.AI.Assistants/tsp-location.yaml | 4 + .../Azure.AI.Projects.1DP.sln | 56 + sdk/ai/Azure.AI.Projects.1DP/CHANGELOG.md | 11 + .../Directory.Build.props | 6 + sdk/ai/Azure.AI.Projects.1DP/README.md | 107 + .../src/Azure.AI.Projects.1DP.csproj | 20 + .../src/Generated/AIProjectClient.cs | 166 + .../AIProjects1DPClientBuilderExtensions.cs | 46 + .../Generated/AIProjects1DPModelFactory.cs | 488 + .../src/Generated/Connections.cs | 165 + .../src/Generated/Datasets.cs | 415 + .../src/Generated/Docs/Connections.xml | 225 + .../src/Generated/Docs/Datasets.xml | 1029 + .../src/Generated/Docs/Deployments.xml | 201 + .../src/Generated/Docs/EvaluationResults.xml | 969 + .../src/Generated/Docs/Evaluations.xml | 515 + .../src/Generated/Docs/Indexes.xml | 707 + .../src/Generated/Docs/RedTeams.xml | 477 + .../src/Generated/EvaluationResults.cs | 397 + .../src/Generated/Indexes.cs | 377 + .../UnknownBaseCredential.Serialization.cs | 126 + .../src/Generated/UnknownBaseCredential.cs | 28 + .../UnknownDatasetVersion.Serialization.cs | 197 + .../src/Generated/UnknownDatasetVersion.cs | 36 + .../UnknownDeployment.Serialization.cs | 132 + .../src/Generated/UnknownDeployment.cs | 29 + .../Generated/UnknownIndex.Serialization.cs | 179 + .../src/Generated/UnknownIndex.cs | 34 + .../UnknownInputData.Serialization.cs | 126 + .../src/Generated/UnknownInputData.cs | 28 + .../src/Properties/AssemblyInfo.cs | 11 + .../tests/Azure.AI.Projects.1DP.Tests.csproj | 20 + .../Generated/Samples/Samples_Connections.cs | 262 + .../Generated/Samples/Samples_Datasets.cs | 1133 + .../Generated/Samples/Samples_Deployments.cs | 238 + .../Samples/Samples_EvaluationResults.cs | 1061 + .../Generated/Samples/Samples_Evaluations.cs | 566 + .../Generated/Samples/Samples_Indexes.cs | 787 + .../Generated/Samples/Samples_RedTeams.cs | 527 + .../Azure.AI.Projects.1DP/tsp-location.yaml | 4 + sdk/ai/ci.yml | 35 + .../Azure.ResourceManager.Cdn/src/autorest.md | 2 +- .../Sample_AgentPoolSnapshotCollection.cs | 10 +- .../Sample_AgentPoolSnapshotResource.cs | 6 +- .../Sample_AgentPoolUpgradeProfileResource.cs | 2 +- ...ple_ContainerServiceAgentPoolCollection.cs | 133 +- ...ample_ContainerServiceAgentPoolResource.cs | 155 +- ...rviceMaintenanceConfigurationCollection.cs | 20 +- ...ServiceMaintenanceConfigurationResource.cs | 12 +- ...ontainerServiceManagedClusterCollection.cs | 243 +- ..._ContainerServiceManagedClusterResource.cs | 42 +- ...vicePrivateEndpointConnectionCollection.cs | 10 +- ...ervicePrivateEndpointConnectionResource.cs | 6 +- ...rviceTrustedAccessRoleBindingCollection.cs | 10 +- ...ServiceTrustedAccessRoleBindingResource.cs | 6 +- .../Samples/Sample_MachineCollection.cs | 164 + .../Samples/Sample_MachineResource.cs | 50 + ...le_ManagedClusterUpgradeProfileResource.cs | 2 +- .../Sample_MeshRevisionProfileCollection.cs | 8 +- .../Sample_MeshRevisionProfileResource.cs | 2 +- .../Sample_MeshUpgradeProfileCollection.cs | 8 +- .../Sample_MeshUpgradeProfileResource.cs | 2 +- .../Sample_SubscriptionResourceExtensions.cs | 8 +- .../Generated/AgentPoolSnapshotCollection.cs | 20 +- .../Generated/AgentPoolSnapshotResource.cs | 24 +- .../AgentPoolUpgradeProfileResource.cs | 4 +- .../ArmContainerServiceModelFactory.cs | 407 +- .../ContainerServiceAgentPoolCollection.cs | 36 +- ...ainerServiceAgentPoolData.Serialization.cs | 169 + .../ContainerServiceAgentPoolData.cs | 50 +- .../ContainerServiceAgentPoolResource.cs | 226 +- ...rviceMaintenanceConfigurationCollection.cs | 20 +- ...ServiceMaintenanceConfigurationResource.cs | 12 +- ...ontainerServiceManagedClusterCollection.cs | 36 +- ...ServiceManagedClusterData.Serialization.cs | 172 + .../ContainerServiceManagedClusterData.cs | 67 +- .../ContainerServiceManagedClusterResource.cs | 208 +- ...vicePrivateEndpointConnectionCollection.cs | 20 +- ...ervicePrivateEndpointConnectionResource.cs | 12 +- ...rviceTrustedAccessRoleBindingCollection.cs | 20 +- ...ServiceTrustedAccessRoleBindingResource.cs | 12 +- .../Extensions/ContainerServiceExtensions.cs | 66 +- .../MockableContainerServiceArmClient.cs | 24 +- ...leContainerServiceResourceGroupResource.cs | 8 +- ...bleContainerServiceSubscriptionResource.cs | 20 +- .../src/Generated/MachineCollection.cs | 395 + ...zation.cs => MachineData.Serialization.cs} | 126 +- ...{OSOptionProfileData.cs => MachineData.cs} | 35 +- .../MachineResource.Serialization.cs | 26 + ...nProfileResource.cs => MachineResource.cs} | 88 +- .../ManagedClusterUpgradeProfileResource.cs | 4 +- .../MeshRevisionProfileCollection.cs | 16 +- .../Generated/MeshRevisionProfileResource.cs | 4 +- .../Generated/MeshUpgradeProfileCollection.cs | 16 +- .../Generated/MeshUpgradeProfileResource.cs | 4 +- .../AdvancedNetworking.Serialization.cs | 233 + .../Generated/Models/AdvancedNetworking.cs | 99 + ...edNetworkingObservability.Serialization.cs | 167 + .../Models/AdvancedNetworkingObservability.cs | 66 + ...dvancedNetworkingSecurity.Serialization.cs | 167 + .../Models/AdvancedNetworkingSecurity.cs | 66 + ...olDeleteMachinesParameter.Serialization.cs | 136 + ...cs => AgentPoolDeleteMachinesParameter.cs} | 42 +- .../AgentPoolSecurityProfile.Serialization.cs | 198 + .../Models/AgentPoolSecurityProfile.cs | 71 + .../AgentPoolUpgradeSettings.Serialization.cs | 32 +- .../Models/AgentPoolUpgradeSettings.cs | 11 +- .../AgentPoolWindowsProfile.Serialization.cs | 167 + .../Models/AgentPoolWindowsProfile.cs | 66 + .../src/Generated/Models/ArtifactSource.cs | 51 + .../Models/ContainerServiceNetworkPolicy.cs | 3 + ...inerServiceNetworkProfile.Serialization.cs | 31 + .../Models/ContainerServiceNetworkProfile.cs | 7 +- .../Models/ContainerServiceOutboundType.cs | 3 + .../src/Generated/Models/GpuDriver.cs | 51 + .../Models/GpuProfile.Serialization.cs | 166 + .../src/Generated/Models/GpuProfile.cs | 66 + .../IstioEgressGateway.Serialization.cs | 66 +- .../Generated/Models/IstioEgressGateway.cs | 8 +- .../Models/KubernetesVersion.Serialization.cs | 39 +- .../src/Generated/Models/KubernetesVersion.cs | 7 +- ...n.cs => MachineIPAddress.Serialization.cs} | 106 +- .../src/Generated/Models/MachineIPAddress.cs | 71 + .../Models/MachineListResult.Serialization.cs | 215 + .../src/Generated/Models/MachineListResult.cs | 70 + .../MachineNetworkProperties.Serialization.cs | 185 + .../Models/MachineNetworkProperties.cs | 67 + .../Models/MachineProperties.Serialization.cs | 199 + .../src/Generated/Models/MachineProperties.cs | 78 + ...edClusterAgentPoolProfile.Serialization.cs | 140 + .../Models/ManagedClusterAgentPoolProfile.cs | 7 +- ...gentPoolProfileProperties.Serialization.cs | 165 + ...anagedClusterAgentPoolProfileProperties.cs | 50 +- ...dClusterAutoScalerProfile.Serialization.cs | 96 + .../Models/ManagedClusterAutoScalerProfile.cs | 17 +- ...edClusterBootstrapProfile.Serialization.cs | 196 + .../Models/ManagedClusterBootstrapProfile.cs | 72 + ...anagedClusterCostAnalysis.Serialization.cs | 167 + .../Models/ManagedClusterCostAnalysis.cs | 66 + ...agedClusterIngressProfile.Serialization.cs | 166 + .../Models/ManagedClusterIngressProfile.cs | 66 + ...gressProfileWebAppRouting.Serialization.cs | 263 + ...nagedClusterIngressProfileWebAppRouting.cs | 78 + ...lusterLoadBalancerProfile.Serialization.cs | 4 +- .../ManagedClusterLoadBalancerProfile.cs | 4 +- ...agedClusterMetricsProfile.Serialization.cs | 169 + .../Models/ManagedClusterMetricsProfile.cs | 77 + ...dClusterNatGatewayProfile.Serialization.cs | 4 +- .../Models/ManagedClusterNatGatewayProfile.cs | 4 +- .../ManagedClusterNodeOSUpgradeChannel.cs | 3 + ...rNodeResourceGroupProfile.Serialization.cs | 166 + .../ManagedClusterNodeResourceGroupProfile.cs | 66 + ...gedClusterSecurityProfile.Serialization.cs | 62 +- .../Models/ManagedClusterSecurityProfile.cs | 8 +- .../src/Generated/Models/RestrictionLevel.cs | 51 + .../OSOptionProfileResource.Serialization.cs | 26 - .../AgentPoolsRestOperations.cs | 154 +- .../RestOperations/MachinesRestOperations.cs | 341 + ...MaintenanceConfigurationsRestOperations.cs | 2 +- .../ManagedClustersRestOperations.cs | 160 +- ...rivateEndpointConnectionsRestOperations.cs | 2 +- .../PrivateLinkResourcesRestOperations.cs | 2 +- ...solvePrivateLinkServiceIdRestOperations.cs | 2 +- .../RestOperations/SnapshotsRestOperations.cs | 2 +- ...TrustedAccessRoleBindingsRestOperations.cs | 2 +- .../TrustedAccessRolesRestOperations.cs | 2 +- .../src/autorest.md | 2 +- .../Azure.ResourceManager.DurableTask.sln | 56 + .../CHANGELOG.md | 11 + .../Directory.Build.props | 6 + .../README.md | 80 + ...zure.ResourceManager.DurableTask.net8.0.cs | 270 + ...ourceManager.DurableTask.netstandard2.0.cs | 270 + .../assets.json | 7 + ...ResourceManager.DurableTask.Samples.csproj | 13 + .../Samples/Sample_SchedulerCollection.cs | 201 + .../Samples/Sample_SchedulerResource.cs | 122 + .../Sample_SubscriptionResourceExtensions.cs | 50 + .../Samples/Sample_TaskHubCollection.cs | 200 + .../Samples/Sample_TaskHubResource.cs | 113 + .../Azure.ResourceManager.DurableTask.csproj | 8 + .../Generated/ArmDurableTaskModelFactory.cs | 116 + .../Extensions/DurableTaskExtensions.cs | 238 + .../MockableDurableTaskArmClient.cs | 61 + ...ockableDurableTaskResourceGroupResource.cs | 105 + ...MockableDurableTaskSubscriptionResource.cs | 102 + .../src/Generated/Internal/Argument.cs | 129 + .../Internal/ChangeTrackingDictionary.cs | 167 + .../Generated/Internal/ChangeTrackingList.cs | 153 + .../Internal/ModelSerializationExtensions.cs | 399 + .../src/Generated/Internal/Optional.cs | 51 + .../Internal/Utf8JsonRequestContent.cs | 55 + .../DurableTaskArmOperation.cs | 94 + .../DurableTaskArmOperationOfT.cs | 100 + .../SchedulerOperationSource.cs | 36 + .../TaskHubOperationSource.cs | 36 + .../src/Generated/Models/ProvisioningState.cs | 66 + .../src/Generated/Models/RedundancyState.cs | 51 + .../SchedulerListResult.Serialization.cs | 151 + .../Generated/Models/SchedulerListResult.cs | 80 + .../Models/SchedulerPatch.Serialization.cs | 159 + .../src/Generated/Models/SchedulerPatch.cs | 70 + .../SchedulerProperties.Serialization.cs | 170 + .../Generated/Models/SchedulerProperties.cs | 91 + ...SchedulerPropertiesUpdate.Serialization.cs | 184 + .../Models/SchedulerPropertiesUpdate.cs | 78 + .../Models/SchedulerSku.Serialization.cs | 156 + .../src/Generated/Models/SchedulerSku.cs | 83 + .../SchedulerSkuUpdate.Serialization.cs | 159 + .../Generated/Models/SchedulerSkuUpdate.cs | 73 + .../Models/TaskHubListResult.Serialization.cs | 151 + .../src/Generated/Models/TaskHubListResult.cs | 80 + .../Models/TaskHubProperties.Serialization.cs | 148 + .../src/Generated/Models/TaskHubProperties.cs | 69 + .../src/Generated/ProviderConstants.cs | 16 + .../SchedulersRestOperations.cs | 723 + .../RestOperations/TaskHubsRestOperations.cs | 513 + .../src/Generated/SchedulerCollection.cs | 494 + .../Generated/SchedulerData.Serialization.cs | 178 + .../src/Generated/SchedulerData.cs | 83 + .../SchedulerResource.Serialization.cs | 26 + .../src/Generated/SchedulerResource.cs | 776 + .../src/Generated/TaskHubCollection.cs | 493 + .../Generated/TaskHubData.Serialization.cs | 155 + .../src/Generated/TaskHubData.cs | 75 + .../TaskHubResource.Serialization.cs | 26 + .../src/Generated/TaskHubResource.cs | 347 + .../src/Properties/AssemblyInfo.cs | 11 + ...e.ResourceManager.DurableTask.Tests.csproj | 8 + .../tests/DurableTaskManagementTestBase.cs | 45 + .../DurableTaskManagementTestEnvironment.cs | 11 + .../tsp-location.yaml | 4 + sdk/durabletask/ci.mgmt.yml | 26 + ...ealth.Insights.RadiologyInsights.net8.0.cs | 232 +- ...sights.RadiologyInsights.netstandard2.0.cs | 232 +- .../AssessmentValueRange.Serialization.cs | 150 + .../src/Generated/AssessmentValueRange.cs | 82 + .../Docs/RadiologyInsightsClient.xml | 26 + .../src/Generated/FhirR4Extension.cs | 2 +- .../GuidanceInference.Serialization.cs | 249 + .../src/Generated/GuidanceInference.cs | 73 + .../GuidanceOptions.Serialization.cs | 142 + .../src/Generated/GuidanceOptions.cs | 72 + .../src/Generated/GuidanceRankingType.cs | 51 + ...thInsightsRadiologyInsightsModelFactory.cs | 102 +- ...resentGuidanceInformation.Serialization.cs | 238 + .../Generated/PresentGuidanceInformation.cs | 94 + .../Generated/QualityMeasureComplianceType.cs | 57 + .../QualityMeasureInference.Serialization.cs | 188 + .../src/Generated/QualityMeasureInference.cs | 56 + .../QualityMeasureOptions.Serialization.cs | 152 + .../src/Generated/QualityMeasureOptions.cs | 76 + .../src/Generated/QualityMeasureType.cs | 114 + .../RadiologyInsightsClientOptions.cs | 5 +- ...adiologyInsightsInference.Serialization.cs | 3 + .../Generated/RadiologyInsightsInference.cs | 2 +- ...yInsightsInferenceOptions.Serialization.cs | 32 +- .../RadiologyInsightsInferenceOptions.cs | 10 +- .../RadiologyInsightsInferenceType.cs | 9 + .../RadiologyInsightsPatientResult.cs | 6 +- .../ScoringAndAssessmentCategoryType.cs | 147 + ...ingAndAssessmentInference.Serialization.cs | 190 + .../ScoringAndAssessmentInference.cs | 59 + .../Samples_RadiologyInsightsClient.cs | 26 + .../tsp-location.yaml | 9 +- .../Configuration.json | 13 + .../src/autorest.md | 91 - .../tsp-location.yaml | 4 + .../tspCodeModel.json | 19280 ++++++++++++++++ .../src/autorest.md | 2 +- .../tsp-location.yaml | 4 + .../tsp-location.yaml | 4 + .../tsp-location.yaml | 4 + sdk/resourcemanager/ci.mgmt.yml | 2 + sdk/storage/ci.yml | 8 + 727 files changed, 122273 insertions(+), 1055 deletions(-) create mode 100644 sdk/ai/Azure.AI.Assistants/Azure.AI.Assistants.sln create mode 100644 sdk/ai/Azure.AI.Assistants/CHANGELOG.md create mode 100644 sdk/ai/Azure.AI.Assistants/Directory.Build.props create mode 100644 sdk/ai/Azure.AI.Assistants/README.md create mode 100644 sdk/ai/Azure.AI.Assistants/src/Azure.AI.Assistants.csproj create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/AIAssistantClient.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/AIAssistantClientOptions.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/AIAssistantsClientBuilderExtensions.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/AIAssistantsModelFactory.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/AISearchIndexResource.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/AISearchIndexResource.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/Agent.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/Agent.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/AgentObject.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/AgentStreamEvent.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/AgentThread.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/AgentThread.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/AgentThreadCreationOptions.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/AgentThreadCreationOptions.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/AgentThreadObject.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/AgentsApiResponseFormat.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/AgentsApiResponseFormat.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/AgentsApiResponseFormatMode.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/AgentsApiToolChoiceOptionMode.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/AgentsNamedToolChoice.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/AgentsNamedToolChoice.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/AgentsNamedToolChoiceType.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/AzureAISearchQueryType.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/AzureAISearchResource.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/AzureAISearchResource.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/AzureAISearchToolDefinition.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/AzureAISearchToolDefinition.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/AzureFunctionBinding.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/AzureFunctionBinding.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/AzureFunctionBindingType.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/AzureFunctionStorageQueue.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/AzureFunctionStorageQueue.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/AzureFunctionToolDefinition.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/AzureFunctionToolDefinition.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/BingGroundingToolDefinition.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/BingGroundingToolDefinition.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/CodeInterpreterToolDefinition.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/CodeInterpreterToolDefinition.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/CodeInterpreterToolResource.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/CodeInterpreterToolResource.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/CreateAgentRequest.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/CreateAgentRequest.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/CreateMessageRequest.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/CreateMessageRequest.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/CreateRunRequest.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/CreateRunRequest.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/CreateThreadAndRunRequest.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/CreateThreadAndRunRequest.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/CreateThreadRequest.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/CreateThreadRequest.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/CreateVectorStoreFileBatchRequest.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/CreateVectorStoreFileBatchRequest.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/CreateVectorStoreFileRequest.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/CreateVectorStoreFileRequest.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/CreateVectorStoreRequest.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/CreateVectorStoreRequest.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/Docs/AIAssistantClient.xml create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/DoneEvent.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/ErrorEvent.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/File.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/File.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchRankingOptions.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchRankingOptions.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolCallContent.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolCallContent.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolCallContentType.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolDefinition.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolDefinition.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolDefinitionDetails.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolDefinitionDetails.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolResource.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolResource.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/FileState.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/FunctionName.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/FunctionName.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/FunctionToolDefinition.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/FunctionToolDefinition.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/IncompleteDetailsReason.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/IncompleteRunDetails.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/IncompleteRunDetails.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/Internal/Argument.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/Internal/ChangeTrackingDictionary.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/Internal/ChangeTrackingList.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/Internal/ModelSerializationExtensions.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/Internal/MultipartFormDataRequestContent.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/Internal/Optional.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/Internal/Utf8JsonRequestContent.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/InternalAgentDeletionStatus.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/InternalAgentDeletionStatus.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/InternalAgentDeletionStatusObject.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/InternalAzureFunctionDefinition.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/InternalAzureFunctionDefinition.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/InternalCodeInterpreterToolCallDetails.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/InternalCodeInterpreterToolCallDetails.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/InternalFileDeletionStatus.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/InternalFileDeletionStatus.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/InternalFileDeletionStatusObject.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/InternalFileListResponse.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/InternalFileListResponse.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/InternalFileListResponseObject.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/InternalFunctionDefinition.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/InternalFunctionDefinition.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/InternalMessageImageFileDetails.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/InternalMessageImageFileDetails.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/InternalMessageTextDetails.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/InternalMessageTextDetails.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/InternalMessageTextFileCitationDetails.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/InternalMessageTextFileCitationDetails.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/InternalMessageTextFilePathDetails.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/InternalMessageTextFilePathDetails.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/InternalRequiredFunctionToolCallDetails.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/InternalRequiredFunctionToolCallDetails.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/InternalRunStepFunctionToolCallDetails.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/InternalRunStepFunctionToolCallDetails.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/InternalSubmitToolOutputsDetails.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/InternalSubmitToolOutputsDetails.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/ListSortOrder.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageAttachment.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageAttachment.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageContent.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageContent.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageDelta.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageDelta.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaChunk.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaChunk.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaChunkObject.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaContent.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaContent.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaImageFileContent.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaImageFileContent.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaImageFileContentObject.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaImageFileContentObject.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextAnnotation.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextAnnotation.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextContent.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextContent.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextContentObject.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextContentObject.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextFileCitationAnnotation.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextFileCitationAnnotation.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextFileCitationAnnotationObject.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextFileCitationAnnotationObject.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextFilePathAnnotation.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextFilePathAnnotation.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextFilePathAnnotationObject.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextFilePathAnnotationObject.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextUrlCitationAnnotation.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextUrlCitationAnnotation.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextUrlCitationDetails.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextUrlCitationDetails.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageImageFileContent.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageImageFileContent.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageIncompleteDetails.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageIncompleteDetails.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageIncompleteDetailsReason.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageRole.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageStatus.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageStreamEvent.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextAnnotation.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextAnnotation.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextContent.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextContent.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextFileCitationAnnotation.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextFileCitationAnnotation.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextFilePathAnnotation.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextFilePathAnnotation.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextUrlCitationAnnotation.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextUrlCitationAnnotation.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextUrlCitationDetails.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextUrlCitationDetails.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MicrosoftFabricToolDefinition.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/MicrosoftFabricToolDefinition.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/ModifyVectorStoreRequest.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/ModifyVectorStoreRequest.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIFile.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIFile.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIFileObject.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIFilePurpose.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfAgent.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfAgent.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfAgentObject.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfRunStep.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfRunStep.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfRunStepObject.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfThreadMessage.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfThreadMessage.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfThreadMessageObject.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfThreadRun.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfThreadRun.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfThreadRunObject.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfVectorStore.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfVectorStore.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfVectorStoreFile.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfVectorStoreFile.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfVectorStoreFileObject.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfVectorStoreObject.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiAnonymousAuthDetails.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiAnonymousAuthDetails.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiAuthDetails.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiAuthDetails.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiAuthType.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiConnectionAuthDetails.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiConnectionAuthDetails.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiConnectionSecurityScheme.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiConnectionSecurityScheme.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiFunctionDefinition.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiFunctionDefinition.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiManagedAuthDetails.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiManagedAuthDetails.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiManagedSecurityScheme.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiManagedSecurityScheme.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiToolDefinition.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiToolDefinition.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RequiredAction.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RequiredAction.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RequiredFunctionToolCall.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RequiredFunctionToolCall.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RequiredToolCall.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RequiredToolCall.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/ResponseFormat.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/ResponseFormatJsonSchema.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/ResponseFormatJsonSchema.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/ResponseFormatJsonSchemaType.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/ResponseFormatJsonSchemaType.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/ResponseFormatJsonSchemaTypeType.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunAdditionalFieldList.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunCompletionUsage.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunCompletionUsage.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunError.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunError.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStatus.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStep.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStep.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepAzureAISearchToolCall.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepAzureAISearchToolCall.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepBingGroundingToolCall.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepBingGroundingToolCall.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterImageOutput.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterImageOutput.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterImageReference.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterImageReference.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterLogOutput.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterLogOutput.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterToolCall.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterToolCall.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterToolCallOutput.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterToolCallOutput.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCompletionUsage.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCompletionUsage.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDelta.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDelta.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaChunk.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaChunk.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaChunkObject.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterDetailItemObject.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterDetailItemObject.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterImageOutput.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterImageOutput.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterImageOutputObject.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterImageOutputObject.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterLogOutput.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterLogOutput.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterOutput.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterOutput.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterToolCall.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterToolCall.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaDetail.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaDetail.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaFileSearchToolCall.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaFileSearchToolCall.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaFunction.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaFunction.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaFunctionToolCall.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaFunctionToolCall.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaMessageCreation.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaMessageCreation.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaMessageCreationObject.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaMessageCreationObject.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaToolCall.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaToolCall.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaToolCallObject.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaToolCallObject.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDetails.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDetails.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepError.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepError.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepErrorCode.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepFileSearchToolCall.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepFileSearchToolCall.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepFileSearchToolCallResult.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepFileSearchToolCallResult.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepFileSearchToolCallResults.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepFileSearchToolCallResults.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepFunctionToolCall.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepFunctionToolCall.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepMessageCreationDetails.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepMessageCreationDetails.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepMessageCreationReference.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepMessageCreationReference.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepMicrosoftFabricToolCall.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepMicrosoftFabricToolCall.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepObject.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepSharepointToolCall.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepSharepointToolCall.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepStatus.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepStreamEvent.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepToolCall.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepToolCall.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepToolCallDetails.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepToolCallDetails.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStepType.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/RunStreamEvent.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/SharepointToolDefinition.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/SharepointToolDefinition.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/SubmitToolOutputsAction.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/SubmitToolOutputsAction.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/SubmitToolOutputsToRunRequest.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/SubmitToolOutputsToRunRequest.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/ThreadDeletionStatus.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/ThreadDeletionStatus.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/ThreadDeletionStatusObject.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/ThreadMessage.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/ThreadMessage.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/ThreadMessageObject.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/ThreadMessageOptions.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/ThreadMessageOptions.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/ThreadRun.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/ThreadRun.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/ThreadRunObject.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/ThreadStreamEvent.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/ToolConnection.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/ToolConnection.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/ToolConnectionList.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/ToolConnectionList.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/ToolDefinition.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/ToolDefinition.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/ToolOutput.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/ToolOutput.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/ToolResources.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/ToolResources.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/TruncationObject.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/TruncationObject.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/TruncationStrategy.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UnknownMessageContent.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UnknownMessageContent.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UnknownMessageDeltaContent.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UnknownMessageDeltaContent.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UnknownMessageDeltaTextAnnotation.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UnknownMessageDeltaTextAnnotation.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UnknownMessageTextAnnotation.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UnknownMessageTextAnnotation.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UnknownOpenApiAuthDetails.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UnknownOpenApiAuthDetails.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRequiredAction.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRequiredAction.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRequiredToolCall.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRequiredToolCall.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepCodeInterpreterToolCallOutput.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepCodeInterpreterToolCallOutput.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepDeltaCodeInterpreterOutput.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepDeltaCodeInterpreterOutput.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepDeltaDetail.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepDeltaDetail.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepDeltaToolCall.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepDeltaToolCall.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepDetails.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepDetails.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepToolCall.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepToolCall.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UnknownToolDefinition.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UnknownToolDefinition.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UnknownVectorStoreChunkingStrategyRequest.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UnknownVectorStoreChunkingStrategyRequest.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UnknownVectorStoreChunkingStrategyResponse.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UnknownVectorStoreChunkingStrategyResponse.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UpdateAgentRequest.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UpdateAgentRequest.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UpdateCodeInterpreterToolResourceOptions.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UpdateCodeInterpreterToolResourceOptions.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UpdateFileSearchToolResourceOptions.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UpdateFileSearchToolResourceOptions.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UpdateMessageRequest.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UpdateMessageRequest.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UpdateRunRequest.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UpdateRunRequest.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UpdateThreadRequest.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UpdateThreadRequest.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UpdateToolResourcesOptions.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UpdateToolResourcesOptions.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UploadFileRequest.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/UploadFileRequest.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStore.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStore.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreAutoChunkingStrategyRequest.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreAutoChunkingStrategyRequest.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreAutoChunkingStrategyResponse.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreAutoChunkingStrategyResponse.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreChunkingStrategyRequest.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreChunkingStrategyRequest.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreChunkingStrategyRequestType.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreChunkingStrategyResponse.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreChunkingStrategyResponse.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreChunkingStrategyResponseType.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreConfiguration.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreConfiguration.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreConfigurations.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreConfigurations.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreDataSource.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreDataSource.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreDataSourceAssetType.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreDeletionStatus.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreDeletionStatus.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreDeletionStatusObject.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreExpirationPolicy.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreExpirationPolicy.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreExpirationPolicyAnchor.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFile.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFile.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileBatch.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileBatch.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileBatchObject.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileBatchStatus.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileCount.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileCount.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileDeletionStatus.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileDeletionStatus.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileDeletionStatusObject.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileError.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileError.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileErrorCode.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileObject.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileStatus.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileStatusFilter.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreObject.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreStaticChunkingStrategyOptions.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreStaticChunkingStrategyOptions.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreStaticChunkingStrategyRequest.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreStaticChunkingStrategyRequest.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreStaticChunkingStrategyResponse.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreStaticChunkingStrategyResponse.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreStatus.cs create mode 100644 sdk/ai/Azure.AI.Assistants/src/Properties/AssemblyInfo.cs create mode 100644 sdk/ai/Azure.AI.Assistants/tests/Azure.AI.Assistants.Tests.csproj create mode 100644 sdk/ai/Azure.AI.Assistants/tests/Generated/Samples/Samples_AIAssistantClient.cs create mode 100644 sdk/ai/Azure.AI.Assistants/tsp-location.yaml create mode 100644 sdk/ai/Azure.AI.Projects.1DP/Azure.AI.Projects.1DP.sln create mode 100644 sdk/ai/Azure.AI.Projects.1DP/CHANGELOG.md create mode 100644 sdk/ai/Azure.AI.Projects.1DP/Directory.Build.props create mode 100644 sdk/ai/Azure.AI.Projects.1DP/README.md create mode 100644 sdk/ai/Azure.AI.Projects.1DP/src/Azure.AI.Projects.1DP.csproj create mode 100644 sdk/ai/Azure.AI.Projects.1DP/src/Generated/AIProjectClient.cs create mode 100644 sdk/ai/Azure.AI.Projects.1DP/src/Generated/AIProjects1DPClientBuilderExtensions.cs create mode 100644 sdk/ai/Azure.AI.Projects.1DP/src/Generated/AIProjects1DPModelFactory.cs create mode 100644 sdk/ai/Azure.AI.Projects.1DP/src/Generated/Connections.cs create mode 100644 sdk/ai/Azure.AI.Projects.1DP/src/Generated/Datasets.cs create mode 100644 sdk/ai/Azure.AI.Projects.1DP/src/Generated/Docs/Connections.xml create mode 100644 sdk/ai/Azure.AI.Projects.1DP/src/Generated/Docs/Datasets.xml create mode 100644 sdk/ai/Azure.AI.Projects.1DP/src/Generated/Docs/Deployments.xml create mode 100644 sdk/ai/Azure.AI.Projects.1DP/src/Generated/Docs/EvaluationResults.xml create mode 100644 sdk/ai/Azure.AI.Projects.1DP/src/Generated/Docs/Evaluations.xml create mode 100644 sdk/ai/Azure.AI.Projects.1DP/src/Generated/Docs/Indexes.xml create mode 100644 sdk/ai/Azure.AI.Projects.1DP/src/Generated/Docs/RedTeams.xml create mode 100644 sdk/ai/Azure.AI.Projects.1DP/src/Generated/EvaluationResults.cs create mode 100644 sdk/ai/Azure.AI.Projects.1DP/src/Generated/Indexes.cs create mode 100644 sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownBaseCredential.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownBaseCredential.cs create mode 100644 sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownDatasetVersion.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownDatasetVersion.cs create mode 100644 sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownDeployment.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownDeployment.cs create mode 100644 sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownIndex.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownIndex.cs create mode 100644 sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownInputData.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownInputData.cs create mode 100644 sdk/ai/Azure.AI.Projects.1DP/src/Properties/AssemblyInfo.cs create mode 100644 sdk/ai/Azure.AI.Projects.1DP/tests/Azure.AI.Projects.1DP.Tests.csproj create mode 100644 sdk/ai/Azure.AI.Projects.1DP/tests/Generated/Samples/Samples_Connections.cs create mode 100644 sdk/ai/Azure.AI.Projects.1DP/tests/Generated/Samples/Samples_Datasets.cs create mode 100644 sdk/ai/Azure.AI.Projects.1DP/tests/Generated/Samples/Samples_Deployments.cs create mode 100644 sdk/ai/Azure.AI.Projects.1DP/tests/Generated/Samples/Samples_EvaluationResults.cs create mode 100644 sdk/ai/Azure.AI.Projects.1DP/tests/Generated/Samples/Samples_Evaluations.cs create mode 100644 sdk/ai/Azure.AI.Projects.1DP/tests/Generated/Samples/Samples_Indexes.cs create mode 100644 sdk/ai/Azure.AI.Projects.1DP/tests/Generated/Samples/Samples_RedTeams.cs create mode 100644 sdk/ai/Azure.AI.Projects.1DP/tsp-location.yaml create mode 100644 sdk/ai/ci.yml create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MachineCollection.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MachineResource.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MachineCollection.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/{OSOptionProfileData.Serialization.cs => MachineData.Serialization.cs} (64%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/{OSOptionProfileData.cs => MachineData.cs} (57%) create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MachineResource.Serialization.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/{OSOptionProfileResource.cs => MachineResource.cs} (51%) create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworking.Serialization.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworking.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworkingObservability.Serialization.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworkingObservability.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworkingSecurity.Serialization.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworkingSecurity.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolDeleteMachinesParameter.Serialization.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ContainerServiceOSOptionProperty.cs => AgentPoolDeleteMachinesParameter.cs} (55%) create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolSecurityProfile.Serialization.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolSecurityProfile.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolWindowsProfile.Serialization.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolWindowsProfile.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ArtifactSource.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GpuDriver.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GpuProfile.Serialization.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GpuProfile.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ContainerServiceOSOptionProperty.Serialization.cs => MachineIPAddress.Serialization.cs} (58%) create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineIPAddress.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineListResult.Serialization.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineListResult.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineNetworkProperties.Serialization.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineNetworkProperties.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineProperties.Serialization.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineProperties.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterBootstrapProfile.Serialization.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterBootstrapProfile.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCostAnalysis.Serialization.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCostAnalysis.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfile.Serialization.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfile.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfileWebAppRouting.Serialization.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfileWebAppRouting.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMetricsProfile.Serialization.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMetricsProfile.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeResourceGroupProfile.Serialization.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeResourceGroupProfile.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/RestrictionLevel.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileResource.Serialization.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/MachinesRestOperations.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/Azure.ResourceManager.DurableTask.sln create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/CHANGELOG.md create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/Directory.Build.props create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/README.md create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/api/Azure.ResourceManager.DurableTask.net8.0.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/api/Azure.ResourceManager.DurableTask.netstandard2.0.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/assets.json create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Azure.ResourceManager.DurableTask.Samples.csproj create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_SchedulerCollection.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_SchedulerResource.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_TaskHubCollection.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_TaskHubResource.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Azure.ResourceManager.DurableTask.csproj create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/ArmDurableTaskModelFactory.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Extensions/DurableTaskExtensions.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Extensions/MockableDurableTaskArmClient.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Extensions/MockableDurableTaskResourceGroupResource.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Extensions/MockableDurableTaskSubscriptionResource.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/Argument.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/ChangeTrackingDictionary.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/ChangeTrackingList.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/ModelSerializationExtensions.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/Optional.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/Utf8JsonRequestContent.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/LongRunningOperation/DurableTaskArmOperation.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/LongRunningOperation/DurableTaskArmOperationOfT.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/LongRunningOperation/SchedulerOperationSource.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/LongRunningOperation/TaskHubOperationSource.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/ProvisioningState.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/RedundancyState.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerListResult.Serialization.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerListResult.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerPatch.Serialization.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerPatch.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerProperties.Serialization.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerProperties.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerPropertiesUpdate.Serialization.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerPropertiesUpdate.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerSku.Serialization.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerSku.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerSkuUpdate.Serialization.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerSkuUpdate.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/TaskHubListResult.Serialization.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/TaskHubListResult.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/TaskHubProperties.Serialization.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/TaskHubProperties.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/ProviderConstants.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/RestOperations/SchedulersRestOperations.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/RestOperations/TaskHubsRestOperations.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerCollection.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerData.Serialization.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerData.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerResource.Serialization.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerResource.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubCollection.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubData.Serialization.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubData.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubResource.Serialization.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubResource.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Properties/AssemblyInfo.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/tests/Azure.ResourceManager.DurableTask.Tests.csproj create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/tests/DurableTaskManagementTestBase.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/tests/DurableTaskManagementTestEnvironment.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/tsp-location.yaml create mode 100644 sdk/durabletask/ci.mgmt.yml create mode 100644 sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/AssessmentValueRange.Serialization.cs create mode 100644 sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/AssessmentValueRange.cs create mode 100644 sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/GuidanceInference.Serialization.cs create mode 100644 sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/GuidanceInference.cs create mode 100644 sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/GuidanceOptions.Serialization.cs create mode 100644 sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/GuidanceOptions.cs create mode 100644 sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/GuidanceRankingType.cs create mode 100644 sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/PresentGuidanceInformation.Serialization.cs create mode 100644 sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/PresentGuidanceInformation.cs create mode 100644 sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureComplianceType.cs create mode 100644 sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureInference.Serialization.cs create mode 100644 sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureInference.cs create mode 100644 sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureOptions.Serialization.cs create mode 100644 sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureOptions.cs create mode 100644 sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureType.cs create mode 100644 sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/ScoringAndAssessmentCategoryType.cs create mode 100644 sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/ScoringAndAssessmentInference.Serialization.cs create mode 100644 sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/ScoringAndAssessmentInference.cs create mode 100644 sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/Configuration.json delete mode 100644 sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/autorest.md create mode 100644 sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/tsp-location.yaml create mode 100644 sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/tspCodeModel.json create mode 100644 sdk/liftrarize/Azure.ResourceManager.ArizeAIObservabilityEval/tsp-location.yaml create mode 100644 sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/tsp-location.yaml create mode 100644 sdk/pineconevectordb/Azure.ResourceManager.PineconeVectorDb/tsp-location.yaml diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/tsp-location.yaml b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/tsp-location.yaml index d42f5de7a940..87ad07abe5a3 100644 --- a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/tsp-location.yaml +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/tsp-location.yaml @@ -1,3 +1,4 @@ -directory: specification/agricultureplatform -commit: eeb0e92b55f6c56827df9e7d57f5e08bc633e077 -repo: Azure/azure-rest-api-specs \ No newline at end of file +directory: specification/agricultureplatform/AgriculturePlatform.Management +commit: 54b1384a56710dd114569774b5f90a6b5778bd31 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/ai/Azure.AI.Assistants/Azure.AI.Assistants.sln b/sdk/ai/Azure.AI.Assistants/Azure.AI.Assistants.sln new file mode 100644 index 000000000000..7e61ec7e9b4e --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/Azure.AI.Assistants.sln @@ -0,0 +1,56 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29709.97 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.TestFramework", "..\..\core\Azure.Core.TestFramework\src\Azure.Core.TestFramework.csproj", "{ECC730C1-4AEA-420C-916A-66B19B79E4DC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.AI.Assistants", "src\Azure.AI.Assistants.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.AI.Assistants.Tests", "tests\Azure.AI.Assistants.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Release|Any CPU.Build.0 = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE} + EndGlobalSection +EndGlobal diff --git a/sdk/ai/Azure.AI.Assistants/CHANGELOG.md b/sdk/ai/Azure.AI.Assistants/CHANGELOG.md new file mode 100644 index 000000000000..8b33f0fedccc --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes \ No newline at end of file diff --git a/sdk/ai/Azure.AI.Assistants/Directory.Build.props b/sdk/ai/Azure.AI.Assistants/Directory.Build.props new file mode 100644 index 000000000000..63bd836ad44b --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/ai/Azure.AI.Assistants/README.md b/sdk/ai/Azure.AI.Assistants/README.md new file mode 100644 index 000000000000..a6e83f175c1a --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/README.md @@ -0,0 +1,107 @@ +# Azure.AI.Assistants client library for .NET + +Azure.AI.Assistants is a managed service that helps developers get secret simply and securely. + +Use the client library for to: + +* [Get secret](https://docs.microsoft.com/azure) + +[Source code][source_root] | [Package (NuGet)][package] | [API reference documentation][reference_docs] | [Product documentation][azconfig_docs] | [Samples][source_samples] + + [Source code](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/ai/Azure.AI.Assistants/src) | [Package (NuGet)](https://www.nuget.org/packages) | [API reference documentation](https://azure.github.io/azure-sdk-for-net) | [Product documentation](https://docs.microsoft.com/azure) + +## Getting started + +This section should include everything a developer needs to do to install and create their first client connection *very quickly*. + +### Install the package + +First, provide instruction for obtaining and installing the package or library. This section might include only a single line of code, like `dotnet add package package-name`, but should enable a developer to successfully install the package from NuGet, npm, or even cloning a GitHub repository. + +Install the client library for .NET with [NuGet](https://www.nuget.org/ ): + +```dotnetcli +dotnet add package Azure.AI.Assistants --prerelease +``` + +### Prerequisites + +Include a section after the install command that details any requirements that must be satisfied before a developer can [authenticate](#authenticate-the-client) and test all of the snippets in the [Examples](#examples) section. For example, for Cosmos DB: + +> You must have an [Azure subscription](https://azure.microsoft.com/free/dotnet/) and [Cosmos DB account](https://docs.microsoft.com/azure/cosmos-db/account-overview) (SQL API). In order to take advantage of the C# 8.0 syntax, it is recommended that you compile using the [.NET Core SDK](https://dotnet.microsoft.com/download) 3.0 or higher with a [language version](https://docs.microsoft.com/dotnet/csharp/language-reference/configure-language-version#override-a-default) of `latest`. It is also possible to compile with the .NET Core SDK 2.1.x using a language version of `preview`. + +### Authenticate the client + +If your library requires authentication for use, such as for Azure services, include instructions and example code needed for initializing and authenticating. + +For example, include details on obtaining an account key and endpoint URI, setting environment variables for each, and initializing the client object. + +### Service API versions + +The client library targets the latest service API version by default. A client instance accepts an optional service API version parameter from its options to specify which API version service to communicate. + +#### Select a service API version + +You have the flexibility to explicitly select a supported service API version when instantiating a client by configuring its associated options. This ensures that the client can communicate with services using the specified API version. + +For example, + +```C# Snippet:CreateClientForSpecificApiVersion +Uri endpoint = new Uri(""); +DefaultAzureCredential credential = new DefaultAzureCredential(); +ClientOptions options = new ClientOptions(ClientOptions.ServiceVersion.) +var client = new Client(endpoint, credential, options); +``` + +When selecting an API version, it's 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. + +## Key concepts + +The *Key concepts* section should describe the functionality of the main classes. Point out the most important and useful classes in the package (with links to their reference pages) and explain how those classes work together. Feel free to use bulleted lists, tables, code blocks, or even diagrams for clarity. + +Include the *Thread safety* and *Additional concepts* sections below at the end of your *Key concepts* section. You may remove or add links depending on what your library makes use of: + +### Thread safety + +We guarantee that all client instance methods are thread-safe and independent of each other ([guideline](https://azure.github.io/azure-sdk/dotnet_introduction.html#dotnet-service-methods-thread-safety)). This ensures that the recommendation of reusing client instances is always safe, even across threads. + +### Additional concepts + +[Client options](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#configuring-service-clients-using-clientoptions) | +[Accessing the response](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#accessing-http-response-details-using-responset) | +[Long-running operations](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#consuming-long-running-operations-using-operationt) | +[Handling failures](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#reporting-errors-requestfailedexception) | +[Diagnostics](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/samples/Diagnostics.md) | +[Mocking](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#mocking) | +[Client lifetime](https://devblogs.microsoft.com/azure-sdk/lifetime-management-and-thread-safety-guarantees-of-azure-sdk-net-clients/) + + +## Examples + +You can familiarize yourself with different APIs using [Samples](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/ai/Azure.AI.Assistants/samples). + +## Troubleshooting + +Describe common errors and exceptions, how to "unpack" them if necessary, and include guidance for graceful handling and recovery. + +Provide information to help developers avoid throttling or other service-enforced errors they might encounter. For example, provide guidance and examples for using retry or connection policies in the API. + +If the package or a related package supports it, include tips for logging or enabling instrumentation to help them debug their code. + +## Next steps + +* Provide a link to additional code examples, ideally to those sitting alongside the README in the package's `/samples` directory. +* If appropriate, point users to other packages that might be useful. +* If you think there's a good chance that developers might stumble across your package in error (because they're searching for specific functionality and mistakenly think the package provides that functionality), point them to the packages they might be looking for. + +## Contributing + +This is a template, but your SDK readme should include details on how to contribute code to the repo/package. + + +[style-guide-msft]: https://docs.microsoft.com/style-guide/capitalization +[style-guide-cloud]: https://aka.ms/azsdk/cloud-style-guide + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-net/sdk/ai/Azure.AI.Assistants/README.png) \ No newline at end of file diff --git a/sdk/ai/Azure.AI.Assistants/src/Azure.AI.Assistants.csproj b/sdk/ai/Azure.AI.Assistants/src/Azure.AI.Assistants.csproj new file mode 100644 index 000000000000..88d4fd53f671 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Azure.AI.Assistants.csproj @@ -0,0 +1,20 @@ + + + This is the Azure.AI.Assistants client library for developing .NET applications with rich experience. + Azure SDK Code Generation Azure.AI.Assistants for Azure Data Plane + 1.0.0-beta.1 + Azure.AI.Assistants + $(RequiredTargetFrameworks) + true + + + + + + + + + + + + diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/.Serialization.cs new file mode 100644 index 000000000000..a5fe11cd3d38 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/.Serialization.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => (System.ClientModel.Primitives.IJsonModel < Assistants.>this).Write(writer, global::Azure.AI.Assistants.ModelSerializationExtensions.WireOptions); + +void global::System.ClientModel.Primitives.IJsonModel.Write(global::System.Text.Json.Utf8JsonWriter writer,global::System.ClientModel.Primitives.ModelReaderWriterOptions options) +{ + writer.WriteStartObject(); + this.JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + +/// The JSON writer. +/// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? (System.ClientModel.Primitives.IPersistableModel < Assistants.>this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Assistants.)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + Assistants.global::System.ClientModel.Primitives.IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) +{ +var format = options.Format == "W" ? (System.ClientModel.Primitives.IPersistableModel < Assistants.>this).GetFormatFromOptions(options) : options.Format; +if ((format != "J")) +{ +throw new FormatException($"The model {nameof(global::Azure.AI.Assistants.)} does not support reading '{format}' format."); +} + +using JsonDocument document = JsonDocument.ParseValue(ref reader); +return Azure.AI.Assistants..Deserialize(document.RootElement, options); +} + +internal static Azure.AI.Assistants.Deserialize(JsonElement element, System.ClientModel.Primitives.ModelReaderWriterOptions options = (ModelReaderWriterOptions)null) +{ + options ??= Azure.AI.Assistants.ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == global::System.Text.Json.JsonValueKind.Null) + { + return null; + } + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, global::System.BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Azure.AI.Assistants.(serializedAdditionalRawData); +} + +BinaryData System.ClientModel.Primitives.IPersistableModel.Write(ModelReaderWriterOptions options) +{ + var format = options.Format == "W" ? (System.ClientModel.Primitives.IPersistableModel < Azure.AI.Assistants.>this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(Azure.AI.Assistants.)} does not support writing '{options.Format}' format."); + } +} + +Azure.AI.Assistants.global::System.ClientModel.Primitives.IPersistableModel < Azure.AI.Assistants.>.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) +{ + var format = options.Format == "W" ? (System.ClientModel.Primitives.IPersistableModel < Azure.AI.Assistants.>this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, Azure.AI.Assistants.ModelSerializationExtensions.JsonDocumentOptions); + return Azure.AI.Assistants..Deserialize(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Azure.AI.Assistants.)} does not support reading '{options.Format}' format."); + } +} + +string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + +/// Deserializes the model from a raw response. +/// The response to deserialize the model from. +internal static Azure.AI.Assistants.FromResponse(Azure.Response response) +{ + using var document = JsonDocument.Parse(response.Content, Azure.AI.Assistants.ModelSerializationExtensions.JsonDocumentOptions); + return Azure.AI.Assistants..Deserialize(document.RootElement); +} + +/// Convert into a . +internal virtual RequestContent ToRequestContent() +{ + var content = new Azure.AI.Assistants.Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue < Azure.AI.Assistants.> (this, Azure.AI.Assistants.ModelSerializationExtensions.WireOptions); + return content; +} +} +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/.cs new file mode 100644 index 000000000000..aacdc88de09b --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal () +{ +} + +/// Initializes a new instance of . +/// Keeps track of any properties unknown to the library. +internal (IDictionary serializedAdditionalRawData) +{ + _serializedAdditionalRawData = serializedAdditionalRawData; +} +} +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AIAssistantClient.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AIAssistantClient.cs new file mode 100644 index 000000000000..1adae5ec84a4 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AIAssistantClient.cs @@ -0,0 +1,6005 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.Assistants +{ + // Data plane generated client. + /// The AIAssistant service client. + public partial class AIAssistantClient + { + private const string AuthorizationHeader = "Authorization"; + private readonly AzureKeyCredential _keyCredential; + private const string AuthorizationApiKeyPrefix = "Bearer"; + private static readonly string[] AuthorizationScopes = new string[] { "https://cognitiveservices.azure.com/.default" }; + private readonly TokenCredential _tokenCredential; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline => _pipeline; + + /// Initializes a new instance of AIAssistantClient for mocking. + protected AIAssistantClient() + { + } + + /// Initializes a new instance of AIAssistantClient. + /// Project endpoint in the form of: https://<aiservices-id>.services.ai.azure.com/api/projects/<project-name>. + /// A credential used to authenticate to an Azure Service. + /// or is null. + public AIAssistantClient(Uri endpoint, AzureKeyCredential credential) : this(endpoint, credential, new AIAssistantClientOptions()) + { + } + + /// Initializes a new instance of AIAssistantClient. + /// Project endpoint in the form of: https://<aiservices-id>.services.ai.azure.com/api/projects/<project-name>. + /// A credential used to authenticate to an Azure Service. + /// or is null. + public AIAssistantClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new AIAssistantClientOptions()) + { + } + + /// Initializes a new instance of AIAssistantClient. + /// Project endpoint in the form of: https://<aiservices-id>.services.ai.azure.com/api/projects/<project-name>. + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + /// or is null. + public AIAssistantClient(Uri endpoint, AzureKeyCredential credential, AIAssistantClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNull(credential, nameof(credential)); + options ??= new AIAssistantClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _keyCredential = credential; + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new AzureKeyCredentialPolicy(_keyCredential, AuthorizationHeader, AuthorizationApiKeyPrefix) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; + } + + /// Initializes a new instance of AIAssistantClient. + /// Project endpoint in the form of: https://<aiservices-id>.services.ai.azure.com/api/projects/<project-name>. + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + /// or is null. + public AIAssistantClient(Uri endpoint, TokenCredential credential, AIAssistantClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNull(credential, nameof(credential)); + options ??= new AIAssistantClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _tokenCredential = credential; + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; + } + + /// Creates a new agent. + /// The ID of the model to use. + /// The name of the new agent. + /// The description of the new agent. + /// The system instructions for the new agent to use. + /// The collection of tools to enable for the new agent. + /// + /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, the `code_interpreter` + /// tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. + /// + /// + /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, + /// while lower values like 0.2 will make it more focused and deterministic. + /// + /// + /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. + /// So 0.1 means only the tokens comprising the top 10% probability mass are considered. + /// + /// We generally recommend altering this or temperature but not both. + /// + /// The response format of the tool calls used by this agent. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// The cancellation token to use. + /// is null. + /// + public virtual async Task> CreateAgentAsync(string model, string name = null, string description = null, string instructions = null, IEnumerable tools = null, ToolResources toolResources = null, float? temperature = null, float? topP = null, BinaryData responseFormat = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(model, nameof(model)); + + CreateAgentRequest createAgentRequest = new CreateAgentRequest( + model, + name, + description, + instructions, + tools?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), + toolResources, + temperature, + topP, + responseFormat, + metadata ?? new ChangeTrackingDictionary(), + null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await CreateAgentAsync(createAgentRequest.ToRequestContent(), context).ConfigureAwait(false); + return Response.FromValue(Agent.FromResponse(response), response); + } + + /// Creates a new agent. + /// The ID of the model to use. + /// The name of the new agent. + /// The description of the new agent. + /// The system instructions for the new agent to use. + /// The collection of tools to enable for the new agent. + /// + /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, the `code_interpreter` + /// tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. + /// + /// + /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, + /// while lower values like 0.2 will make it more focused and deterministic. + /// + /// + /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. + /// So 0.1 means only the tokens comprising the top 10% probability mass are considered. + /// + /// We generally recommend altering this or temperature but not both. + /// + /// The response format of the tool calls used by this agent. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// The cancellation token to use. + /// is null. + /// + public virtual Response CreateAgent(string model, string name = null, string description = null, string instructions = null, IEnumerable tools = null, ToolResources toolResources = null, float? temperature = null, float? topP = null, BinaryData responseFormat = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(model, nameof(model)); + + CreateAgentRequest createAgentRequest = new CreateAgentRequest( + model, + name, + description, + instructions, + tools?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), + toolResources, + temperature, + topP, + responseFormat, + metadata ?? new ChangeTrackingDictionary(), + null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = CreateAgent(createAgentRequest.ToRequestContent(), context); + return Response.FromValue(Agent.FromResponse(response), response); + } + + /// + /// [Protocol Method] Creates a new agent. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task CreateAgentAsync(RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.CreateAgent"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateAgentRequest(content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Creates a new agent. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response CreateAgent(RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.CreateAgent"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateAgentRequest(content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a list of agents that were previously created. + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + /// The cancellation token to use. + internal virtual async Task> InternalGetAgentsAsync(int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default) + { + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await InternalGetAgentsAsync(limit, order?.ToString(), after, before, context).ConfigureAwait(false); + return Response.FromValue(OpenAIPageableListOfAgent.FromResponse(response), response); + } + + /// Gets a list of agents that were previously created. + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + /// The cancellation token to use. + internal virtual Response InternalGetAgents(int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default) + { + RequestContext context = FromCancellationToken(cancellationToken); + Response response = InternalGetAgents(limit, order?.ToString(), after, before, context); + return Response.FromValue(OpenAIPageableListOfAgent.FromResponse(response), response); + } + + /// + /// [Protocol Method] Gets a list of agents that were previously created. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Allowed values: "asc" | "desc". + /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + internal virtual async Task InternalGetAgentsAsync(int? limit, string order, string after, string before, RequestContext context) + { + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.InternalGetAgents"); + scope.Start(); + try + { + using HttpMessage message = CreateInternalGetAgentsRequest(limit, order, after, before, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Gets a list of agents that were previously created. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Allowed values: "asc" | "desc". + /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + internal virtual Response InternalGetAgents(int? limit, string order, string after, string before, RequestContext context) + { + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.InternalGetAgents"); + scope.Start(); + try + { + using HttpMessage message = CreateInternalGetAgentsRequest(limit, order, after, before, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieves an existing agent. + /// Identifier of the agent. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetAgentAsync(string assistantId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetAgentAsync(assistantId, context).ConfigureAwait(false); + return Response.FromValue(Agent.FromResponse(response), response); + } + + /// Retrieves an existing agent. + /// Identifier of the agent. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetAgent(string assistantId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetAgent(assistantId, context); + return Response.FromValue(Agent.FromResponse(response), response); + } + + /// + /// [Protocol Method] Retrieves an existing agent. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the agent. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetAgentAsync(string assistantId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.GetAgent"); + scope.Start(); + try + { + using HttpMessage message = CreateGetAgentRequest(assistantId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Retrieves an existing agent. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the agent. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetAgent(string assistantId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.GetAgent"); + scope.Start(); + try + { + using HttpMessage message = CreateGetAgentRequest(assistantId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Modifies an existing agent. + /// The ID of the agent to modify. + /// The ID of the model to use. + /// The modified name for the agent to use. + /// The modified description for the agent to use. + /// The modified system instructions for the new agent to use. + /// The modified collection of tools to enable for the agent. + /// + /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, + /// the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. + /// + /// + /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, + /// while lower values like 0.2 will make it more focused and deterministic. + /// + /// + /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. + /// So 0.1 means only the tokens comprising the top 10% probability mass are considered. + /// + /// We generally recommend altering this or temperature but not both. + /// + /// The response format of the tool calls used by this agent. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> UpdateAgentAsync(string assistantId, string model = null, string name = null, string description = null, string instructions = null, IEnumerable tools = null, ToolResources toolResources = null, float? temperature = null, float? topP = null, BinaryData responseFormat = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId)); + + UpdateAgentRequest updateAgentRequest = new UpdateAgentRequest( + model, + name, + description, + instructions, + tools?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), + toolResources, + temperature, + topP, + responseFormat, + metadata ?? new ChangeTrackingDictionary(), + null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await UpdateAgentAsync(assistantId, updateAgentRequest.ToRequestContent(), context).ConfigureAwait(false); + return Response.FromValue(Agent.FromResponse(response), response); + } + + /// Modifies an existing agent. + /// The ID of the agent to modify. + /// The ID of the model to use. + /// The modified name for the agent to use. + /// The modified description for the agent to use. + /// The modified system instructions for the new agent to use. + /// The modified collection of tools to enable for the agent. + /// + /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, + /// the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. + /// + /// + /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, + /// while lower values like 0.2 will make it more focused and deterministic. + /// + /// + /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. + /// So 0.1 means only the tokens comprising the top 10% probability mass are considered. + /// + /// We generally recommend altering this or temperature but not both. + /// + /// The response format of the tool calls used by this agent. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response UpdateAgent(string assistantId, string model = null, string name = null, string description = null, string instructions = null, IEnumerable tools = null, ToolResources toolResources = null, float? temperature = null, float? topP = null, BinaryData responseFormat = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId)); + + UpdateAgentRequest updateAgentRequest = new UpdateAgentRequest( + model, + name, + description, + instructions, + tools?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), + toolResources, + temperature, + topP, + responseFormat, + metadata ?? new ChangeTrackingDictionary(), + null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = UpdateAgent(assistantId, updateAgentRequest.ToRequestContent(), context); + return Response.FromValue(Agent.FromResponse(response), response); + } + + /// + /// [Protocol Method] Modifies an existing agent. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The ID of the agent to modify. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task UpdateAgentAsync(string assistantId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.UpdateAgent"); + scope.Start(); + try + { + using HttpMessage message = CreateUpdateAgentRequest(assistantId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Modifies an existing agent. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The ID of the agent to modify. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response UpdateAgent(string assistantId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.UpdateAgent"); + scope.Start(); + try + { + using HttpMessage message = CreateUpdateAgentRequest(assistantId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an agent. + /// Identifier of the agent. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + internal virtual async Task> InternalDeleteAgentAsync(string assistantId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await InternalDeleteAgentAsync(assistantId, context).ConfigureAwait(false); + return Response.FromValue(InternalAgentDeletionStatus.FromResponse(response), response); + } + + /// Deletes an agent. + /// Identifier of the agent. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + internal virtual Response InternalDeleteAgent(string assistantId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = InternalDeleteAgent(assistantId, context); + return Response.FromValue(InternalAgentDeletionStatus.FromResponse(response), response); + } + + /// + /// [Protocol Method] Deletes an agent. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the agent. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + internal virtual async Task InternalDeleteAgentAsync(string assistantId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.InternalDeleteAgent"); + scope.Start(); + try + { + using HttpMessage message = CreateInternalDeleteAgentRequest(assistantId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Deletes an agent. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the agent. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + internal virtual Response InternalDeleteAgent(string assistantId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.InternalDeleteAgent"); + scope.Start(); + try + { + using HttpMessage message = CreateInternalDeleteAgentRequest(assistantId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates a new thread. Threads contain messages and can be run by agents. + /// The initial messages to associate with the new thread. + /// + /// A set of resources that are made available to the agent's tools in this thread. The resources are specific to the + /// type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires + /// a list of vector store IDs. + /// + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// The cancellation token to use. + /// + public virtual async Task> CreateThreadAsync(IEnumerable messages = null, ToolResources toolResources = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) + { + CreateThreadRequest createThreadRequest = new CreateThreadRequest(messages?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), toolResources, metadata ?? new ChangeTrackingDictionary(), null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await CreateThreadAsync(createThreadRequest.ToRequestContent(), context).ConfigureAwait(false); + return Response.FromValue(AgentThread.FromResponse(response), response); + } + + /// Creates a new thread. Threads contain messages and can be run by agents. + /// The initial messages to associate with the new thread. + /// + /// A set of resources that are made available to the agent's tools in this thread. The resources are specific to the + /// type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires + /// a list of vector store IDs. + /// + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// The cancellation token to use. + /// + public virtual Response CreateThread(IEnumerable messages = null, ToolResources toolResources = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) + { + CreateThreadRequest createThreadRequest = new CreateThreadRequest(messages?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), toolResources, metadata ?? new ChangeTrackingDictionary(), null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = CreateThread(createThreadRequest.ToRequestContent(), context); + return Response.FromValue(AgentThread.FromResponse(response), response); + } + + /// + /// [Protocol Method] Creates a new thread. Threads contain messages and can be run by agents. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task CreateThreadAsync(RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.CreateThread"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateThreadRequest(content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Creates a new thread. Threads contain messages and can be run by agents. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response CreateThread(RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.CreateThread"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateThreadRequest(content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets information about an existing thread. + /// Identifier of the thread. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetThreadAsync(string threadId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetThreadAsync(threadId, context).ConfigureAwait(false); + return Response.FromValue(AgentThread.FromResponse(response), response); + } + + /// Gets information about an existing thread. + /// Identifier of the thread. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetThread(string threadId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetThread(threadId, context); + return Response.FromValue(AgentThread.FromResponse(response), response); + } + + /// + /// [Protocol Method] Gets information about an existing thread. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the thread. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetThreadAsync(string threadId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.GetThread"); + scope.Start(); + try + { + using HttpMessage message = CreateGetThreadRequest(threadId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Gets information about an existing thread. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the thread. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetThread(string threadId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.GetThread"); + scope.Start(); + try + { + using HttpMessage message = CreateGetThreadRequest(threadId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Modifies an existing thread. + /// The ID of the thread to modify. + /// + /// A set of resources that are made available to the agent's tools in this thread. The resources are specific to the + /// type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires + /// a list of vector store IDs + /// + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> UpdateThreadAsync(string threadId, ToolResources toolResources = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + + UpdateThreadRequest updateThreadRequest = new UpdateThreadRequest(toolResources, metadata ?? new ChangeTrackingDictionary(), null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await UpdateThreadAsync(threadId, updateThreadRequest.ToRequestContent(), context).ConfigureAwait(false); + return Response.FromValue(AgentThread.FromResponse(response), response); + } + + /// Modifies an existing thread. + /// The ID of the thread to modify. + /// + /// A set of resources that are made available to the agent's tools in this thread. The resources are specific to the + /// type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires + /// a list of vector store IDs + /// + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response UpdateThread(string threadId, ToolResources toolResources = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + + UpdateThreadRequest updateThreadRequest = new UpdateThreadRequest(toolResources, metadata ?? new ChangeTrackingDictionary(), null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = UpdateThread(threadId, updateThreadRequest.ToRequestContent(), context); + return Response.FromValue(AgentThread.FromResponse(response), response); + } + + /// + /// [Protocol Method] Modifies an existing thread. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The ID of the thread to modify. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task UpdateThreadAsync(string threadId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.UpdateThread"); + scope.Start(); + try + { + using HttpMessage message = CreateUpdateThreadRequest(threadId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Modifies an existing thread. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The ID of the thread to modify. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response UpdateThread(string threadId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.UpdateThread"); + scope.Start(); + try + { + using HttpMessage message = CreateUpdateThreadRequest(threadId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing thread. + /// Identifier of the thread. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + internal virtual async Task> InternalDeleteThreadAsync(string threadId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await InternalDeleteThreadAsync(threadId, context).ConfigureAwait(false); + return Response.FromValue(ThreadDeletionStatus.FromResponse(response), response); + } + + /// Deletes an existing thread. + /// Identifier of the thread. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + internal virtual Response InternalDeleteThread(string threadId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = InternalDeleteThread(threadId, context); + return Response.FromValue(ThreadDeletionStatus.FromResponse(response), response); + } + + /// + /// [Protocol Method] Deletes an existing thread. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the thread. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + internal virtual async Task InternalDeleteThreadAsync(string threadId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.InternalDeleteThread"); + scope.Start(); + try + { + using HttpMessage message = CreateInternalDeleteThreadRequest(threadId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Deletes an existing thread. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the thread. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + internal virtual Response InternalDeleteThread(string threadId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.InternalDeleteThread"); + scope.Start(); + try + { + using HttpMessage message = CreateInternalDeleteThreadRequest(threadId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates a new message on a specified thread. + /// Identifier of the thread. + /// + /// The role of the entity that is creating the message. Allowed values include: + /// - `user`: Indicates the message is sent by an actual user and should be used in most + /// cases to represent user-generated messages. + /// - `assistant`: Indicates the message is generated by the agent. Use this value to insert + /// messages from the agent into the + /// conversation. + /// + /// + /// The textual content of the initial message. Currently, robust input including images and annotated text may only be provided via + /// a separate call to the create message API. + /// + /// A list of files attached to the message, and the tools they should be added to. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> CreateMessageAsync(string threadId, MessageRole role, string content, IEnumerable attachments = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNull(content, nameof(content)); + + CreateMessageRequest createMessageRequest = new CreateMessageRequest(role, content, attachments?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), metadata ?? new ChangeTrackingDictionary(), null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await CreateMessageAsync(threadId, createMessageRequest.ToRequestContent(), context).ConfigureAwait(false); + return Response.FromValue(ThreadMessage.FromResponse(response), response); + } + + /// Creates a new message on a specified thread. + /// Identifier of the thread. + /// + /// The role of the entity that is creating the message. Allowed values include: + /// - `user`: Indicates the message is sent by an actual user and should be used in most + /// cases to represent user-generated messages. + /// - `assistant`: Indicates the message is generated by the agent. Use this value to insert + /// messages from the agent into the + /// conversation. + /// + /// + /// The textual content of the initial message. Currently, robust input including images and annotated text may only be provided via + /// a separate call to the create message API. + /// + /// A list of files attached to the message, and the tools they should be added to. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response CreateMessage(string threadId, MessageRole role, string content, IEnumerable attachments = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNull(content, nameof(content)); + + CreateMessageRequest createMessageRequest = new CreateMessageRequest(role, content, attachments?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), metadata ?? new ChangeTrackingDictionary(), null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = CreateMessage(threadId, createMessageRequest.ToRequestContent(), context); + return Response.FromValue(ThreadMessage.FromResponse(response), response); + } + + /// + /// [Protocol Method] Creates a new message on a specified thread. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the thread. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task CreateMessageAsync(string threadId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.CreateMessage"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateMessageRequest(threadId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Creates a new message on a specified thread. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the thread. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response CreateMessage(string threadId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.CreateMessage"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateMessageRequest(threadId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a list of messages that exist on a thread. + /// Identifier of the thread. + /// Filter messages by the run ID that generated them. + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + internal virtual async Task> InternalGetMessagesAsync(string threadId, string runId = null, int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await InternalGetMessagesAsync(threadId, runId, limit, order?.ToString(), after, before, context).ConfigureAwait(false); + return Response.FromValue(OpenAIPageableListOfThreadMessage.FromResponse(response), response); + } + + /// Gets a list of messages that exist on a thread. + /// Identifier of the thread. + /// Filter messages by the run ID that generated them. + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + internal virtual Response InternalGetMessages(string threadId, string runId = null, int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = InternalGetMessages(threadId, runId, limit, order?.ToString(), after, before, context); + return Response.FromValue(OpenAIPageableListOfThreadMessage.FromResponse(response), response); + } + + /// + /// [Protocol Method] Gets a list of messages that exist on a thread. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the thread. + /// Filter messages by the run ID that generated them. + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Allowed values: "asc" | "desc". + /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + internal virtual async Task InternalGetMessagesAsync(string threadId, string runId, int? limit, string order, string after, string before, RequestContext context) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.InternalGetMessages"); + scope.Start(); + try + { + using HttpMessage message = CreateInternalGetMessagesRequest(threadId, runId, limit, order, after, before, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Gets a list of messages that exist on a thread. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the thread. + /// Filter messages by the run ID that generated them. + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Allowed values: "asc" | "desc". + /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + internal virtual Response InternalGetMessages(string threadId, string runId, int? limit, string order, string after, string before, RequestContext context) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.InternalGetMessages"); + scope.Start(); + try + { + using HttpMessage message = CreateInternalGetMessagesRequest(threadId, runId, limit, order, after, before, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets an existing message from an existing thread. + /// Identifier of the thread. + /// Identifier of the message. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetMessageAsync(string threadId, string messageId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNullOrEmpty(messageId, nameof(messageId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetMessageAsync(threadId, messageId, context).ConfigureAwait(false); + return Response.FromValue(ThreadMessage.FromResponse(response), response); + } + + /// Gets an existing message from an existing thread. + /// Identifier of the thread. + /// Identifier of the message. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual Response GetMessage(string threadId, string messageId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNullOrEmpty(messageId, nameof(messageId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetMessage(threadId, messageId, context); + return Response.FromValue(ThreadMessage.FromResponse(response), response); + } + + /// + /// [Protocol Method] Gets an existing message from an existing thread. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the thread. + /// Identifier of the message. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetMessageAsync(string threadId, string messageId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNullOrEmpty(messageId, nameof(messageId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.GetMessage"); + scope.Start(); + try + { + using HttpMessage message = CreateGetMessageRequest(threadId, messageId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Gets an existing message from an existing thread. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the thread. + /// Identifier of the message. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetMessage(string threadId, string messageId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNullOrEmpty(messageId, nameof(messageId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.GetMessage"); + scope.Start(); + try + { + using HttpMessage message = CreateGetMessageRequest(threadId, messageId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Modifies an existing message on an existing thread. + /// Identifier of the thread. + /// Identifier of the message. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual async Task> UpdateMessageAsync(string threadId, string messageId, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNullOrEmpty(messageId, nameof(messageId)); + + UpdateMessageRequest updateMessageRequest = new UpdateMessageRequest(metadata ?? new ChangeTrackingDictionary(), null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await UpdateMessageAsync(threadId, messageId, updateMessageRequest.ToRequestContent(), context).ConfigureAwait(false); + return Response.FromValue(ThreadMessage.FromResponse(response), response); + } + + /// Modifies an existing message on an existing thread. + /// Identifier of the thread. + /// Identifier of the message. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual Response UpdateMessage(string threadId, string messageId, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNullOrEmpty(messageId, nameof(messageId)); + + UpdateMessageRequest updateMessageRequest = new UpdateMessageRequest(metadata ?? new ChangeTrackingDictionary(), null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = UpdateMessage(threadId, messageId, updateMessageRequest.ToRequestContent(), context); + return Response.FromValue(ThreadMessage.FromResponse(response), response); + } + + /// + /// [Protocol Method] Modifies an existing message on an existing thread. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the thread. + /// Identifier of the message. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task UpdateMessageAsync(string threadId, string messageId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNullOrEmpty(messageId, nameof(messageId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.UpdateMessage"); + scope.Start(); + try + { + using HttpMessage message = CreateUpdateMessageRequest(threadId, messageId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Modifies an existing message on an existing thread. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the thread. + /// Identifier of the message. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response UpdateMessage(string threadId, string messageId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNullOrEmpty(messageId, nameof(messageId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.UpdateMessage"); + scope.Start(); + try + { + using HttpMessage message = CreateUpdateMessageRequest(threadId, messageId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates a new run for an agent thread. + /// Identifier of the thread. + /// The ID of the agent that should run the thread. + /// The overridden model name that the agent should use to run the thread. + /// The overridden system instructions that the agent should use to run the thread. + /// + /// Additional instructions to append at the end of the instructions for the run. This is useful for modifying the behavior + /// on a per-run basis without overriding other instructions. + /// + /// Adds additional messages to the thread before creating the run. + /// The overridden list of enabled tools that the agent should use to run the thread. + /// + /// If `true`, returns a stream of events that happen during the Run as server-sent events, + /// terminating when the Run enters a terminal state with a `data: [DONE]` message. + /// + /// + /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output + /// more random, while lower values like 0.2 will make it more focused and deterministic. + /// + /// + /// An alternative to sampling with temperature, called nucleus sampling, where the model + /// considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens + /// comprising the top 10% probability mass are considered. + /// + /// We generally recommend altering this or temperature but not both. + /// + /// + /// The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only + /// the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, + /// the run will end with status `incomplete`. See `incomplete_details` for more info. + /// + /// + /// The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort + /// to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of + /// completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info. + /// + /// The strategy to use for dropping messages as the context windows moves forward. + /// Controls whether or not and which tool is called by the model. + /// Specifies the format that the model must output. + /// If `true` functions will run in parallel during tool use. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// + /// A list of additional fields to include in the response. + /// Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. + /// + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> CreateRunAsync(string threadId, string assistantId, string overrideModelName = null, string overrideInstructions = null, string additionalInstructions = null, IEnumerable additionalMessages = null, IEnumerable overrideTools = null, bool? stream = null, float? temperature = null, float? topP = null, int? maxPromptTokens = null, int? maxCompletionTokens = null, TruncationObject truncationStrategy = null, BinaryData toolChoice = null, BinaryData responseFormat = null, bool? parallelToolCalls = null, IReadOnlyDictionary metadata = null, IEnumerable include = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNull(assistantId, nameof(assistantId)); + + CreateRunRequest createRunRequest = new CreateRunRequest( + assistantId, + overrideModelName, + overrideInstructions, + additionalInstructions, + additionalMessages?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), + overrideTools?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), + stream, + temperature, + topP, + maxPromptTokens, + maxCompletionTokens, + truncationStrategy, + toolChoice, + responseFormat, + parallelToolCalls, + metadata ?? new ChangeTrackingDictionary(), + null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await CreateRunAsync(threadId, createRunRequest.ToRequestContent(), include, context).ConfigureAwait(false); + return Response.FromValue(ThreadRun.FromResponse(response), response); + } + + /// Creates a new run for an agent thread. + /// Identifier of the thread. + /// The ID of the agent that should run the thread. + /// The overridden model name that the agent should use to run the thread. + /// The overridden system instructions that the agent should use to run the thread. + /// + /// Additional instructions to append at the end of the instructions for the run. This is useful for modifying the behavior + /// on a per-run basis without overriding other instructions. + /// + /// Adds additional messages to the thread before creating the run. + /// The overridden list of enabled tools that the agent should use to run the thread. + /// + /// If `true`, returns a stream of events that happen during the Run as server-sent events, + /// terminating when the Run enters a terminal state with a `data: [DONE]` message. + /// + /// + /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output + /// more random, while lower values like 0.2 will make it more focused and deterministic. + /// + /// + /// An alternative to sampling with temperature, called nucleus sampling, where the model + /// considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens + /// comprising the top 10% probability mass are considered. + /// + /// We generally recommend altering this or temperature but not both. + /// + /// + /// The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only + /// the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, + /// the run will end with status `incomplete`. See `incomplete_details` for more info. + /// + /// + /// The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort + /// to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of + /// completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info. + /// + /// The strategy to use for dropping messages as the context windows moves forward. + /// Controls whether or not and which tool is called by the model. + /// Specifies the format that the model must output. + /// If `true` functions will run in parallel during tool use. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// + /// A list of additional fields to include in the response. + /// Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. + /// + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response CreateRun(string threadId, string assistantId, string overrideModelName = null, string overrideInstructions = null, string additionalInstructions = null, IEnumerable additionalMessages = null, IEnumerable overrideTools = null, bool? stream = null, float? temperature = null, float? topP = null, int? maxPromptTokens = null, int? maxCompletionTokens = null, TruncationObject truncationStrategy = null, BinaryData toolChoice = null, BinaryData responseFormat = null, bool? parallelToolCalls = null, IReadOnlyDictionary metadata = null, IEnumerable include = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNull(assistantId, nameof(assistantId)); + + CreateRunRequest createRunRequest = new CreateRunRequest( + assistantId, + overrideModelName, + overrideInstructions, + additionalInstructions, + additionalMessages?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), + overrideTools?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), + stream, + temperature, + topP, + maxPromptTokens, + maxCompletionTokens, + truncationStrategy, + toolChoice, + responseFormat, + parallelToolCalls, + metadata ?? new ChangeTrackingDictionary(), + null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = CreateRun(threadId, createRunRequest.ToRequestContent(), include, context); + return Response.FromValue(ThreadRun.FromResponse(response), response); + } + + /// + /// [Protocol Method] Creates a new run for an agent thread. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the thread. + /// The content to send as the body of the request. + /// + /// A list of additional fields to include in the response. + /// Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. + /// + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task CreateRunAsync(string threadId, RequestContent content, IEnumerable include = null, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.CreateRun"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateRunRequest(threadId, content, include, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Creates a new run for an agent thread. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the thread. + /// The content to send as the body of the request. + /// + /// A list of additional fields to include in the response. + /// Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. + /// + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response CreateRun(string threadId, RequestContent content, IEnumerable include = null, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.CreateRun"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateRunRequest(threadId, content, include, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a list of runs for a specified thread. + /// Identifier of the thread. + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + internal virtual async Task> InternalGetRunsAsync(string threadId, int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await InternalGetRunsAsync(threadId, limit, order?.ToString(), after, before, context).ConfigureAwait(false); + return Response.FromValue(OpenAIPageableListOfThreadRun.FromResponse(response), response); + } + + /// Gets a list of runs for a specified thread. + /// Identifier of the thread. + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + internal virtual Response InternalGetRuns(string threadId, int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = InternalGetRuns(threadId, limit, order?.ToString(), after, before, context); + return Response.FromValue(OpenAIPageableListOfThreadRun.FromResponse(response), response); + } + + /// + /// [Protocol Method] Gets a list of runs for a specified thread. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the thread. + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Allowed values: "asc" | "desc". + /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + internal virtual async Task InternalGetRunsAsync(string threadId, int? limit, string order, string after, string before, RequestContext context) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.InternalGetRuns"); + scope.Start(); + try + { + using HttpMessage message = CreateInternalGetRunsRequest(threadId, limit, order, after, before, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Gets a list of runs for a specified thread. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the thread. + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Allowed values: "asc" | "desc". + /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + internal virtual Response InternalGetRuns(string threadId, int? limit, string order, string after, string before, RequestContext context) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.InternalGetRuns"); + scope.Start(); + try + { + using HttpMessage message = CreateInternalGetRunsRequest(threadId, limit, order, after, before, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets an existing run from an existing thread. + /// Identifier of the thread. + /// Identifier of the run. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetRunAsync(string threadId, string runId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNullOrEmpty(runId, nameof(runId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetRunAsync(threadId, runId, context).ConfigureAwait(false); + return Response.FromValue(ThreadRun.FromResponse(response), response); + } + + /// Gets an existing run from an existing thread. + /// Identifier of the thread. + /// Identifier of the run. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual Response GetRun(string threadId, string runId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNullOrEmpty(runId, nameof(runId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetRun(threadId, runId, context); + return Response.FromValue(ThreadRun.FromResponse(response), response); + } + + /// + /// [Protocol Method] Gets an existing run from an existing thread. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the thread. + /// Identifier of the run. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetRunAsync(string threadId, string runId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNullOrEmpty(runId, nameof(runId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.GetRun"); + scope.Start(); + try + { + using HttpMessage message = CreateGetRunRequest(threadId, runId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Gets an existing run from an existing thread. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the thread. + /// Identifier of the run. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetRun(string threadId, string runId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNullOrEmpty(runId, nameof(runId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.GetRun"); + scope.Start(); + try + { + using HttpMessage message = CreateGetRunRequest(threadId, runId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Modifies an existing thread run. + /// Identifier of the thread. + /// Identifier of the run. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual async Task> UpdateRunAsync(string threadId, string runId, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNullOrEmpty(runId, nameof(runId)); + + UpdateRunRequest updateRunRequest = new UpdateRunRequest(metadata ?? new ChangeTrackingDictionary(), null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await UpdateRunAsync(threadId, runId, updateRunRequest.ToRequestContent(), context).ConfigureAwait(false); + return Response.FromValue(ThreadRun.FromResponse(response), response); + } + + /// Modifies an existing thread run. + /// Identifier of the thread. + /// Identifier of the run. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual Response UpdateRun(string threadId, string runId, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNullOrEmpty(runId, nameof(runId)); + + UpdateRunRequest updateRunRequest = new UpdateRunRequest(metadata ?? new ChangeTrackingDictionary(), null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = UpdateRun(threadId, runId, updateRunRequest.ToRequestContent(), context); + return Response.FromValue(ThreadRun.FromResponse(response), response); + } + + /// + /// [Protocol Method] Modifies an existing thread run. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the thread. + /// Identifier of the run. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task UpdateRunAsync(string threadId, string runId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNullOrEmpty(runId, nameof(runId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.UpdateRun"); + scope.Start(); + try + { + using HttpMessage message = CreateUpdateRunRequest(threadId, runId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Modifies an existing thread run. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the thread. + /// Identifier of the run. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response UpdateRun(string threadId, string runId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNullOrEmpty(runId, nameof(runId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.UpdateRun"); + scope.Start(); + try + { + using HttpMessage message = CreateUpdateRunRequest(threadId, runId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Submits outputs from tools as requested by tool calls in a run. Runs that need submitted tool outputs will have a status of 'requires_action' with a required_action.type of 'submit_tool_outputs'. + /// Identifier of the thread. + /// Identifier of the run. + /// A list of tools for which the outputs are being submitted. + /// If true, returns a stream of events that happen during the Run as server-sent events, terminating when the run enters a terminal state. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual async Task> SubmitToolOutputsToRunAsync(string threadId, string runId, IEnumerable toolOutputs, bool? stream = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNullOrEmpty(runId, nameof(runId)); + Argument.AssertNotNull(toolOutputs, nameof(toolOutputs)); + + SubmitToolOutputsToRunRequest submitToolOutputsToRunRequest = new SubmitToolOutputsToRunRequest(toolOutputs.ToList(), stream, null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await SubmitToolOutputsToRunAsync(threadId, runId, submitToolOutputsToRunRequest.ToRequestContent(), context).ConfigureAwait(false); + return Response.FromValue(ThreadRun.FromResponse(response), response); + } + + /// Submits outputs from tools as requested by tool calls in a run. Runs that need submitted tool outputs will have a status of 'requires_action' with a required_action.type of 'submit_tool_outputs'. + /// Identifier of the thread. + /// Identifier of the run. + /// A list of tools for which the outputs are being submitted. + /// If true, returns a stream of events that happen during the Run as server-sent events, terminating when the run enters a terminal state. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual Response SubmitToolOutputsToRun(string threadId, string runId, IEnumerable toolOutputs, bool? stream = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNullOrEmpty(runId, nameof(runId)); + Argument.AssertNotNull(toolOutputs, nameof(toolOutputs)); + + SubmitToolOutputsToRunRequest submitToolOutputsToRunRequest = new SubmitToolOutputsToRunRequest(toolOutputs.ToList(), stream, null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = SubmitToolOutputsToRun(threadId, runId, submitToolOutputsToRunRequest.ToRequestContent(), context); + return Response.FromValue(ThreadRun.FromResponse(response), response); + } + + /// + /// [Protocol Method] Submits outputs from tools as requested by tool calls in a run. Runs that need submitted tool outputs will have a status of 'requires_action' with a required_action.type of 'submit_tool_outputs'. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the thread. + /// Identifier of the run. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task SubmitToolOutputsToRunAsync(string threadId, string runId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNullOrEmpty(runId, nameof(runId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.SubmitToolOutputsToRun"); + scope.Start(); + try + { + using HttpMessage message = CreateSubmitToolOutputsToRunRequest(threadId, runId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Submits outputs from tools as requested by tool calls in a run. Runs that need submitted tool outputs will have a status of 'requires_action' with a required_action.type of 'submit_tool_outputs'. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the thread. + /// Identifier of the run. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response SubmitToolOutputsToRun(string threadId, string runId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNullOrEmpty(runId, nameof(runId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.SubmitToolOutputsToRun"); + scope.Start(); + try + { + using HttpMessage message = CreateSubmitToolOutputsToRunRequest(threadId, runId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Cancels a run of an in progress thread. + /// Identifier of the thread. + /// Identifier of the run. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual async Task> CancelRunAsync(string threadId, string runId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNullOrEmpty(runId, nameof(runId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await CancelRunAsync(threadId, runId, context).ConfigureAwait(false); + return Response.FromValue(ThreadRun.FromResponse(response), response); + } + + /// Cancels a run of an in progress thread. + /// Identifier of the thread. + /// Identifier of the run. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual Response CancelRun(string threadId, string runId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNullOrEmpty(runId, nameof(runId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = CancelRun(threadId, runId, context); + return Response.FromValue(ThreadRun.FromResponse(response), response); + } + + /// + /// [Protocol Method] Cancels a run of an in progress thread. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the thread. + /// Identifier of the run. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task CancelRunAsync(string threadId, string runId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNullOrEmpty(runId, nameof(runId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.CancelRun"); + scope.Start(); + try + { + using HttpMessage message = CreateCancelRunRequest(threadId, runId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Cancels a run of an in progress thread. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the thread. + /// Identifier of the run. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response CancelRun(string threadId, string runId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNullOrEmpty(runId, nameof(runId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.CancelRun"); + scope.Start(); + try + { + using HttpMessage message = CreateCancelRunRequest(threadId, runId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates a new agent thread and immediately starts a run using that new thread. + /// The ID of the agent for which the thread should be created. + /// The details used to create the new thread. If no thread is provided, an empty one will be created. + /// The overridden model that the agent should use to run the thread. + /// The overridden system instructions the agent should use to run the thread. + /// The overridden list of enabled tools the agent should use to run the thread. + /// Override the tools the agent can use for this run. This is useful for modifying the behavior on a per-run basis. + /// + /// If `true`, returns a stream of events that happen during the Run as server-sent events, + /// terminating when the Run enters a terminal state with a `data: [DONE]` message. + /// + /// + /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output + /// more random, while lower values like 0.2 will make it more focused and deterministic. + /// + /// + /// An alternative to sampling with temperature, called nucleus sampling, where the model + /// considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens + /// comprising the top 10% probability mass are considered. + /// + /// We generally recommend altering this or temperature but not both. + /// + /// + /// The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only + /// the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, + /// the run will end with status `incomplete`. See `incomplete_details` for more info. + /// + /// + /// The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only + /// the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens + /// specified, the run will end with status `incomplete`. See `incomplete_details` for more info. + /// + /// The strategy to use for dropping messages as the context windows moves forward. + /// Controls whether or not and which tool is called by the model. + /// Specifies the format that the model must output. + /// If `true` functions will run in parallel during tool use. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// The cancellation token to use. + /// is null. + /// + public virtual async Task> CreateThreadAndRunAsync(string assistantId, AgentThreadCreationOptions thread = null, string overrideModelName = null, string overrideInstructions = null, IEnumerable overrideTools = null, UpdateToolResourcesOptions toolResources = null, bool? stream = null, float? temperature = null, float? topP = null, int? maxPromptTokens = null, int? maxCompletionTokens = null, TruncationObject truncationStrategy = null, BinaryData toolChoice = null, BinaryData responseFormat = null, bool? parallelToolCalls = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(assistantId, nameof(assistantId)); + + CreateThreadAndRunRequest createThreadAndRunRequest = new CreateThreadAndRunRequest( + assistantId, + thread, + overrideModelName, + overrideInstructions, + overrideTools?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), + toolResources, + stream, + temperature, + topP, + maxPromptTokens, + maxCompletionTokens, + truncationStrategy, + toolChoice, + responseFormat, + parallelToolCalls, + metadata ?? new ChangeTrackingDictionary(), + null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await CreateThreadAndRunAsync(createThreadAndRunRequest.ToRequestContent(), context).ConfigureAwait(false); + return Response.FromValue(ThreadRun.FromResponse(response), response); + } + + /// Creates a new agent thread and immediately starts a run using that new thread. + /// The ID of the agent for which the thread should be created. + /// The details used to create the new thread. If no thread is provided, an empty one will be created. + /// The overridden model that the agent should use to run the thread. + /// The overridden system instructions the agent should use to run the thread. + /// The overridden list of enabled tools the agent should use to run the thread. + /// Override the tools the agent can use for this run. This is useful for modifying the behavior on a per-run basis. + /// + /// If `true`, returns a stream of events that happen during the Run as server-sent events, + /// terminating when the Run enters a terminal state with a `data: [DONE]` message. + /// + /// + /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output + /// more random, while lower values like 0.2 will make it more focused and deterministic. + /// + /// + /// An alternative to sampling with temperature, called nucleus sampling, where the model + /// considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens + /// comprising the top 10% probability mass are considered. + /// + /// We generally recommend altering this or temperature but not both. + /// + /// + /// The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only + /// the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, + /// the run will end with status `incomplete`. See `incomplete_details` for more info. + /// + /// + /// The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only + /// the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens + /// specified, the run will end with status `incomplete`. See `incomplete_details` for more info. + /// + /// The strategy to use for dropping messages as the context windows moves forward. + /// Controls whether or not and which tool is called by the model. + /// Specifies the format that the model must output. + /// If `true` functions will run in parallel during tool use. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// The cancellation token to use. + /// is null. + /// + public virtual Response CreateThreadAndRun(string assistantId, AgentThreadCreationOptions thread = null, string overrideModelName = null, string overrideInstructions = null, IEnumerable overrideTools = null, UpdateToolResourcesOptions toolResources = null, bool? stream = null, float? temperature = null, float? topP = null, int? maxPromptTokens = null, int? maxCompletionTokens = null, TruncationObject truncationStrategy = null, BinaryData toolChoice = null, BinaryData responseFormat = null, bool? parallelToolCalls = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(assistantId, nameof(assistantId)); + + CreateThreadAndRunRequest createThreadAndRunRequest = new CreateThreadAndRunRequest( + assistantId, + thread, + overrideModelName, + overrideInstructions, + overrideTools?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), + toolResources, + stream, + temperature, + topP, + maxPromptTokens, + maxCompletionTokens, + truncationStrategy, + toolChoice, + responseFormat, + parallelToolCalls, + metadata ?? new ChangeTrackingDictionary(), + null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = CreateThreadAndRun(createThreadAndRunRequest.ToRequestContent(), context); + return Response.FromValue(ThreadRun.FromResponse(response), response); + } + + /// + /// [Protocol Method] Creates a new agent thread and immediately starts a run using that new thread. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task CreateThreadAndRunAsync(RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.CreateThreadAndRun"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateThreadAndRunRequest(content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Creates a new agent thread and immediately starts a run using that new thread. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response CreateThreadAndRun(RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.CreateThreadAndRun"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateThreadAndRunRequest(content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a single run step from a thread run. + /// Identifier of the thread. + /// Identifier of the run. + /// Identifier of the run step. + /// + /// A list of additional fields to include in the response. + /// Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. + /// + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetRunStepAsync(string threadId, string runId, string stepId, IEnumerable include = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNullOrEmpty(runId, nameof(runId)); + Argument.AssertNotNullOrEmpty(stepId, nameof(stepId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetRunStepAsync(threadId, runId, stepId, include, context).ConfigureAwait(false); + return Response.FromValue(RunStep.FromResponse(response), response); + } + + /// Gets a single run step from a thread run. + /// Identifier of the thread. + /// Identifier of the run. + /// Identifier of the run step. + /// + /// A list of additional fields to include in the response. + /// Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. + /// + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + /// + public virtual Response GetRunStep(string threadId, string runId, string stepId, IEnumerable include = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNullOrEmpty(runId, nameof(runId)); + Argument.AssertNotNullOrEmpty(stepId, nameof(stepId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetRunStep(threadId, runId, stepId, include, context); + return Response.FromValue(RunStep.FromResponse(response), response); + } + + /// + /// [Protocol Method] Gets a single run step from a thread run. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the thread. + /// Identifier of the run. + /// Identifier of the run step. + /// + /// A list of additional fields to include in the response. + /// Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. + /// + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetRunStepAsync(string threadId, string runId, string stepId, IEnumerable include, RequestContext context) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNullOrEmpty(runId, nameof(runId)); + Argument.AssertNotNullOrEmpty(stepId, nameof(stepId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.GetRunStep"); + scope.Start(); + try + { + using HttpMessage message = CreateGetRunStepRequest(threadId, runId, stepId, include, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Gets a single run step from a thread run. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the thread. + /// Identifier of the run. + /// Identifier of the run step. + /// + /// A list of additional fields to include in the response. + /// Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. + /// + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetRunStep(string threadId, string runId, string stepId, IEnumerable include, RequestContext context) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNullOrEmpty(runId, nameof(runId)); + Argument.AssertNotNullOrEmpty(stepId, nameof(stepId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.GetRunStep"); + scope.Start(); + try + { + using HttpMessage message = CreateGetRunStepRequest(threadId, runId, stepId, include, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a list of run steps from a thread run. + /// Identifier of the thread. + /// Identifier of the run. + /// + /// A list of additional fields to include in the response. + /// Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. + /// + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + internal virtual async Task> InternalGetRunStepsAsync(string threadId, string runId, IEnumerable include = null, int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNullOrEmpty(runId, nameof(runId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await InternalGetRunStepsAsync(threadId, runId, include, limit, order?.ToString(), after, before, context).ConfigureAwait(false); + return Response.FromValue(OpenAIPageableListOfRunStep.FromResponse(response), response); + } + + /// Gets a list of run steps from a thread run. + /// Identifier of the thread. + /// Identifier of the run. + /// + /// A list of additional fields to include in the response. + /// Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. + /// + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + internal virtual Response InternalGetRunSteps(string threadId, string runId, IEnumerable include = null, int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNullOrEmpty(runId, nameof(runId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = InternalGetRunSteps(threadId, runId, include, limit, order?.ToString(), after, before, context); + return Response.FromValue(OpenAIPageableListOfRunStep.FromResponse(response), response); + } + + /// + /// [Protocol Method] Gets a list of run steps from a thread run. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the thread. + /// Identifier of the run. + /// + /// A list of additional fields to include in the response. + /// Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. + /// + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Allowed values: "asc" | "desc". + /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + internal virtual async Task InternalGetRunStepsAsync(string threadId, string runId, IEnumerable include, int? limit, string order, string after, string before, RequestContext context) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNullOrEmpty(runId, nameof(runId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.InternalGetRunSteps"); + scope.Start(); + try + { + using HttpMessage message = CreateInternalGetRunStepsRequest(threadId, runId, include, limit, order, after, before, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Gets a list of run steps from a thread run. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the thread. + /// Identifier of the run. + /// + /// A list of additional fields to include in the response. + /// Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. + /// + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Allowed values: "asc" | "desc". + /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + internal virtual Response InternalGetRunSteps(string threadId, string runId, IEnumerable include, int? limit, string order, string after, string before, RequestContext context) + { + Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); + Argument.AssertNotNullOrEmpty(runId, nameof(runId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.InternalGetRunSteps"); + scope.Start(); + try + { + using HttpMessage message = CreateInternalGetRunStepsRequest(threadId, runId, include, limit, order, after, before, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a list of previously uploaded files. + /// The purpose of the file. + /// The cancellation token to use. + internal virtual async Task> InternalListFilesAsync(OpenAIFilePurpose? purpose = null, CancellationToken cancellationToken = default) + { + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await InternalListFilesAsync(purpose?.ToString(), context).ConfigureAwait(false); + return Response.FromValue(InternalFileListResponse.FromResponse(response), response); + } + + /// Gets a list of previously uploaded files. + /// The purpose of the file. + /// The cancellation token to use. + internal virtual Response InternalListFiles(OpenAIFilePurpose? purpose = null, CancellationToken cancellationToken = default) + { + RequestContext context = FromCancellationToken(cancellationToken); + Response response = InternalListFiles(purpose?.ToString(), context); + return Response.FromValue(InternalFileListResponse.FromResponse(response), response); + } + + /// + /// [Protocol Method] Gets a list of previously uploaded files. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The purpose of the file. Allowed values: "fine-tune" | "fine-tune-results" | "assistants" | "assistants_output" | "batch" | "batch_output" | "vision". + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + internal virtual async Task InternalListFilesAsync(string purpose, RequestContext context) + { + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.InternalListFiles"); + scope.Start(); + try + { + using HttpMessage message = CreateInternalListFilesRequest(purpose, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Gets a list of previously uploaded files. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The purpose of the file. Allowed values: "fine-tune" | "fine-tune-results" | "assistants" | "assistants_output" | "batch" | "batch_output" | "vision". + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + internal virtual Response InternalListFiles(string purpose, RequestContext context) + { + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.InternalListFiles"); + scope.Start(); + try + { + using HttpMessage message = CreateInternalListFilesRequest(purpose, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Uploads a file for use by other operations. + /// Multipart body. + /// The cancellation token to use. + /// is null. + /// + public virtual async Task> UploadFileAsync(UploadFileRequest body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using MultipartFormDataRequestContent content = body.ToMultipartRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await UploadFileAsync(content, content.ContentType, context).ConfigureAwait(false); + return Response.FromValue(OpenAIFile.FromResponse(response), response); + } + + /// Uploads a file for use by other operations. + /// Multipart body. + /// The cancellation token to use. + /// is null. + /// + public virtual Response UploadFile(UploadFileRequest body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using MultipartFormDataRequestContent content = body.ToMultipartRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = UploadFile(content, content.ContentType, context); + return Response.FromValue(OpenAIFile.FromResponse(response), response); + } + + /// + /// [Protocol Method] Uploads a file for use by other operations. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The name of the file to upload. Allowed values: "multipart/form-data". + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task UploadFileAsync(RequestContent content, string contentType, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.UploadFile"); + scope.Start(); + try + { + using HttpMessage message = CreateUploadFileRequest(content, contentType, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Uploads a file for use by other operations. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The name of the file to upload. Allowed values: "multipart/form-data". + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response UploadFile(RequestContent content, string contentType, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.UploadFile"); + scope.Start(); + try + { + using HttpMessage message = CreateUploadFileRequest(content, contentType, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete a previously uploaded file. + /// The ID of the file to delete. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + internal virtual async Task> InternalDeleteFileAsync(string fileId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await InternalDeleteFileAsync(fileId, context).ConfigureAwait(false); + return Response.FromValue(InternalFileDeletionStatus.FromResponse(response), response); + } + + /// Delete a previously uploaded file. + /// The ID of the file to delete. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + internal virtual Response InternalDeleteFile(string fileId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = InternalDeleteFile(fileId, context); + return Response.FromValue(InternalFileDeletionStatus.FromResponse(response), response); + } + + /// + /// [Protocol Method] Delete a previously uploaded file. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The ID of the file to delete. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + internal virtual async Task InternalDeleteFileAsync(string fileId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.InternalDeleteFile"); + scope.Start(); + try + { + using HttpMessage message = CreateInternalDeleteFileRequest(fileId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Delete a previously uploaded file. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The ID of the file to delete. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + internal virtual Response InternalDeleteFile(string fileId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.InternalDeleteFile"); + scope.Start(); + try + { + using HttpMessage message = CreateInternalDeleteFileRequest(fileId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns information about a specific file. Does not retrieve file content. + /// The ID of the file to retrieve. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetFileAsync(string fileId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetFileAsync(fileId, context).ConfigureAwait(false); + return Response.FromValue(OpenAIFile.FromResponse(response), response); + } + + /// Returns information about a specific file. Does not retrieve file content. + /// The ID of the file to retrieve. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetFile(string fileId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetFile(fileId, context); + return Response.FromValue(OpenAIFile.FromResponse(response), response); + } + + /// + /// [Protocol Method] Returns information about a specific file. Does not retrieve file content. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The ID of the file to retrieve. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetFileAsync(string fileId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.GetFile"); + scope.Start(); + try + { + using HttpMessage message = CreateGetFileRequest(fileId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Returns information about a specific file. Does not retrieve file content. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The ID of the file to retrieve. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetFile(string fileId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.GetFile"); + scope.Start(); + try + { + using HttpMessage message = CreateGetFileRequest(fileId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieves the raw content of a specific file. + /// The ID of the file to retrieve. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetFileContentAsync(string fileId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetFileContentAsync(fileId, context).ConfigureAwait(false); + return Response.FromValue(response.Content, response); + } + + /// Retrieves the raw content of a specific file. + /// The ID of the file to retrieve. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetFileContent(string fileId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetFileContent(fileId, context); + return Response.FromValue(response.Content, response); + } + + /// + /// [Protocol Method] Retrieves the raw content of a specific file. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The ID of the file to retrieve. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetFileContentAsync(string fileId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.GetFileContent"); + scope.Start(); + try + { + using HttpMessage message = CreateGetFileContentRequest(fileId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Retrieves the raw content of a specific file. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The ID of the file to retrieve. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetFileContent(string fileId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.GetFileContent"); + scope.Start(); + try + { + using HttpMessage message = CreateGetFileContentRequest(fileId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns a list of vector stores. + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + /// The cancellation token to use. + /// + public virtual async Task> GetVectorStoresAsync(int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default) + { + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetVectorStoresAsync(limit, order?.ToString(), after, before, context).ConfigureAwait(false); + return Response.FromValue(OpenAIPageableListOfVectorStore.FromResponse(response), response); + } + + /// Returns a list of vector stores. + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + /// The cancellation token to use. + /// + public virtual Response GetVectorStores(int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default) + { + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetVectorStores(limit, order?.ToString(), after, before, context); + return Response.FromValue(OpenAIPageableListOfVectorStore.FromResponse(response), response); + } + + /// + /// [Protocol Method] Returns a list of vector stores. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Allowed values: "asc" | "desc". + /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetVectorStoresAsync(int? limit, string order, string after, string before, RequestContext context) + { + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.GetVectorStores"); + scope.Start(); + try + { + using HttpMessage message = CreateGetVectorStoresRequest(limit, order, after, before, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Returns a list of vector stores. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Allowed values: "asc" | "desc". + /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetVectorStores(int? limit, string order, string after, string before, RequestContext context) + { + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.GetVectorStores"); + scope.Start(); + try + { + using HttpMessage message = CreateGetVectorStoresRequest(limit, order, after, before, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates a vector store. + /// A list of file IDs that the vector store should use. Useful for tools like `file_search` that can access files. + /// The name of the vector store. + /// The vector store configuration, used when vector store is created from Azure asset URIs. + /// Details on when this vector store expires. + /// The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. Only applicable if file_ids is non-empty. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// The cancellation token to use. + /// + public virtual async Task> CreateVectorStoreAsync(IEnumerable fileIds = null, string name = null, VectorStoreConfiguration storeConfiguration = null, VectorStoreExpirationPolicy expiresAfter = null, VectorStoreChunkingStrategyRequest chunkingStrategy = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) + { + CreateVectorStoreRequest createVectorStoreRequest = new CreateVectorStoreRequest( + fileIds?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), + name, + storeConfiguration, + expiresAfter, + chunkingStrategy, + metadata ?? new ChangeTrackingDictionary(), + null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await CreateVectorStoreAsync(createVectorStoreRequest.ToRequestContent(), context).ConfigureAwait(false); + return Response.FromValue(VectorStore.FromResponse(response), response); + } + + /// Creates a vector store. + /// A list of file IDs that the vector store should use. Useful for tools like `file_search` that can access files. + /// The name of the vector store. + /// The vector store configuration, used when vector store is created from Azure asset URIs. + /// Details on when this vector store expires. + /// The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. Only applicable if file_ids is non-empty. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// The cancellation token to use. + /// + public virtual Response CreateVectorStore(IEnumerable fileIds = null, string name = null, VectorStoreConfiguration storeConfiguration = null, VectorStoreExpirationPolicy expiresAfter = null, VectorStoreChunkingStrategyRequest chunkingStrategy = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) + { + CreateVectorStoreRequest createVectorStoreRequest = new CreateVectorStoreRequest( + fileIds?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), + name, + storeConfiguration, + expiresAfter, + chunkingStrategy, + metadata ?? new ChangeTrackingDictionary(), + null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = CreateVectorStore(createVectorStoreRequest.ToRequestContent(), context); + return Response.FromValue(VectorStore.FromResponse(response), response); + } + + /// + /// [Protocol Method] Creates a vector store. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task CreateVectorStoreAsync(RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.CreateVectorStore"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateVectorStoreRequest(content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Creates a vector store. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response CreateVectorStore(RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.CreateVectorStore"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateVectorStoreRequest(content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns the vector store object matching the specified ID. + /// Identifier of the vector store. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetVectorStoreAsync(string vectorStoreId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetVectorStoreAsync(vectorStoreId, context).ConfigureAwait(false); + return Response.FromValue(VectorStore.FromResponse(response), response); + } + + /// Returns the vector store object matching the specified ID. + /// Identifier of the vector store. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetVectorStore(string vectorStoreId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetVectorStore(vectorStoreId, context); + return Response.FromValue(VectorStore.FromResponse(response), response); + } + + /// + /// [Protocol Method] Returns the vector store object matching the specified ID. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the vector store. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetVectorStoreAsync(string vectorStoreId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.GetVectorStore"); + scope.Start(); + try + { + using HttpMessage message = CreateGetVectorStoreRequest(vectorStoreId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Returns the vector store object matching the specified ID. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the vector store. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetVectorStore(string vectorStoreId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.GetVectorStore"); + scope.Start(); + try + { + using HttpMessage message = CreateGetVectorStoreRequest(vectorStoreId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// The ID of the vector store to modify. + /// Identifier of the vector store. + /// The name of the vector store. + /// Details on when this vector store expires. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> ModifyVectorStoreAsync(string vectorStoreId, string name = null, VectorStoreExpirationPolicy expiresAfter = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + ModifyVectorStoreRequest modifyVectorStoreRequest = new ModifyVectorStoreRequest(name, expiresAfter, metadata ?? new ChangeTrackingDictionary(), null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await ModifyVectorStoreAsync(vectorStoreId, modifyVectorStoreRequest.ToRequestContent(), context).ConfigureAwait(false); + return Response.FromValue(VectorStore.FromResponse(response), response); + } + + /// The ID of the vector store to modify. + /// Identifier of the vector store. + /// The name of the vector store. + /// Details on when this vector store expires. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response ModifyVectorStore(string vectorStoreId, string name = null, VectorStoreExpirationPolicy expiresAfter = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + ModifyVectorStoreRequest modifyVectorStoreRequest = new ModifyVectorStoreRequest(name, expiresAfter, metadata ?? new ChangeTrackingDictionary(), null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = ModifyVectorStore(vectorStoreId, modifyVectorStoreRequest.ToRequestContent(), context); + return Response.FromValue(VectorStore.FromResponse(response), response); + } + + /// + /// [Protocol Method] The ID of the vector store to modify. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the vector store. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task ModifyVectorStoreAsync(string vectorStoreId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.ModifyVectorStore"); + scope.Start(); + try + { + using HttpMessage message = CreateModifyVectorStoreRequest(vectorStoreId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] The ID of the vector store to modify. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the vector store. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response ModifyVectorStore(string vectorStoreId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.ModifyVectorStore"); + scope.Start(); + try + { + using HttpMessage message = CreateModifyVectorStoreRequest(vectorStoreId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes the vector store object matching the specified ID. + /// Identifier of the vector store. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> DeleteVectorStoreAsync(string vectorStoreId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await DeleteVectorStoreAsync(vectorStoreId, context).ConfigureAwait(false); + return Response.FromValue(VectorStoreDeletionStatus.FromResponse(response), response); + } + + /// Deletes the vector store object matching the specified ID. + /// Identifier of the vector store. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response DeleteVectorStore(string vectorStoreId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = DeleteVectorStore(vectorStoreId, context); + return Response.FromValue(VectorStoreDeletionStatus.FromResponse(response), response); + } + + /// + /// [Protocol Method] Deletes the vector store object matching the specified ID. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the vector store. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task DeleteVectorStoreAsync(string vectorStoreId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.DeleteVectorStore"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteVectorStoreRequest(vectorStoreId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Deletes the vector store object matching the specified ID. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the vector store. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response DeleteVectorStore(string vectorStoreId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.DeleteVectorStore"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteVectorStoreRequest(vectorStoreId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns a list of vector store files. + /// Identifier of the vector store. + /// Filter by file status. + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetVectorStoreFilesAsync(string vectorStoreId, VectorStoreFileStatusFilter? filter = null, int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetVectorStoreFilesAsync(vectorStoreId, filter?.ToString(), limit, order?.ToString(), after, before, context).ConfigureAwait(false); + return Response.FromValue(OpenAIPageableListOfVectorStoreFile.FromResponse(response), response); + } + + /// Returns a list of vector store files. + /// Identifier of the vector store. + /// Filter by file status. + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetVectorStoreFiles(string vectorStoreId, VectorStoreFileStatusFilter? filter = null, int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetVectorStoreFiles(vectorStoreId, filter?.ToString(), limit, order?.ToString(), after, before, context); + return Response.FromValue(OpenAIPageableListOfVectorStoreFile.FromResponse(response), response); + } + + /// + /// [Protocol Method] Returns a list of vector store files. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the vector store. + /// Filter by file status. Allowed values: "in_progress" | "completed" | "failed" | "cancelled". + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Allowed values: "asc" | "desc". + /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetVectorStoreFilesAsync(string vectorStoreId, string filter, int? limit, string order, string after, string before, RequestContext context) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.GetVectorStoreFiles"); + scope.Start(); + try + { + using HttpMessage message = CreateGetVectorStoreFilesRequest(vectorStoreId, filter, limit, order, after, before, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Returns a list of vector store files. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the vector store. + /// Filter by file status. Allowed values: "in_progress" | "completed" | "failed" | "cancelled". + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Allowed values: "asc" | "desc". + /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetVectorStoreFiles(string vectorStoreId, string filter, int? limit, string order, string after, string before, RequestContext context) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.GetVectorStoreFiles"); + scope.Start(); + try + { + using HttpMessage message = CreateGetVectorStoreFilesRequest(vectorStoreId, filter, limit, order, after, before, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a vector store file by attaching a file to a vector store. + /// Identifier of the vector store. + /// Identifier of the file. + /// Azure asset ID. + /// The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> CreateVectorStoreFileAsync(string vectorStoreId, string fileId = null, VectorStoreDataSource dataSource = null, VectorStoreChunkingStrategyRequest chunkingStrategy = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + CreateVectorStoreFileRequest createVectorStoreFileRequest = new CreateVectorStoreFileRequest(fileId, dataSource, chunkingStrategy, null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await CreateVectorStoreFileAsync(vectorStoreId, createVectorStoreFileRequest.ToRequestContent(), context).ConfigureAwait(false); + return Response.FromValue(VectorStoreFile.FromResponse(response), response); + } + + /// Create a vector store file by attaching a file to a vector store. + /// Identifier of the vector store. + /// Identifier of the file. + /// Azure asset ID. + /// The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response CreateVectorStoreFile(string vectorStoreId, string fileId = null, VectorStoreDataSource dataSource = null, VectorStoreChunkingStrategyRequest chunkingStrategy = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + CreateVectorStoreFileRequest createVectorStoreFileRequest = new CreateVectorStoreFileRequest(fileId, dataSource, chunkingStrategy, null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = CreateVectorStoreFile(vectorStoreId, createVectorStoreFileRequest.ToRequestContent(), context); + return Response.FromValue(VectorStoreFile.FromResponse(response), response); + } + + /// + /// [Protocol Method] Create a vector store file by attaching a file to a vector store. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the vector store. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task CreateVectorStoreFileAsync(string vectorStoreId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.CreateVectorStoreFile"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateVectorStoreFileRequest(vectorStoreId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Create a vector store file by attaching a file to a vector store. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the vector store. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response CreateVectorStoreFile(string vectorStoreId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.CreateVectorStoreFile"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateVectorStoreFileRequest(vectorStoreId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieves a vector store file. + /// Identifier of the vector store. + /// Identifier of the file. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetVectorStoreFileAsync(string vectorStoreId, string fileId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetVectorStoreFileAsync(vectorStoreId, fileId, context).ConfigureAwait(false); + return Response.FromValue(VectorStoreFile.FromResponse(response), response); + } + + /// Retrieves a vector store file. + /// Identifier of the vector store. + /// Identifier of the file. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual Response GetVectorStoreFile(string vectorStoreId, string fileId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetVectorStoreFile(vectorStoreId, fileId, context); + return Response.FromValue(VectorStoreFile.FromResponse(response), response); + } + + /// + /// [Protocol Method] Retrieves a vector store file. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the vector store. + /// Identifier of the file. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetVectorStoreFileAsync(string vectorStoreId, string fileId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.GetVectorStoreFile"); + scope.Start(); + try + { + using HttpMessage message = CreateGetVectorStoreFileRequest(vectorStoreId, fileId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Retrieves a vector store file. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the vector store. + /// Identifier of the file. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetVectorStoreFile(string vectorStoreId, string fileId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.GetVectorStoreFile"); + scope.Start(); + try + { + using HttpMessage message = CreateGetVectorStoreFileRequest(vectorStoreId, fileId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. + /// To delete the file, use the delete file endpoint. + /// + /// Identifier of the vector store. + /// Identifier of the file. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual async Task> DeleteVectorStoreFileAsync(string vectorStoreId, string fileId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await DeleteVectorStoreFileAsync(vectorStoreId, fileId, context).ConfigureAwait(false); + return Response.FromValue(VectorStoreFileDeletionStatus.FromResponse(response), response); + } + + /// + /// Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. + /// To delete the file, use the delete file endpoint. + /// + /// Identifier of the vector store. + /// Identifier of the file. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual Response DeleteVectorStoreFile(string vectorStoreId, string fileId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = DeleteVectorStoreFile(vectorStoreId, fileId, context); + return Response.FromValue(VectorStoreFileDeletionStatus.FromResponse(response), response); + } + + /// + /// [Protocol Method] Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. + /// To delete the file, use the delete file endpoint. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the vector store. + /// Identifier of the file. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task DeleteVectorStoreFileAsync(string vectorStoreId, string fileId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.DeleteVectorStoreFile"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteVectorStoreFileRequest(vectorStoreId, fileId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. + /// To delete the file, use the delete file endpoint. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the vector store. + /// Identifier of the file. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response DeleteVectorStoreFile(string vectorStoreId, string fileId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.DeleteVectorStoreFile"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteVectorStoreFileRequest(vectorStoreId, fileId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a vector store file batch. + /// Identifier of the vector store. + /// List of file identifiers. + /// List of Azure assets. + /// The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> CreateVectorStoreFileBatchAsync(string vectorStoreId, IEnumerable fileIds = null, IEnumerable dataSources = null, VectorStoreChunkingStrategyRequest chunkingStrategy = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + CreateVectorStoreFileBatchRequest createVectorStoreFileBatchRequest = new CreateVectorStoreFileBatchRequest(fileIds?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), dataSources?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), chunkingStrategy, null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await CreateVectorStoreFileBatchAsync(vectorStoreId, createVectorStoreFileBatchRequest.ToRequestContent(), context).ConfigureAwait(false); + return Response.FromValue(VectorStoreFileBatch.FromResponse(response), response); + } + + /// Create a vector store file batch. + /// Identifier of the vector store. + /// List of file identifiers. + /// List of Azure assets. + /// The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response CreateVectorStoreFileBatch(string vectorStoreId, IEnumerable fileIds = null, IEnumerable dataSources = null, VectorStoreChunkingStrategyRequest chunkingStrategy = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + CreateVectorStoreFileBatchRequest createVectorStoreFileBatchRequest = new CreateVectorStoreFileBatchRequest(fileIds?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), dataSources?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), chunkingStrategy, null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = CreateVectorStoreFileBatch(vectorStoreId, createVectorStoreFileBatchRequest.ToRequestContent(), context); + return Response.FromValue(VectorStoreFileBatch.FromResponse(response), response); + } + + /// + /// [Protocol Method] Create a vector store file batch. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the vector store. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task CreateVectorStoreFileBatchAsync(string vectorStoreId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.CreateVectorStoreFileBatch"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateVectorStoreFileBatchRequest(vectorStoreId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Create a vector store file batch. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the vector store. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response CreateVectorStoreFileBatch(string vectorStoreId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.CreateVectorStoreFileBatch"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateVectorStoreFileBatchRequest(vectorStoreId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieve a vector store file batch. + /// Identifier of the vector store. + /// Identifier of the file batch. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetVectorStoreFileBatchAsync(string vectorStoreId, string batchId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + Argument.AssertNotNullOrEmpty(batchId, nameof(batchId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetVectorStoreFileBatchAsync(vectorStoreId, batchId, context).ConfigureAwait(false); + return Response.FromValue(VectorStoreFileBatch.FromResponse(response), response); + } + + /// Retrieve a vector store file batch. + /// Identifier of the vector store. + /// Identifier of the file batch. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual Response GetVectorStoreFileBatch(string vectorStoreId, string batchId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + Argument.AssertNotNullOrEmpty(batchId, nameof(batchId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetVectorStoreFileBatch(vectorStoreId, batchId, context); + return Response.FromValue(VectorStoreFileBatch.FromResponse(response), response); + } + + /// + /// [Protocol Method] Retrieve a vector store file batch. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the vector store. + /// Identifier of the file batch. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetVectorStoreFileBatchAsync(string vectorStoreId, string batchId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + Argument.AssertNotNullOrEmpty(batchId, nameof(batchId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.GetVectorStoreFileBatch"); + scope.Start(); + try + { + using HttpMessage message = CreateGetVectorStoreFileBatchRequest(vectorStoreId, batchId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Retrieve a vector store file batch. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the vector store. + /// Identifier of the file batch. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetVectorStoreFileBatch(string vectorStoreId, string batchId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + Argument.AssertNotNullOrEmpty(batchId, nameof(batchId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.GetVectorStoreFileBatch"); + scope.Start(); + try + { + using HttpMessage message = CreateGetVectorStoreFileBatchRequest(vectorStoreId, batchId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible. + /// Identifier of the vector store. + /// Identifier of the file batch. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual async Task> CancelVectorStoreFileBatchAsync(string vectorStoreId, string batchId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + Argument.AssertNotNullOrEmpty(batchId, nameof(batchId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await CancelVectorStoreFileBatchAsync(vectorStoreId, batchId, context).ConfigureAwait(false); + return Response.FromValue(VectorStoreFileBatch.FromResponse(response), response); + } + + /// Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible. + /// Identifier of the vector store. + /// Identifier of the file batch. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual Response CancelVectorStoreFileBatch(string vectorStoreId, string batchId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + Argument.AssertNotNullOrEmpty(batchId, nameof(batchId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = CancelVectorStoreFileBatch(vectorStoreId, batchId, context); + return Response.FromValue(VectorStoreFileBatch.FromResponse(response), response); + } + + /// + /// [Protocol Method] Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the vector store. + /// Identifier of the file batch. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task CancelVectorStoreFileBatchAsync(string vectorStoreId, string batchId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + Argument.AssertNotNullOrEmpty(batchId, nameof(batchId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.CancelVectorStoreFileBatch"); + scope.Start(); + try + { + using HttpMessage message = CreateCancelVectorStoreFileBatchRequest(vectorStoreId, batchId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the vector store. + /// Identifier of the file batch. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response CancelVectorStoreFileBatch(string vectorStoreId, string batchId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + Argument.AssertNotNullOrEmpty(batchId, nameof(batchId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.CancelVectorStoreFileBatch"); + scope.Start(); + try + { + using HttpMessage message = CreateCancelVectorStoreFileBatchRequest(vectorStoreId, batchId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns a list of vector store files in a batch. + /// Identifier of the vector store. + /// Identifier of the file batch. + /// Filter by file status. + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetVectorStoreFileBatchFilesAsync(string vectorStoreId, string batchId, VectorStoreFileStatusFilter? filter = null, int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + Argument.AssertNotNullOrEmpty(batchId, nameof(batchId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetVectorStoreFileBatchFilesAsync(vectorStoreId, batchId, filter?.ToString(), limit, order?.ToString(), after, before, context).ConfigureAwait(false); + return Response.FromValue(OpenAIPageableListOfVectorStoreFile.FromResponse(response), response); + } + + /// Returns a list of vector store files in a batch. + /// Identifier of the vector store. + /// Identifier of the file batch. + /// Filter by file status. + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual Response GetVectorStoreFileBatchFiles(string vectorStoreId, string batchId, VectorStoreFileStatusFilter? filter = null, int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + Argument.AssertNotNullOrEmpty(batchId, nameof(batchId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetVectorStoreFileBatchFiles(vectorStoreId, batchId, filter?.ToString(), limit, order?.ToString(), after, before, context); + return Response.FromValue(OpenAIPageableListOfVectorStoreFile.FromResponse(response), response); + } + + /// + /// [Protocol Method] Returns a list of vector store files in a batch. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the vector store. + /// Identifier of the file batch. + /// Filter by file status. Allowed values: "in_progress" | "completed" | "failed" | "cancelled". + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Allowed values: "asc" | "desc". + /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetVectorStoreFileBatchFilesAsync(string vectorStoreId, string batchId, string filter, int? limit, string order, string after, string before, RequestContext context) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + Argument.AssertNotNullOrEmpty(batchId, nameof(batchId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.GetVectorStoreFileBatchFiles"); + scope.Start(); + try + { + using HttpMessage message = CreateGetVectorStoreFileBatchFilesRequest(vectorStoreId, batchId, filter, limit, order, after, before, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Returns a list of vector store files in a batch. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the vector store. + /// Identifier of the file batch. + /// Filter by file status. Allowed values: "in_progress" | "completed" | "failed" | "cancelled". + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Allowed values: "asc" | "desc". + /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetVectorStoreFileBatchFiles(string vectorStoreId, string batchId, string filter, int? limit, string order, string after, string before, RequestContext context) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + Argument.AssertNotNullOrEmpty(batchId, nameof(batchId)); + + using var scope = ClientDiagnostics.CreateScope("AIAssistantClient.GetVectorStoreFileBatchFiles"); + scope.Start(); + try + { + using HttpMessage message = CreateGetVectorStoreFileBatchFilesRequest(vectorStoreId, batchId, filter, limit, order, after, before, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + internal HttpMessage CreateCreateAgentRequest(RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/assistants", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateInternalGetAgentsRequest(int? limit, string order, string after, string before, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/assistants", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (limit != null) + { + uri.AppendQuery("limit", limit.Value, true); + } + if (order != null) + { + uri.AppendQuery("order", order, true); + } + if (after != null) + { + uri.AppendQuery("after", after, true); + } + if (before != null) + { + uri.AppendQuery("before", before, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetAgentRequest(string assistantId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/assistants/", false); + uri.AppendPath(assistantId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateUpdateAgentRequest(string assistantId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/assistants/", false); + uri.AppendPath(assistantId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateInternalDeleteAgentRequest(string assistantId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/assistants/", false); + uri.AppendPath(assistantId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateCreateThreadRequest(RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/threads", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateGetThreadRequest(string threadId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/threads/", false); + uri.AppendPath(threadId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateUpdateThreadRequest(string threadId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/threads/", false); + uri.AppendPath(threadId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateInternalDeleteThreadRequest(string threadId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/threads/", false); + uri.AppendPath(threadId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateCreateMessageRequest(string threadId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/threads/", false); + uri.AppendPath(threadId, true); + uri.AppendPath("/messages", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateInternalGetMessagesRequest(string threadId, string runId, int? limit, string order, string after, string before, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/threads/", false); + uri.AppendPath(threadId, true); + uri.AppendPath("/messages", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (runId != null) + { + uri.AppendQuery("runId", runId, true); + } + if (limit != null) + { + uri.AppendQuery("limit", limit.Value, true); + } + if (order != null) + { + uri.AppendQuery("order", order, true); + } + if (after != null) + { + uri.AppendQuery("after", after, true); + } + if (before != null) + { + uri.AppendQuery("before", before, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetMessageRequest(string threadId, string messageId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/threads/", false); + uri.AppendPath(threadId, true); + uri.AppendPath("/messages/", false); + uri.AppendPath(messageId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateUpdateMessageRequest(string threadId, string messageId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/threads/", false); + uri.AppendPath(threadId, true); + uri.AppendPath("/messages/", false); + uri.AppendPath(messageId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateCreateRunRequest(string threadId, RequestContent content, IEnumerable include, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/threads/", false); + uri.AppendPath(threadId, true); + uri.AppendPath("/runs", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (include != null && !(include is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined)) + { + uri.AppendQueryDelimited("include[]", include, ",", true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateInternalGetRunsRequest(string threadId, int? limit, string order, string after, string before, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/threads/", false); + uri.AppendPath(threadId, true); + uri.AppendPath("/runs", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (limit != null) + { + uri.AppendQuery("limit", limit.Value, true); + } + if (order != null) + { + uri.AppendQuery("order", order, true); + } + if (after != null) + { + uri.AppendQuery("after", after, true); + } + if (before != null) + { + uri.AppendQuery("before", before, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetRunRequest(string threadId, string runId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/threads/", false); + uri.AppendPath(threadId, true); + uri.AppendPath("/runs/", false); + uri.AppendPath(runId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateUpdateRunRequest(string threadId, string runId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/threads/", false); + uri.AppendPath(threadId, true); + uri.AppendPath("/runs/", false); + uri.AppendPath(runId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateSubmitToolOutputsToRunRequest(string threadId, string runId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/threads/", false); + uri.AppendPath(threadId, true); + uri.AppendPath("/runs/", false); + uri.AppendPath(runId, true); + uri.AppendPath("/submit_tool_outputs", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateCancelRunRequest(string threadId, string runId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/threads/", false); + uri.AppendPath(threadId, true); + uri.AppendPath("/runs/", false); + uri.AppendPath(runId, true); + uri.AppendPath("/cancel", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateCreateThreadAndRunRequest(RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/threads/runs", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateGetRunStepRequest(string threadId, string runId, string stepId, IEnumerable include, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/threads/", false); + uri.AppendPath(threadId, true); + uri.AppendPath("/runs/", false); + uri.AppendPath(runId, true); + uri.AppendPath("/steps/", false); + uri.AppendPath(stepId, true); + uri.AppendQuery("api-version", _apiVersion, true); + if (include != null && !(include is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined)) + { + uri.AppendQueryDelimited("include[]", include, ",", true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateInternalGetRunStepsRequest(string threadId, string runId, IEnumerable include, int? limit, string order, string after, string before, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/threads/", false); + uri.AppendPath(threadId, true); + uri.AppendPath("/runs/", false); + uri.AppendPath(runId, true); + uri.AppendPath("/steps", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (include != null && !(include is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined)) + { + uri.AppendQueryDelimited("include[]", include, ",", true); + } + if (limit != null) + { + uri.AppendQuery("limit", limit.Value, true); + } + if (order != null) + { + uri.AppendQuery("order", order, true); + } + if (after != null) + { + uri.AppendQuery("after", after, true); + } + if (before != null) + { + uri.AppendQuery("before", before, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateInternalListFilesRequest(string purpose, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/files", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (purpose != null) + { + uri.AppendQuery("purpose", purpose, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateUploadFileRequest(RequestContent content, string contentType, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/files", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", contentType); + request.Content = content; + return message; + } + + internal HttpMessage CreateInternalDeleteFileRequest(string fileId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/files/", false); + uri.AppendPath(fileId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetFileRequest(string fileId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/files/", false); + uri.AppendPath(fileId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetFileContentRequest(string fileId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/files/", false); + uri.AppendPath(fileId, true); + uri.AppendPath("/content", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/octet-stream"); + return message; + } + + internal HttpMessage CreateGetVectorStoresRequest(int? limit, string order, string after, string before, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/vector_stores", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (limit != null) + { + uri.AppendQuery("limit", limit.Value, true); + } + if (order != null) + { + uri.AppendQuery("order", order, true); + } + if (after != null) + { + uri.AppendQuery("after", after, true); + } + if (before != null) + { + uri.AppendQuery("before", before, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateCreateVectorStoreRequest(RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/vector_stores", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateGetVectorStoreRequest(string vectorStoreId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/vector_stores/", false); + uri.AppendPath(vectorStoreId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateModifyVectorStoreRequest(string vectorStoreId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/vector_stores/", false); + uri.AppendPath(vectorStoreId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateDeleteVectorStoreRequest(string vectorStoreId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/vector_stores/", false); + uri.AppendPath(vectorStoreId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetVectorStoreFilesRequest(string vectorStoreId, string filter, int? limit, string order, string after, string before, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/vector_stores/", false); + uri.AppendPath(vectorStoreId, true); + uri.AppendPath("/files", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("filter", filter, true); + } + if (limit != null) + { + uri.AppendQuery("limit", limit.Value, true); + } + if (order != null) + { + uri.AppendQuery("order", order, true); + } + if (after != null) + { + uri.AppendQuery("after", after, true); + } + if (before != null) + { + uri.AppendQuery("before", before, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateCreateVectorStoreFileRequest(string vectorStoreId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/vector_stores/", false); + uri.AppendPath(vectorStoreId, true); + uri.AppendPath("/files", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateGetVectorStoreFileRequest(string vectorStoreId, string fileId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/vector_stores/", false); + uri.AppendPath(vectorStoreId, true); + uri.AppendPath("/files/", false); + uri.AppendPath(fileId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateDeleteVectorStoreFileRequest(string vectorStoreId, string fileId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/vector_stores/", false); + uri.AppendPath(vectorStoreId, true); + uri.AppendPath("/files/", false); + uri.AppendPath(fileId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateCreateVectorStoreFileBatchRequest(string vectorStoreId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/vector_stores/", false); + uri.AppendPath(vectorStoreId, true); + uri.AppendPath("/file_batches", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateGetVectorStoreFileBatchRequest(string vectorStoreId, string batchId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/vector_stores/", false); + uri.AppendPath(vectorStoreId, true); + uri.AppendPath("/file_batches/", false); + uri.AppendPath(batchId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateCancelVectorStoreFileBatchRequest(string vectorStoreId, string batchId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/vector_stores/", false); + uri.AppendPath(vectorStoreId, true); + uri.AppendPath("/file_batches/", false); + uri.AppendPath(batchId, true); + uri.AppendPath("/cancel", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetVectorStoreFileBatchFilesRequest(string vectorStoreId, string batchId, string filter, int? limit, string order, string after, string before, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/vector_stores/", false); + uri.AppendPath(vectorStoreId, true); + uri.AppendPath("/file_batches/", false); + uri.AppendPath(batchId, true); + uri.AppendPath("/files", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("filter", filter, true); + } + if (limit != null) + { + uri.AppendQuery("limit", limit.Value, true); + } + if (order != null) + { + uri.AppendQuery("order", order, true); + } + if (after != null) + { + uri.AppendQuery("after", after, true); + } + if (before != null) + { + uri.AppendQuery("before", before, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + private static RequestContext DefaultRequestContext = new RequestContext(); + internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) + { + if (!cancellationToken.CanBeCanceled) + { + return DefaultRequestContext; + } + + return new RequestContext() { CancellationToken = cancellationToken }; + } + + private static ResponseClassifier _responseClassifier200; + private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AIAssistantClientOptions.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AIAssistantClientOptions.cs new file mode 100644 index 000000000000..83f302d2cbaf --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AIAssistantClientOptions.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + /// Client options for AIAssistantClient. + public partial class AIAssistantClientOptions : ClientOptions + { + private const ServiceVersion LatestVersion = ServiceVersion.Vlatest; + + /// The version of the service to use. + public enum ServiceVersion + { + /// Service version "latest". + Vlatest = 1, + } + + internal string Version { get; } + + /// Initializes new instance of AIAssistantClientOptions. + public AIAssistantClientOptions(ServiceVersion version = LatestVersion) + { + Version = version switch + { + ServiceVersion.Vlatest => "latest", + _ => throw new NotSupportedException() + }; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AIAssistantsClientBuilderExtensions.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AIAssistantsClientBuilderExtensions.cs new file mode 100644 index 000000000000..1dfcab2c5815 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AIAssistantsClientBuilderExtensions.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure; +using Azure.AI.Assistants; +using Azure.Core.Extensions; + +namespace Microsoft.Extensions.Azure +{ + /// Extension methods to add to client builder. + public static partial class AIAssistantsClientBuilderExtensions + { + /// Registers a instance. + /// The builder to register with. + /// Project endpoint in the form of: https://<aiservices-id>.services.ai.azure.com/api/projects/<project-name>. + /// A credential used to authenticate to an Azure Service. + public static IAzureClientBuilder AddAIAssistantClient(this TBuilder builder, Uri endpoint, AzureKeyCredential credential) + where TBuilder : IAzureClientFactoryBuilder + { + return builder.RegisterClientFactory((options) => new AIAssistantClient(endpoint, credential, options)); + } + + /// Registers a instance. + /// The builder to register with. + /// Project endpoint in the form of: https://<aiservices-id>.services.ai.azure.com/api/projects/<project-name>. + public static IAzureClientBuilder AddAIAssistantClient(this TBuilder builder, Uri endpoint) + where TBuilder : IAzureClientFactoryBuilderWithCredential + { + return builder.RegisterClientFactory((options, cred) => new AIAssistantClient(endpoint, cred, options)); + } + + /// Registers a instance. + /// The builder to register with. + /// The configuration values. + public static IAzureClientBuilder AddAIAssistantClient(this TBuilder builder, TConfiguration configuration) + where TBuilder : IAzureClientFactoryBuilderWithConfiguration + { + return builder.RegisterClientFactory(configuration); + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AIAssistantsModelFactory.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AIAssistantsModelFactory.cs new file mode 100644 index 000000000000..fb9dc026725c --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AIAssistantsModelFactory.cs @@ -0,0 +1,1072 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Assistants +{ + /// Model factory for models. + public static partial class AIAssistantsModelFactory + { + /// Initializes a new instance of . + /// The type of binding, which is always 'storage_queue'. + /// Storage queue. + /// A new instance for mocking. + public static AzureFunctionBinding AzureFunctionBinding(AzureFunctionBindingType type = default, AzureFunctionStorageQueue storageQueue = null) + { + return new AzureFunctionBinding(type, storageQueue, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Type. + /// The JSON schema, describing response format. + /// A new instance for mocking. + public static ResponseFormatJsonSchemaType ResponseFormatJsonSchemaType(ResponseFormatJsonSchemaTypeType type = default, ResponseFormatJsonSchema jsonSchema = null) + { + return new ResponseFormatJsonSchemaType(type, jsonSchema, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The identifier, which can be referenced in API endpoints. + /// The object type, which is always assistant. + /// The Unix timestamp, in seconds, representing when this object was created. + /// The name of the agent. + /// The description of the agent. + /// The ID of the model to use. + /// The system instructions for the agent to use. + /// + /// The collection of tools enabled for the agent. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , and . + /// + /// + /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, the `code_interpreter` + /// tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. + /// + /// + /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, + /// while lower values like 0.2 will make it more focused and deterministic. + /// + /// + /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. + /// So 0.1 means only the tokens comprising the top 10% probability mass are considered. + /// + /// We generally recommend altering this or temperature but not both. + /// + /// The response format of the tool calls used by this agent. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// A new instance for mocking. + public static Agent Agent(string id = null, AgentObject @object = default, DateTimeOffset createdAt = default, string name = null, string description = null, string model = null, string instructions = null, IEnumerable tools = null, ToolResources toolResources = null, float? temperature = null, float? topP = null, BinaryData responseFormat = null, IReadOnlyDictionary metadata = null) + { + tools ??= new List(); + metadata ??= new Dictionary(); + + return new Agent( + id, + @object, + createdAt, + name, + description, + model, + instructions, + tools?.ToList(), + toolResources, + temperature, + topP, + responseFormat, + metadata, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// + /// The role of the entity that is creating the message. Allowed values include: + /// - `user`: Indicates the message is sent by an actual user and should be used in most + /// cases to represent user-generated messages. + /// - `assistant`: Indicates the message is generated by the agent. Use this value to insert + /// messages from the agent into the + /// conversation. + /// + /// + /// The textual content of the initial message. Currently, robust input including images and annotated text may only be provided via + /// a separate call to the create message API. + /// + /// A list of files attached to the message, and the tools they should be added to. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// A new instance for mocking. + public static ThreadMessageOptions ThreadMessageOptions(MessageRole role = default, string content = null, IEnumerable attachments = null, IDictionary metadata = null) + { + attachments ??= new List(); + metadata ??= new Dictionary(); + + return new ThreadMessageOptions(role, content, attachments?.ToList(), metadata, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The identifier, which can be referenced in API endpoints. + /// The object type, which is always 'thread'. + /// The Unix timestamp, in seconds, representing when this object was created. + /// + /// A set of resources that are made available to the agent's tools in this thread. The resources are specific to the type + /// of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list + /// of vector store IDs. + /// + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// A new instance for mocking. + public static AgentThread AgentThread(string id = null, AgentThreadObject @object = default, DateTimeOffset createdAt = default, ToolResources toolResources = null, IReadOnlyDictionary metadata = null) + { + metadata ??= new Dictionary(); + + return new AgentThread( + id, + @object, + createdAt, + toolResources, + metadata, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The identifier, which can be referenced in API endpoints. + /// The object type, which is always 'thread.message'. + /// The Unix timestamp, in seconds, representing when this object was created. + /// The ID of the thread that this message belongs to. + /// The status of the message. + /// On an incomplete message, details about why the message is incomplete. + /// The Unix timestamp (in seconds) for when the message was completed. + /// The Unix timestamp (in seconds) for when the message was marked as incomplete. + /// The role associated with the agent thread message. + /// + /// The list of content items associated with the agent thread message. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// If applicable, the ID of the agent that authored this message. + /// If applicable, the ID of the run associated with the authoring of this message. + /// A list of files attached to the message, and the tools they were added to. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// A new instance for mocking. + public static ThreadMessage ThreadMessage(string id = null, ThreadMessageObject @object = default, DateTimeOffset createdAt = default, string threadId = null, MessageStatus status = default, MessageIncompleteDetails incompleteDetails = null, DateTimeOffset? completedAt = null, DateTimeOffset? incompleteAt = null, MessageRole role = default, IEnumerable contentItems = null, string assistantId = null, string runId = null, IEnumerable attachments = null, IReadOnlyDictionary metadata = null) + { + contentItems ??= new List(); + attachments ??= new List(); + metadata ??= new Dictionary(); + + return new ThreadMessage( + id, + @object, + createdAt, + threadId, + status, + incompleteDetails, + completedAt, + incompleteAt, + role, + contentItems?.ToList(), + assistantId, + runId, + attachments?.ToList(), + metadata, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The provided reason describing why the message was marked as incomplete. + /// A new instance for mocking. + public static MessageIncompleteDetails MessageIncompleteDetails(MessageIncompleteDetailsReason reason = default) + { + return new MessageIncompleteDetails(reason, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The object type. + /// The textual content associated with this text annotation item. + /// A new instance for mocking. + public static MessageTextAnnotation MessageTextAnnotation(string type = null, string text = null) + { + return new UnknownMessageTextAnnotation(type, text, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The textual content associated with this text annotation item. + /// The details of the URL citation. + /// The first text index associated with this text annotation. + /// The last text index associated with this text annotation. + /// A new instance for mocking. + public static MessageTextUrlCitationAnnotation MessageTextUrlCitationAnnotation(string text = null, MessageTextUrlCitationDetails urlCitation = null, int? startIndex = null, int? endIndex = null) + { + return new MessageTextUrlCitationAnnotation( + "url_citation", + text, + serializedAdditionalRawData: null, + urlCitation, + startIndex, + endIndex); + } + + /// Initializes a new instance of . + /// The URL associated with this citation. + /// The title of the URL. + /// A new instance for mocking. + public static MessageTextUrlCitationDetails MessageTextUrlCitationDetails(string url = null, string title = null) + { + return new MessageTextUrlCitationDetails(url, title, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The identifier, which can be referenced in API endpoints. + /// The object type, which is always 'thread.run'. + /// The ID of the thread associated with this run. + /// The ID of the agent associated with the thread this run was performed against. + /// The status of the agent thread run. + /// + /// The details of the action required for the agent thread run to continue. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + /// The last error, if any, encountered by this agent thread run. + /// The ID of the model to use. + /// The overridden system instructions used for this agent thread run. + /// + /// The overridden enabled tools used for this agent thread run. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , and . + /// + /// The Unix timestamp, in seconds, representing when this object was created. + /// The Unix timestamp, in seconds, representing when this item expires. + /// The Unix timestamp, in seconds, representing when this item was started. + /// The Unix timestamp, in seconds, representing when this completed. + /// The Unix timestamp, in seconds, representing when this was cancelled. + /// The Unix timestamp, in seconds, representing when this failed. + /// Details on why the run is incomplete. Will be `null` if the run is not incomplete. + /// Usage statistics related to the run. This value will be `null` if the run is not in a terminal state (i.e. `in_progress`, `queued`, etc.). + /// The sampling temperature used for this run. If not set, defaults to 1. + /// The nucleus sampling value used for this run. If not set, defaults to 1. + /// The maximum number of prompt tokens specified to have been used over the course of the run. + /// The maximum number of completion tokens specified to have been used over the course of the run. + /// The strategy to use for dropping messages as the context windows moves forward. + /// Controls whether or not and which tool is called by the model. + /// The response format of the tool calls used in this run. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// Override the tools the agent can use for this run. This is useful for modifying the behavior on a per-run basis. + /// Determines if tools can be executed in parallel within the run. + /// A new instance for mocking. + public static ThreadRun ThreadRun(string id = null, ThreadRunObject @object = default, string threadId = null, string assistantId = null, RunStatus status = default, RequiredAction requiredAction = null, RunError lastError = null, string model = null, string instructions = null, IEnumerable tools = null, DateTimeOffset createdAt = default, DateTimeOffset? expiresAt = null, DateTimeOffset? startedAt = null, DateTimeOffset? completedAt = null, DateTimeOffset? cancelledAt = null, DateTimeOffset? failedAt = null, IncompleteRunDetails incompleteDetails = null, RunCompletionUsage usage = null, float? temperature = null, float? topP = null, int? maxPromptTokens = null, int? maxCompletionTokens = null, TruncationObject truncationStrategy = null, BinaryData toolChoice = null, BinaryData responseFormat = null, IReadOnlyDictionary metadata = null, UpdateToolResourcesOptions toolResources = null, bool parallelToolCalls = default) + { + tools ??= new List(); + metadata ??= new Dictionary(); + + return new ThreadRun( + id, + @object, + threadId, + assistantId, + status, + requiredAction, + lastError, + model, + instructions, + tools?.ToList(), + createdAt, + expiresAt, + startedAt, + completedAt, + cancelledAt, + failedAt, + incompleteDetails, + usage, + temperature, + topP, + maxPromptTokens, + maxCompletionTokens, + truncationStrategy, + toolChoice, + responseFormat, + metadata, + toolResources, + parallelToolCalls, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The object type for the required tool call. + /// The ID of the tool call. This ID must be referenced when submitting tool outputs. + /// A new instance for mocking. + public static RequiredToolCall RequiredToolCall(string type = null, string id = null) + { + return new UnknownRequiredToolCall(type, id, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The status for the error. + /// The human-readable text associated with the error. + /// A new instance for mocking. + public static RunError RunError(string code = null, string message = null) + { + return new RunError(code, message, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The reason why the run is incomplete. This indicates which specific token limit was reached during the run. + /// A new instance for mocking. + public static IncompleteRunDetails IncompleteRunDetails(IncompleteDetailsReason reason = default) + { + return new IncompleteRunDetails(reason, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Number of completion tokens used over the course of the run. + /// Number of prompt tokens used over the course of the run. + /// Total number of tokens used (prompt + completion). + /// A new instance for mocking. + public static RunCompletionUsage RunCompletionUsage(long completionTokens = default, long promptTokens = default, long totalTokens = default) + { + return new RunCompletionUsage(completionTokens, promptTokens, totalTokens, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The identifier, which can be referenced in API endpoints. + /// The object type, which is always 'thread.run.step'. + /// The type of run step, which can be either message_creation or tool_calls. + /// The ID of the agent associated with the run step. + /// The ID of the thread that was run. + /// The ID of the run that this run step is a part of. + /// The status of this run step. + /// + /// The details for this run step. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// If applicable, information about the last error encountered by this run step. + /// The Unix timestamp, in seconds, representing when this object was created. + /// The Unix timestamp, in seconds, representing when this item expired. + /// The Unix timestamp, in seconds, representing when this completed. + /// The Unix timestamp, in seconds, representing when this was cancelled. + /// The Unix timestamp, in seconds, representing when this failed. + /// Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// A new instance for mocking. + public static RunStep RunStep(string id = null, RunStepObject @object = default, RunStepType type = default, string assistantId = null, string threadId = null, string runId = null, RunStepStatus status = default, RunStepDetails stepDetails = null, RunStepError lastError = null, DateTimeOffset createdAt = default, DateTimeOffset? expiredAt = null, DateTimeOffset? completedAt = null, DateTimeOffset? cancelledAt = null, DateTimeOffset? failedAt = null, RunStepCompletionUsage usage = null, IReadOnlyDictionary metadata = null) + { + metadata ??= new Dictionary(); + + return new RunStep( + id, + @object, + type, + assistantId, + threadId, + runId, + status, + stepDetails, + lastError, + createdAt, + expiredAt, + completedAt, + cancelledAt, + failedAt, + usage, + metadata, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Information about the message creation associated with this run step. + /// A new instance for mocking. + public static RunStepMessageCreationDetails RunStepMessageCreationDetails(RunStepMessageCreationReference messageCreation = null) + { + return new RunStepMessageCreationDetails(RunStepType.MessageCreation, serializedAdditionalRawData: null, messageCreation); + } + + /// Initializes a new instance of . + /// The ID of the message created by this run step. + /// A new instance for mocking. + public static RunStepMessageCreationReference RunStepMessageCreationReference(string messageId = null) + { + return new RunStepMessageCreationReference(messageId, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// + /// A list of tool call details for this run step. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , and . + /// + /// A new instance for mocking. + public static RunStepToolCallDetails RunStepToolCallDetails(IEnumerable toolCalls = null) + { + toolCalls ??= new List(); + + return new RunStepToolCallDetails(RunStepType.ToolCalls, serializedAdditionalRawData: null, toolCalls?.ToList()); + } + + /// Initializes a new instance of . + /// The object type. + /// The ID of the tool call. This ID must be referenced when you submit tool outputs. + /// A new instance for mocking. + public static RunStepToolCall RunStepToolCall(string type = null, string id = null) + { + return new UnknownRunStepToolCall(type, id, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The ID of the tool call. This ID must be referenced when you submit tool outputs. + /// For now, this is always going to be an empty object. + /// A new instance for mocking. + public static RunStepFileSearchToolCall RunStepFileSearchToolCall(string id = null, RunStepFileSearchToolCallResults fileSearch = null) + { + return new RunStepFileSearchToolCall("file_search", id, serializedAdditionalRawData: null, fileSearch); + } + + /// Initializes a new instance of . + /// Ranking options for file search. + /// The array of a file search results. + /// A new instance for mocking. + public static RunStepFileSearchToolCallResults RunStepFileSearchToolCallResults(FileSearchRankingOptions rankingOptions = null, IEnumerable results = null) + { + results ??= new List(); + + return new RunStepFileSearchToolCallResults(rankingOptions, results?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The ID of the file that result was found in. + /// The name of the file that result was found in. + /// The score of the result. All values must be a floating point number between 0 and 1. + /// The content of the result that was found. The content is only included if requested via the include query parameter. + /// A new instance for mocking. + public static RunStepFileSearchToolCallResult RunStepFileSearchToolCallResult(string fileId = null, string fileName = null, float score = default, IEnumerable content = null) + { + content ??= new List(); + + return new RunStepFileSearchToolCallResult(fileId, fileName, score, content?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The type of the content. + /// The text content of the file. + /// A new instance for mocking. + public static FileSearchToolCallContent FileSearchToolCallContent(FileSearchToolCallContentType type = default, string text = null) + { + return new FileSearchToolCallContent(type, text, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The ID of the tool call. This ID must be referenced when you submit tool outputs. + /// Reserved for future use. + /// A new instance for mocking. + public static RunStepBingGroundingToolCall RunStepBingGroundingToolCall(string id = null, IReadOnlyDictionary bingGrounding = null) + { + bingGrounding ??= new Dictionary(); + + return new RunStepBingGroundingToolCall("bing_grounding", id, serializedAdditionalRawData: null, bingGrounding); + } + + /// Initializes a new instance of . + /// The ID of the tool call. This ID must be referenced when you submit tool outputs. + /// Reserved for future use. + /// A new instance for mocking. + public static RunStepAzureAISearchToolCall RunStepAzureAISearchToolCall(string id = null, IReadOnlyDictionary azureAISearch = null) + { + azureAISearch ??= new Dictionary(); + + return new RunStepAzureAISearchToolCall("azure_ai_search", id, serializedAdditionalRawData: null, azureAISearch); + } + + /// Initializes a new instance of . + /// The ID of the tool call. This ID must be referenced when you submit tool outputs. + /// Reserved for future use. + /// A new instance for mocking. + public static RunStepSharepointToolCall RunStepSharepointToolCall(string id = null, IReadOnlyDictionary sharePoint = null) + { + sharePoint ??= new Dictionary(); + + return new RunStepSharepointToolCall("sharepoint_grounding", id, serializedAdditionalRawData: null, sharePoint); + } + + /// Initializes a new instance of . + /// The ID of the tool call. This ID must be referenced when you submit tool outputs. + /// Reserved for future use. + /// A new instance for mocking. + public static RunStepMicrosoftFabricToolCall RunStepMicrosoftFabricToolCall(string id = null, IReadOnlyDictionary microsoftFabric = null) + { + microsoftFabric ??= new Dictionary(); + + return new RunStepMicrosoftFabricToolCall("fabric_dataagent", id, serializedAdditionalRawData: null, microsoftFabric); + } + + /// Initializes a new instance of . + /// The error code for this error. + /// The human-readable text associated with this error. + /// A new instance for mocking. + public static RunStepError RunStepError(RunStepErrorCode code = default, string message = null) + { + return new RunStepError(code, message, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Number of completion tokens used over the course of the run step. + /// Number of prompt tokens used over the course of the run step. + /// Total number of tokens used (prompt + completion). + /// A new instance for mocking. + public static RunStepCompletionUsage RunStepCompletionUsage(long completionTokens = default, long promptTokens = default, long totalTokens = default) + { + return new RunStepCompletionUsage(completionTokens, promptTokens, totalTokens, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The object type, which is always 'file'. + /// The identifier, which can be referenced in API endpoints. + /// The size of the file, in bytes. + /// The name of the file. + /// The Unix timestamp, in seconds, representing when this object was created. + /// The intended purpose of a file. + /// The state of the file. This field is available in Azure OpenAI only. + /// The error message with details in case processing of this file failed. This field is available in Azure OpenAI only. + /// A new instance for mocking. + public static OpenAIFile OpenAIFile(OpenAIFileObject @object = default, string id = null, int size = default, string filename = null, DateTimeOffset createdAt = default, OpenAIFilePurpose purpose = default, FileState? status = null, string statusDetails = null) + { + return new OpenAIFile( + @object, + id, + size, + filename, + createdAt, + purpose, + status, + statusDetails, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The file data, in bytes. + /// The intended purpose of the uploaded file. Use `assistants` for Agents and Message files, `vision` for Agents image file inputs, `batch` for Batch API, and `fine-tune` for Fine-tuning. + /// The name of the file. + /// A new instance for mocking. + public static UploadFileRequest UploadFileRequest(File data = null, OpenAIFilePurpose purpose = default, string filename = null) + { + return new UploadFileRequest(data, purpose, filename, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// + /// + /// + /// A new instance for mocking. + public static File File(string contentType = null, string filename = null, BinaryData contents = null) + { + return new File(contentType, filename, contents, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The object type, which is always list. + /// The requested list of items. + /// The first ID represented in this list. + /// The last ID represented in this list. + /// A value indicating whether there are additional values available not captured in this list. + /// A new instance for mocking. + public static OpenAIPageableListOfVectorStore OpenAIPageableListOfVectorStore(OpenAIPageableListOfVectorStoreObject @object = default, IEnumerable data = null, string firstId = null, string lastId = null, bool hasMore = default) + { + data ??= new List(); + + return new OpenAIPageableListOfVectorStore( + @object, + data?.ToList(), + firstId, + lastId, + hasMore, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The identifier, which can be referenced in API endpoints. + /// The object type, which is always `vector_store`. + /// The Unix timestamp (in seconds) for when the vector store was created. + /// The name of the vector store. + /// The total number of bytes used by the files in the vector store. + /// Files count grouped by status processed or being processed by this vector store. + /// The status of the vector store, which can be either `expired`, `in_progress`, or `completed`. A status of `completed` indicates that the vector store is ready for use. + /// Details on when this vector store expires. + /// The Unix timestamp (in seconds) for when the vector store will expire. + /// The Unix timestamp (in seconds) for when the vector store was last active. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// A new instance for mocking. + public static VectorStore VectorStore(string id = null, VectorStoreObject @object = default, DateTimeOffset createdAt = default, string name = null, int usageBytes = default, VectorStoreFileCount fileCounts = null, VectorStoreStatus status = default, VectorStoreExpirationPolicy expiresAfter = null, DateTimeOffset? expiresAt = null, DateTimeOffset? lastActiveAt = null, IReadOnlyDictionary metadata = null) + { + metadata ??= new Dictionary(); + + return new VectorStore( + id, + @object, + createdAt, + name, + usageBytes, + fileCounts, + status, + expiresAfter, + expiresAt, + lastActiveAt, + metadata, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The number of files that are currently being processed. + /// The number of files that have been successfully processed. + /// The number of files that have failed to process. + /// The number of files that were cancelled. + /// The total number of files. + /// A new instance for mocking. + public static VectorStoreFileCount VectorStoreFileCount(int inProgress = default, int completed = default, int failed = default, int cancelled = default, int total = default) + { + return new VectorStoreFileCount( + inProgress, + completed, + failed, + cancelled, + total, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The options for the static chunking strategy. + /// A new instance for mocking. + public static VectorStoreStaticChunkingStrategyRequest VectorStoreStaticChunkingStrategyRequest(VectorStoreStaticChunkingStrategyOptions @static = null) + { + return new VectorStoreStaticChunkingStrategyRequest(VectorStoreChunkingStrategyRequestType.Static, serializedAdditionalRawData: null, @static); + } + + /// Initializes a new instance of . + /// The ID of the resource specified for deletion. + /// A value indicating whether deletion was successful. + /// The object type, which is always 'vector_store.deleted'. + /// A new instance for mocking. + public static VectorStoreDeletionStatus VectorStoreDeletionStatus(string id = null, bool deleted = default, VectorStoreDeletionStatusObject @object = default) + { + return new VectorStoreDeletionStatus(id, deleted, @object, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The object type, which is always list. + /// The requested list of items. + /// The first ID represented in this list. + /// The last ID represented in this list. + /// A value indicating whether there are additional values available not captured in this list. + /// A new instance for mocking. + public static OpenAIPageableListOfVectorStoreFile OpenAIPageableListOfVectorStoreFile(OpenAIPageableListOfVectorStoreFileObject @object = default, IEnumerable data = null, string firstId = null, string lastId = null, bool hasMore = default) + { + data ??= new List(); + + return new OpenAIPageableListOfVectorStoreFile( + @object, + data?.ToList(), + firstId, + lastId, + hasMore, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The identifier, which can be referenced in API endpoints. + /// The object type, which is always `vector_store.file`. + /// + /// The total vector store usage in bytes. Note that this may be different from the original file + /// size. + /// + /// The Unix timestamp (in seconds) for when the vector store file was created. + /// The ID of the vector store that the file is attached to. + /// The status of the vector store file, which can be either `in_progress`, `completed`, `cancelled`, or `failed`. The status `completed` indicates that the vector store file is ready for use. + /// The last error associated with this vector store file. Will be `null` if there are no errors. + /// + /// The strategy used to chunk the file. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// A new instance for mocking. + public static VectorStoreFile VectorStoreFile(string id = null, VectorStoreFileObject @object = default, int usageBytes = default, DateTimeOffset createdAt = default, string vectorStoreId = null, VectorStoreFileStatus status = default, VectorStoreFileError lastError = null, VectorStoreChunkingStrategyResponse chunkingStrategy = null) + { + return new VectorStoreFile( + id, + @object, + usageBytes, + createdAt, + vectorStoreId, + status, + lastError, + chunkingStrategy, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// One of `server_error` or `rate_limit_exceeded`. + /// A human-readable description of the error. + /// A new instance for mocking. + public static VectorStoreFileError VectorStoreFileError(VectorStoreFileErrorCode code = default, string message = null) + { + return new VectorStoreFileError(code, message, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The options for the static chunking strategy. + /// A new instance for mocking. + public static VectorStoreStaticChunkingStrategyResponse VectorStoreStaticChunkingStrategyResponse(VectorStoreStaticChunkingStrategyOptions @static = null) + { + return new VectorStoreStaticChunkingStrategyResponse(VectorStoreChunkingStrategyResponseType.Static, serializedAdditionalRawData: null, @static); + } + + /// Initializes a new instance of . + /// The ID of the resource specified for deletion. + /// A value indicating whether deletion was successful. + /// The object type, which is always 'vector_store.deleted'. + /// A new instance for mocking. + public static VectorStoreFileDeletionStatus VectorStoreFileDeletionStatus(string id = null, bool deleted = default, VectorStoreFileDeletionStatusObject @object = default) + { + return new VectorStoreFileDeletionStatus(id, deleted, @object, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The identifier, which can be referenced in API endpoints. + /// The object type, which is always `vector_store.file_batch`. + /// The Unix timestamp (in seconds) for when the vector store files batch was created. + /// The ID of the vector store that the file is attached to. + /// The status of the vector store files batch, which can be either `in_progress`, `completed`, `cancelled` or `failed`. + /// Files count grouped by status processed or being processed by this vector store. + /// A new instance for mocking. + public static VectorStoreFileBatch VectorStoreFileBatch(string id = null, VectorStoreFileBatchObject @object = default, DateTimeOffset createdAt = default, string vectorStoreId = null, VectorStoreFileBatchStatus status = default, VectorStoreFileCount fileCounts = null) + { + return new VectorStoreFileBatch( + id, + @object, + createdAt, + vectorStoreId, + status, + fileCounts, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The identifier of the message, which can be referenced in API endpoints. + /// The object type, which is always `thread.message.delta`. + /// The delta containing the fields that have changed on the Message. + /// A new instance for mocking. + public static MessageDeltaChunk MessageDeltaChunk(string id = null, MessageDeltaChunkObject @object = default, MessageDelta delta = null) + { + return new MessageDeltaChunk(id, @object, delta, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The entity that produced the message. + /// + /// The content of the message as an array of text and/or images. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// A new instance for mocking. + public static MessageDelta MessageDelta(MessageRole role = default, IEnumerable content = null) + { + content ??= new List(); + + return new MessageDelta(role, content?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The index of the content part of the message. + /// The type of content for this content part. + /// A new instance for mocking. + public static MessageDeltaContent MessageDeltaContent(int index = default, string type = null) + { + return new UnknownMessageDeltaContent(index, type, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The index of the content part of the message. + /// The image_file data. + /// A new instance for mocking. + public static MessageDeltaImageFileContent MessageDeltaImageFileContent(int index = default, MessageDeltaImageFileContentObject imageFile = null) + { + return new MessageDeltaImageFileContent(index, "image_file", serializedAdditionalRawData: null, imageFile); + } + + /// Initializes a new instance of . + /// The file ID of the image in the message content. + /// A new instance for mocking. + public static MessageDeltaImageFileContentObject MessageDeltaImageFileContentObject(string fileId = null) + { + return new MessageDeltaImageFileContentObject(fileId, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The index of the content part of the message. + /// The text content details. + /// A new instance for mocking. + public static MessageDeltaTextContent MessageDeltaTextContent(int index = default, MessageDeltaTextContentObject text = null) + { + return new MessageDeltaTextContent(index, "text", serializedAdditionalRawData: null, text); + } + + /// Initializes a new instance of . + /// The data that makes up the text. + /// + /// Annotations for the text. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// A new instance for mocking. + public static MessageDeltaTextContentObject MessageDeltaTextContentObject(string value = null, IEnumerable annotations = null) + { + annotations ??= new List(); + + return new MessageDeltaTextContentObject(value, annotations?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The index of the annotation within a text content part. + /// The type of the text content annotation. + /// A new instance for mocking. + public static MessageDeltaTextAnnotation MessageDeltaTextAnnotation(int index = default, string type = null) + { + return new UnknownMessageDeltaTextAnnotation(index, type, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The index of the annotation within a text content part. + /// The details of the URL citation. + /// The first text index associated with this text annotation. + /// The last text index associated with this text annotation. + /// A new instance for mocking. + public static MessageDeltaTextUrlCitationAnnotation MessageDeltaTextUrlCitationAnnotation(int index = default, MessageDeltaTextUrlCitationDetails urlCitation = null, int? startIndex = null, int? endIndex = null) + { + return new MessageDeltaTextUrlCitationAnnotation( + index, + "url_citation", + serializedAdditionalRawData: null, + urlCitation, + startIndex, + endIndex); + } + + /// Initializes a new instance of . + /// The URL associated with this citation. + /// The title of the URL. + /// A new instance for mocking. + public static MessageDeltaTextUrlCitationDetails MessageDeltaTextUrlCitationDetails(string url = null, string title = null) + { + return new MessageDeltaTextUrlCitationDetails(url, title, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The index of the annotation within a text content part. + /// The file citation information. + /// The text in the message content that needs to be replaced. + /// The start index of this annotation in the content text. + /// The end index of this annotation in the content text. + /// A new instance for mocking. + public static MessageDeltaTextFileCitationAnnotation MessageDeltaTextFileCitationAnnotation(int index = default, MessageDeltaTextFileCitationAnnotationObject fileCitation = null, string text = null, int? startIndex = null, int? endIndex = null) + { + return new MessageDeltaTextFileCitationAnnotation( + index, + "file_citation", + serializedAdditionalRawData: null, + fileCitation, + text, + startIndex, + endIndex); + } + + /// Initializes a new instance of . + /// The ID of the specific file the citation is from. + /// The specific quote in the cited file. + /// A new instance for mocking. + public static MessageDeltaTextFileCitationAnnotationObject MessageDeltaTextFileCitationAnnotationObject(string fileId = null, string quote = null) + { + return new MessageDeltaTextFileCitationAnnotationObject(fileId, quote, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The index of the annotation within a text content part. + /// The file path information. + /// The start index of this annotation in the content text. + /// The end index of this annotation in the content text. + /// The text in the message content that needs to be replaced. + /// A new instance for mocking. + public static MessageDeltaTextFilePathAnnotation MessageDeltaTextFilePathAnnotation(int index = default, MessageDeltaTextFilePathAnnotationObject filePath = null, int? startIndex = null, int? endIndex = null, string text = null) + { + return new MessageDeltaTextFilePathAnnotation( + index, + "file_path", + serializedAdditionalRawData: null, + filePath, + startIndex, + endIndex, + text); + } + + /// Initializes a new instance of . + /// The file ID for the annotation. + /// A new instance for mocking. + public static MessageDeltaTextFilePathAnnotationObject MessageDeltaTextFilePathAnnotationObject(string fileId = null) + { + return new MessageDeltaTextFilePathAnnotationObject(fileId, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The identifier of the run step, which can be referenced in API endpoints. + /// The object type, which is always `thread.run.step.delta`. + /// The delta containing the fields that have changed on the run step. + /// A new instance for mocking. + public static RunStepDeltaChunk RunStepDeltaChunk(string id = null, RunStepDeltaChunkObject @object = default, RunStepDelta delta = null) + { + return new RunStepDeltaChunk(id, @object, delta, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// + /// The details of the run step. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// A new instance for mocking. + public static RunStepDelta RunStepDelta(RunStepDeltaDetail stepDetails = null) + { + return new RunStepDelta(stepDetails, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The message creation data. + /// A new instance for mocking. + public static RunStepDeltaMessageCreation RunStepDeltaMessageCreation(RunStepDeltaMessageCreationObject messageCreation = null) + { + return new RunStepDeltaMessageCreation("message_creation", serializedAdditionalRawData: null, messageCreation); + } + + /// Initializes a new instance of . + /// The ID of the newly-created message. + /// A new instance for mocking. + public static RunStepDeltaMessageCreationObject RunStepDeltaMessageCreationObject(string messageId = null) + { + return new RunStepDeltaMessageCreationObject(messageId, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// + /// The collection of tool calls for the tool call detail item. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// A new instance for mocking. + public static RunStepDeltaToolCallObject RunStepDeltaToolCallObject(IEnumerable toolCalls = null) + { + toolCalls ??= new List(); + + return new RunStepDeltaToolCallObject("tool_calls", serializedAdditionalRawData: null, toolCalls?.ToList()); + } + + /// Initializes a new instance of . + /// The index of the tool call detail in the run step's tool_calls array. + /// The ID of the tool call, used when submitting outputs to the run. + /// The type of the tool call detail item in a streaming run step's details. + /// A new instance for mocking. + public static RunStepDeltaToolCall RunStepDeltaToolCall(int index = default, string id = null, string type = null) + { + return new UnknownRunStepDeltaToolCall(index, id, type, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The index of the tool call detail in the run step's tool_calls array. + /// The ID of the tool call, used when submitting outputs to the run. + /// The function data for the tool call. + /// A new instance for mocking. + public static RunStepDeltaFunctionToolCall RunStepDeltaFunctionToolCall(int index = default, string id = null, RunStepDeltaFunction function = null) + { + return new RunStepDeltaFunctionToolCall(index, id, "function", serializedAdditionalRawData: null, function); + } + + /// Initializes a new instance of . + /// The name of the function. + /// The arguments passed to the function as input. + /// The output of the function, null if outputs have not yet been submitted. + /// A new instance for mocking. + public static RunStepDeltaFunction RunStepDeltaFunction(string name = null, string arguments = null, string output = null) + { + return new RunStepDeltaFunction(name, arguments, output, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The index of the tool call detail in the run step's tool_calls array. + /// The ID of the tool call, used when submitting outputs to the run. + /// Reserved for future use. + /// A new instance for mocking. + public static RunStepDeltaFileSearchToolCall RunStepDeltaFileSearchToolCall(int index = default, string id = null, RunStepFileSearchToolCallResults fileSearch = null) + { + return new RunStepDeltaFileSearchToolCall(index, id, "file_search", serializedAdditionalRawData: null, fileSearch); + } + + /// Initializes a new instance of . + /// The index of the tool call detail in the run step's tool_calls array. + /// The ID of the tool call, used when submitting outputs to the run. + /// The Code Interpreter data for the tool call. + /// A new instance for mocking. + public static RunStepDeltaCodeInterpreterToolCall RunStepDeltaCodeInterpreterToolCall(int index = default, string id = null, RunStepDeltaCodeInterpreterDetailItemObject codeInterpreter = null) + { + return new RunStepDeltaCodeInterpreterToolCall(index, id, "code_interpreter", serializedAdditionalRawData: null, codeInterpreter); + } + + /// Initializes a new instance of . + /// The input into the Code Interpreter tool call. + /// + /// The outputs from the Code Interpreter tool call. Code Interpreter can output one or more + /// items, including text (`logs`) or images (`image`). Each of these are represented by a + /// different object type. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// A new instance for mocking. + public static RunStepDeltaCodeInterpreterDetailItemObject RunStepDeltaCodeInterpreterDetailItemObject(string input = null, IEnumerable outputs = null) + { + outputs ??= new List(); + + return new RunStepDeltaCodeInterpreterDetailItemObject(input, outputs?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The index of the output in the streaming run step tool call's Code Interpreter outputs array. + /// The type of the streaming run step tool call's Code Interpreter output. + /// A new instance for mocking. + public static RunStepDeltaCodeInterpreterOutput RunStepDeltaCodeInterpreterOutput(int index = default, string type = null) + { + return new UnknownRunStepDeltaCodeInterpreterOutput(index, type, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The index of the output in the streaming run step tool call's Code Interpreter outputs array. + /// The text output from the Code Interpreter tool call. + /// A new instance for mocking. + public static RunStepDeltaCodeInterpreterLogOutput RunStepDeltaCodeInterpreterLogOutput(int index = default, string logs = null) + { + return new RunStepDeltaCodeInterpreterLogOutput(index, "logs", serializedAdditionalRawData: null, logs); + } + + /// Initializes a new instance of . + /// The index of the output in the streaming run step tool call's Code Interpreter outputs array. + /// The image data for the Code Interpreter tool call output. + /// A new instance for mocking. + public static RunStepDeltaCodeInterpreterImageOutput RunStepDeltaCodeInterpreterImageOutput(int index = default, RunStepDeltaCodeInterpreterImageOutputObject image = null) + { + return new RunStepDeltaCodeInterpreterImageOutput(index, "image", serializedAdditionalRawData: null, image); + } + + /// Initializes a new instance of . + /// The file ID for the image. + /// A new instance for mocking. + public static RunStepDeltaCodeInterpreterImageOutputObject RunStepDeltaCodeInterpreterImageOutputObject(string fileId = null) + { + return new RunStepDeltaCodeInterpreterImageOutputObject(fileId, serializedAdditionalRawData: null); + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AISearchIndexResource.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AISearchIndexResource.Serialization.cs new file mode 100644 index 000000000000..70ace5bf3e5b --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AISearchIndexResource.Serialization.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class AISearchIndexResource : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AISearchIndexResource)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("index_connection_id"u8); + writer.WriteStringValue(IndexConnectionId); + writer.WritePropertyName("index_name"u8); + writer.WriteStringValue(IndexName); + if (Optional.IsDefined(QueryType)) + { + writer.WritePropertyName("query_type"u8); + writer.WriteStringValue(QueryType.Value.ToString()); + } + if (Optional.IsDefined(TopK)) + { + writer.WritePropertyName("top_k"u8); + writer.WriteNumberValue(TopK.Value); + } + if (Optional.IsDefined(Filter)) + { + writer.WritePropertyName("filter"u8); + writer.WriteStringValue(Filter); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AISearchIndexResource IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AISearchIndexResource)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAISearchIndexResource(document.RootElement, options); + } + + internal static AISearchIndexResource DeserializeAISearchIndexResource(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string indexConnectionId = default; + string indexName = default; + AzureAISearchQueryType? queryType = default; + int? topK = default; + string filter = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("index_connection_id"u8)) + { + indexConnectionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("index_name"u8)) + { + indexName = property.Value.GetString(); + continue; + } + if (property.NameEquals("query_type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + queryType = new AzureAISearchQueryType(property.Value.GetString()); + continue; + } + if (property.NameEquals("top_k"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + topK = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("filter"u8)) + { + filter = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AISearchIndexResource( + indexConnectionId, + indexName, + queryType, + topK, + filter, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AISearchIndexResource)} does not support writing '{options.Format}' format."); + } + } + + AISearchIndexResource IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAISearchIndexResource(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AISearchIndexResource)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AISearchIndexResource FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAISearchIndexResource(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AISearchIndexResource.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AISearchIndexResource.cs new file mode 100644 index 000000000000..aff5bdab67b6 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AISearchIndexResource.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// A AI Search Index resource. + public partial class AISearchIndexResource + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// An index connection id in an IndexResource attached to this agent. + /// The name of an index in an IndexResource attached to this agent. + /// or is null. + public AISearchIndexResource(string indexConnectionId, string indexName) + { + Argument.AssertNotNull(indexConnectionId, nameof(indexConnectionId)); + Argument.AssertNotNull(indexName, nameof(indexName)); + + IndexConnectionId = indexConnectionId; + IndexName = indexName; + } + + /// Initializes a new instance of . + /// An index connection id in an IndexResource attached to this agent. + /// The name of an index in an IndexResource attached to this agent. + /// Type of query in an AIIndexResource attached to this agent. + /// Number of documents to retrieve from search and present to the model. + /// Odata filter string for search resource. + /// Keeps track of any properties unknown to the library. + internal AISearchIndexResource(string indexConnectionId, string indexName, AzureAISearchQueryType? queryType, int? topK, string filter, IDictionary serializedAdditionalRawData) + { + IndexConnectionId = indexConnectionId; + IndexName = indexName; + QueryType = queryType; + TopK = topK; + Filter = filter; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AISearchIndexResource() + { + } + + /// An index connection id in an IndexResource attached to this agent. + public string IndexConnectionId { get; set; } + /// The name of an index in an IndexResource attached to this agent. + public string IndexName { get; set; } + /// Type of query in an AIIndexResource attached to this agent. + public AzureAISearchQueryType? QueryType { get; set; } + /// Number of documents to retrieve from search and present to the model. + public int? TopK { get; set; } + /// Odata filter string for search resource. + public string Filter { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/Agent.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/Agent.Serialization.cs new file mode 100644 index 000000000000..22f988e86e8f --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/Agent.Serialization.cs @@ -0,0 +1,379 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class Agent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Agent)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("object"u8); + writer.WriteStringValue(Object.ToString()); + writer.WritePropertyName("created_at"u8); + writer.WriteNumberValue(CreatedAt, "U"); + if (Name != null) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + else + { + writer.WriteNull("name"); + } + if (Description != null) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + else + { + writer.WriteNull("description"); + } + writer.WritePropertyName("model"u8); + writer.WriteStringValue(Model); + if (Instructions != null) + { + writer.WritePropertyName("instructions"u8); + writer.WriteStringValue(Instructions); + } + else + { + writer.WriteNull("instructions"); + } + writer.WritePropertyName("tools"u8); + writer.WriteStartArray(); + foreach (var item in Tools) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (ToolResources != null) + { + writer.WritePropertyName("tool_resources"u8); + writer.WriteObjectValue(ToolResources, options); + } + else + { + writer.WriteNull("tool_resources"); + } + if (Temperature != null) + { + writer.WritePropertyName("temperature"u8); + writer.WriteNumberValue(Temperature.Value); + } + else + { + writer.WriteNull("temperature"); + } + if (TopP != null) + { + writer.WritePropertyName("top_p"u8); + writer.WriteNumberValue(TopP.Value); + } + else + { + writer.WriteNull("top_p"); + } + if (Optional.IsDefined(ResponseFormat)) + { + if (ResponseFormat != null) + { + writer.WritePropertyName("response_format"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(ResponseFormat); +#else + using (JsonDocument document = JsonDocument.Parse(ResponseFormat, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + else + { + writer.WriteNull("response_format"); + } + } + if (Metadata != null && Optional.IsCollectionDefined(Metadata)) + { + writer.WritePropertyName("metadata"u8); + writer.WriteStartObject(); + foreach (var item in Metadata) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + else + { + writer.WriteNull("metadata"); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + Agent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Agent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAgent(document.RootElement, options); + } + + internal static Agent DeserializeAgent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + AgentObject @object = default; + DateTimeOffset createdAt = default; + string name = default; + string description = default; + string model = default; + string instructions = default; + IReadOnlyList tools = default; + ToolResources toolResources = default; + float? temperature = default; + float? topP = default; + BinaryData responseFormat = default; + IReadOnlyDictionary metadata = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("object"u8)) + { + @object = new AgentObject(property.Value.GetString()); + continue; + } + if (property.NameEquals("created_at"u8)) + { + createdAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); + continue; + } + if (property.NameEquals("name"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + name = null; + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + description = null; + continue; + } + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("model"u8)) + { + model = property.Value.GetString(); + continue; + } + if (property.NameEquals("instructions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + instructions = null; + continue; + } + instructions = property.Value.GetString(); + continue; + } + if (property.NameEquals("tools"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ToolDefinition.DeserializeToolDefinition(item, options)); + } + tools = array; + continue; + } + if (property.NameEquals("tool_resources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + toolResources = null; + continue; + } + toolResources = ToolResources.DeserializeToolResources(property.Value, options); + continue; + } + if (property.NameEquals("temperature"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + temperature = null; + continue; + } + temperature = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("top_p"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + topP = null; + continue; + } + topP = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("response_format"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + responseFormat = null; + continue; + } + responseFormat = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + metadata = new ChangeTrackingDictionary(); + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + metadata = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Agent( + id, + @object, + createdAt, + name, + description, + model, + instructions, + tools, + toolResources, + temperature, + topP, + responseFormat, + metadata, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(Agent)} does not support writing '{options.Format}' format."); + } + } + + Agent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAgent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Agent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static Agent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAgent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/Agent.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/Agent.cs new file mode 100644 index 000000000000..da9117a207f3 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/Agent.cs @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Assistants +{ + /// Represents an agent that can call the model and use tools. + public partial class Agent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The identifier, which can be referenced in API endpoints. + /// The Unix timestamp, in seconds, representing when this object was created. + /// The name of the agent. + /// The description of the agent. + /// The ID of the model to use. + /// The system instructions for the agent to use. + /// + /// The collection of tools enabled for the agent. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , and . + /// + /// + /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, the `code_interpreter` + /// tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. + /// + /// + /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, + /// while lower values like 0.2 will make it more focused and deterministic. + /// + /// + /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. + /// So 0.1 means only the tokens comprising the top 10% probability mass are considered. + /// + /// We generally recommend altering this or temperature but not both. + /// + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// , or is null. + internal Agent(string id, DateTimeOffset createdAt, string name, string description, string model, string instructions, IEnumerable tools, ToolResources toolResources, float? temperature, float? topP, IReadOnlyDictionary metadata) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(model, nameof(model)); + Argument.AssertNotNull(tools, nameof(tools)); + + Id = id; + CreatedAt = createdAt; + Name = name; + Description = description; + Model = model; + Instructions = instructions; + Tools = tools.ToList(); + ToolResources = toolResources; + Temperature = temperature; + TopP = topP; + Metadata = metadata; + } + + /// Initializes a new instance of . + /// The identifier, which can be referenced in API endpoints. + /// The object type, which is always assistant. + /// The Unix timestamp, in seconds, representing when this object was created. + /// The name of the agent. + /// The description of the agent. + /// The ID of the model to use. + /// The system instructions for the agent to use. + /// + /// The collection of tools enabled for the agent. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , and . + /// + /// + /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, the `code_interpreter` + /// tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. + /// + /// + /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, + /// while lower values like 0.2 will make it more focused and deterministic. + /// + /// + /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. + /// So 0.1 means only the tokens comprising the top 10% probability mass are considered. + /// + /// We generally recommend altering this or temperature but not both. + /// + /// The response format of the tool calls used by this agent. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// Keeps track of any properties unknown to the library. + internal Agent(string id, AgentObject @object, DateTimeOffset createdAt, string name, string description, string model, string instructions, IReadOnlyList tools, ToolResources toolResources, float? temperature, float? topP, BinaryData responseFormat, IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) + { + Id = id; + Object = @object; + CreatedAt = createdAt; + Name = name; + Description = description; + Model = model; + Instructions = instructions; + Tools = tools; + ToolResources = toolResources; + Temperature = temperature; + TopP = topP; + ResponseFormat = responseFormat; + Metadata = metadata; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal Agent() + { + } + + /// The identifier, which can be referenced in API endpoints. + public string Id { get; } + /// The object type, which is always assistant. + public AgentObject Object { get; } = AgentObject.Assistant; + + /// The Unix timestamp, in seconds, representing when this object was created. + public DateTimeOffset CreatedAt { get; } + /// The name of the agent. + public string Name { get; } + /// The description of the agent. + public string Description { get; } + /// The ID of the model to use. + public string Model { get; } + /// The system instructions for the agent to use. + public string Instructions { get; } + /// + /// The collection of tools enabled for the agent. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , and . + /// + public IReadOnlyList Tools { get; } + /// + /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, the `code_interpreter` + /// tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. + /// + public ToolResources ToolResources { get; } + /// + /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, + /// while lower values like 0.2 will make it more focused and deterministic. + /// + public float? Temperature { get; } + /// + /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. + /// So 0.1 means only the tokens comprising the top 10% probability mass are considered. + /// + /// We generally recommend altering this or temperature but not both. + /// + public float? TopP { get; } + /// + /// The response format of the tool calls used by this agent. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// + /// Supported types: + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + public BinaryData ResponseFormat { get; } + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + public IReadOnlyDictionary Metadata { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AgentObject.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AgentObject.cs new file mode 100644 index 000000000000..f792756cba80 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AgentObject.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// The Agent_object. + public readonly partial struct AgentObject : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AgentObject(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AssistantValue = "assistant"; + + /// assistant. + public static AgentObject Assistant { get; } = new AgentObject(AssistantValue); + /// Determines if two values are the same. + public static bool operator ==(AgentObject left, AgentObject right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AgentObject left, AgentObject right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AgentObject(string value) => new AgentObject(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AgentObject other && Equals(other); + /// + public bool Equals(AgentObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AgentStreamEvent.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AgentStreamEvent.cs new file mode 100644 index 000000000000..688f4a956dbe --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AgentStreamEvent.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// + /// Each event in a server-sent events stream has an `event` and `data` property: + /// + /// ``` + /// event: thread.created + /// data: {"id": "thread_123", "object": "thread", ...} + /// ``` + /// + /// We emit events whenever a new object is created, transitions to a new state, or is being + /// streamed in parts (deltas). For example, we emit `thread.run.created` when a new run + /// is created, `thread.run.completed` when a run completes, and so on. When an Agent chooses + /// to create a message during a run, we emit a `thread.message.created event`, a + /// `thread.message.in_progress` event, many `thread.message.delta` events, and finally a + /// `thread.message.completed` event. + /// + /// We may add additional events over time, so we recommend handling unknown events gracefully + /// in your code. + /// + public readonly partial struct AgentStreamEvent : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AgentStreamEvent(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ThreadCreatedValue = "thread.created"; + private const string ThreadRunCreatedValue = "thread.run.created"; + private const string ThreadRunQueuedValue = "thread.run.queued"; + private const string ThreadRunInProgressValue = "thread.run.in_progress"; + private const string ThreadRunRequiresActionValue = "thread.run.requires_action"; + private const string ThreadRunCompletedValue = "thread.run.completed"; + private const string ThreadRunIncompleteValue = "thread.run.incomplete"; + private const string ThreadRunFailedValue = "thread.run.failed"; + private const string ThreadRunCancellingValue = "thread.run.cancelling"; + private const string ThreadRunCancelledValue = "thread.run.cancelled"; + private const string ThreadRunExpiredValue = "thread.run.expired"; + private const string ThreadRunStepCreatedValue = "thread.run.step.created"; + private const string ThreadRunStepInProgressValue = "thread.run.step.in_progress"; + private const string ThreadRunStepDeltaValue = "thread.run.step.delta"; + private const string ThreadRunStepCompletedValue = "thread.run.step.completed"; + private const string ThreadRunStepFailedValue = "thread.run.step.failed"; + private const string ThreadRunStepCancelledValue = "thread.run.step.cancelled"; + private const string ThreadRunStepExpiredValue = "thread.run.step.expired"; + private const string ThreadMessageCreatedValue = "thread.message.created"; + private const string ThreadMessageInProgressValue = "thread.message.in_progress"; + private const string ThreadMessageDeltaValue = "thread.message.delta"; + private const string ThreadMessageCompletedValue = "thread.message.completed"; + private const string ThreadMessageIncompleteValue = "thread.message.incomplete"; + private const string ErrorValue = "error"; + private const string DoneValue = "done"; + + /// Event sent when a new thread is created. The data of this event is of type AgentThread. + public static AgentStreamEvent ThreadCreated { get; } = new AgentStreamEvent(ThreadCreatedValue); + /// Event sent when a new run is created. The data of this event is of type ThreadRun. + public static AgentStreamEvent ThreadRunCreated { get; } = new AgentStreamEvent(ThreadRunCreatedValue); + /// Event sent when a run moves to `queued` status. The data of this event is of type ThreadRun. + public static AgentStreamEvent ThreadRunQueued { get; } = new AgentStreamEvent(ThreadRunQueuedValue); + /// Event sent when a run moves to `in_progress` status. The data of this event is of type ThreadRun. + public static AgentStreamEvent ThreadRunInProgress { get; } = new AgentStreamEvent(ThreadRunInProgressValue); + /// Event sent when a run moves to `requires_action` status. The data of this event is of type ThreadRun. + public static AgentStreamEvent ThreadRunRequiresAction { get; } = new AgentStreamEvent(ThreadRunRequiresActionValue); + /// Event sent when a run is completed. The data of this event is of type ThreadRun. + public static AgentStreamEvent ThreadRunCompleted { get; } = new AgentStreamEvent(ThreadRunCompletedValue); + /// Event sent when a run ends incomplete. The data of this event is of type ThreadRun. + public static AgentStreamEvent ThreadRunIncomplete { get; } = new AgentStreamEvent(ThreadRunIncompleteValue); + /// Event sent when a run fails. The data of this event is of type ThreadRun. + public static AgentStreamEvent ThreadRunFailed { get; } = new AgentStreamEvent(ThreadRunFailedValue); + /// Event sent when a run moves to `cancelling` status. The data of this event is of type ThreadRun. + public static AgentStreamEvent ThreadRunCancelling { get; } = new AgentStreamEvent(ThreadRunCancellingValue); + /// Event sent when a run is cancelled. The data of this event is of type ThreadRun. + public static AgentStreamEvent ThreadRunCancelled { get; } = new AgentStreamEvent(ThreadRunCancelledValue); + /// Event sent when a run is expired. The data of this event is of type ThreadRun. + public static AgentStreamEvent ThreadRunExpired { get; } = new AgentStreamEvent(ThreadRunExpiredValue); + /// Event sent when a new thread run step is created. The data of this event is of type RunStep. + public static AgentStreamEvent ThreadRunStepCreated { get; } = new AgentStreamEvent(ThreadRunStepCreatedValue); + /// Event sent when a run step moves to `in_progress` status. The data of this event is of type RunStep. + public static AgentStreamEvent ThreadRunStepInProgress { get; } = new AgentStreamEvent(ThreadRunStepInProgressValue); + /// Event sent when a run step is being streamed. The data of this event is of type RunStepDeltaChunk. + public static AgentStreamEvent ThreadRunStepDelta { get; } = new AgentStreamEvent(ThreadRunStepDeltaValue); + /// Event sent when a run step is completed. The data of this event is of type RunStep. + public static AgentStreamEvent ThreadRunStepCompleted { get; } = new AgentStreamEvent(ThreadRunStepCompletedValue); + /// Event sent when a run step fails. The data of this event is of type RunStep. + public static AgentStreamEvent ThreadRunStepFailed { get; } = new AgentStreamEvent(ThreadRunStepFailedValue); + /// Event sent when a run step is cancelled. The data of this event is of type RunStep. + public static AgentStreamEvent ThreadRunStepCancelled { get; } = new AgentStreamEvent(ThreadRunStepCancelledValue); + /// Event sent when a run step is expired. The data of this event is of type RunStep. + public static AgentStreamEvent ThreadRunStepExpired { get; } = new AgentStreamEvent(ThreadRunStepExpiredValue); + /// Event sent when a new message is created. The data of this event is of type ThreadMessage. + public static AgentStreamEvent ThreadMessageCreated { get; } = new AgentStreamEvent(ThreadMessageCreatedValue); + /// Event sent when a message moves to `in_progress` status. The data of this event is of type ThreadMessage. + public static AgentStreamEvent ThreadMessageInProgress { get; } = new AgentStreamEvent(ThreadMessageInProgressValue); + /// Event sent when a message is being streamed. The data of this event is of type MessageDeltaChunk. + public static AgentStreamEvent ThreadMessageDelta { get; } = new AgentStreamEvent(ThreadMessageDeltaValue); + /// Event sent when a message is completed. The data of this event is of type ThreadMessage. + public static AgentStreamEvent ThreadMessageCompleted { get; } = new AgentStreamEvent(ThreadMessageCompletedValue); + /// Event sent before a message is completed. The data of this event is of type ThreadMessage. + public static AgentStreamEvent ThreadMessageIncomplete { get; } = new AgentStreamEvent(ThreadMessageIncompleteValue); + /// Event sent when an error occurs, such as an internal server error or a timeout. + public static AgentStreamEvent Error { get; } = new AgentStreamEvent(ErrorValue); + /// Event sent when the stream is done. + public static AgentStreamEvent Done { get; } = new AgentStreamEvent(DoneValue); + /// Determines if two values are the same. + public static bool operator ==(AgentStreamEvent left, AgentStreamEvent right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AgentStreamEvent left, AgentStreamEvent right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AgentStreamEvent(string value) => new AgentStreamEvent(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AgentStreamEvent other && Equals(other); + /// + public bool Equals(AgentStreamEvent other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AgentThread.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AgentThread.Serialization.cs new file mode 100644 index 000000000000..433c63bc977b --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AgentThread.Serialization.cs @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class AgentThread : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AgentThread)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("object"u8); + writer.WriteStringValue(Object.ToString()); + writer.WritePropertyName("created_at"u8); + writer.WriteNumberValue(CreatedAt, "U"); + if (ToolResources != null) + { + writer.WritePropertyName("tool_resources"u8); + writer.WriteObjectValue(ToolResources, options); + } + else + { + writer.WriteNull("tool_resources"); + } + if (Metadata != null && Optional.IsCollectionDefined(Metadata)) + { + writer.WritePropertyName("metadata"u8); + writer.WriteStartObject(); + foreach (var item in Metadata) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + else + { + writer.WriteNull("metadata"); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AgentThread IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AgentThread)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAgentThread(document.RootElement, options); + } + + internal static AgentThread DeserializeAgentThread(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + AgentThreadObject @object = default; + DateTimeOffset createdAt = default; + ToolResources toolResources = default; + IReadOnlyDictionary metadata = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("object"u8)) + { + @object = new AgentThreadObject(property.Value.GetString()); + continue; + } + if (property.NameEquals("created_at"u8)) + { + createdAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); + continue; + } + if (property.NameEquals("tool_resources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + toolResources = null; + continue; + } + toolResources = ToolResources.DeserializeToolResources(property.Value, options); + continue; + } + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + metadata = new ChangeTrackingDictionary(); + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + metadata = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AgentThread( + id, + @object, + createdAt, + toolResources, + metadata, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AgentThread)} does not support writing '{options.Format}' format."); + } + } + + AgentThread IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAgentThread(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AgentThread)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AgentThread FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAgentThread(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AgentThread.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AgentThread.cs new file mode 100644 index 000000000000..f3054ec16162 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AgentThread.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Information about a single thread associated with an agent. + public partial class AgentThread + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The identifier, which can be referenced in API endpoints. + /// The Unix timestamp, in seconds, representing when this object was created. + /// + /// A set of resources that are made available to the agent's tools in this thread. The resources are specific to the type + /// of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list + /// of vector store IDs. + /// + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// is null. + internal AgentThread(string id, DateTimeOffset createdAt, ToolResources toolResources, IReadOnlyDictionary metadata) + { + Argument.AssertNotNull(id, nameof(id)); + + Id = id; + CreatedAt = createdAt; + ToolResources = toolResources; + Metadata = metadata; + } + + /// Initializes a new instance of . + /// The identifier, which can be referenced in API endpoints. + /// The object type, which is always 'thread'. + /// The Unix timestamp, in seconds, representing when this object was created. + /// + /// A set of resources that are made available to the agent's tools in this thread. The resources are specific to the type + /// of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list + /// of vector store IDs. + /// + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// Keeps track of any properties unknown to the library. + internal AgentThread(string id, AgentThreadObject @object, DateTimeOffset createdAt, ToolResources toolResources, IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) + { + Id = id; + Object = @object; + CreatedAt = createdAt; + ToolResources = toolResources; + Metadata = metadata; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AgentThread() + { + } + + /// The identifier, which can be referenced in API endpoints. + public string Id { get; } + /// The object type, which is always 'thread'. + public AgentThreadObject Object { get; } = AgentThreadObject.Thread; + + /// The Unix timestamp, in seconds, representing when this object was created. + public DateTimeOffset CreatedAt { get; } + /// + /// A set of resources that are made available to the agent's tools in this thread. The resources are specific to the type + /// of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list + /// of vector store IDs. + /// + public ToolResources ToolResources { get; } + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + public IReadOnlyDictionary Metadata { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AgentThreadCreationOptions.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AgentThreadCreationOptions.Serialization.cs new file mode 100644 index 000000000000..035f36ef7190 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AgentThreadCreationOptions.Serialization.cs @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class AgentThreadCreationOptions : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AgentThreadCreationOptions)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Messages)) + { + writer.WritePropertyName("messages"u8); + writer.WriteStartArray(); + foreach (var item in Messages) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(ToolResources)) + { + if (ToolResources != null) + { + writer.WritePropertyName("tool_resources"u8); + writer.WriteObjectValue(ToolResources, options); + } + else + { + writer.WriteNull("tool_resources"); + } + } + if (Optional.IsCollectionDefined(Metadata)) + { + if (Metadata != null) + { + writer.WritePropertyName("metadata"u8); + writer.WriteStartObject(); + foreach (var item in Metadata) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + else + { + writer.WriteNull("metadata"); + } + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AgentThreadCreationOptions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AgentThreadCreationOptions)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAgentThreadCreationOptions(document.RootElement, options); + } + + internal static AgentThreadCreationOptions DeserializeAgentThreadCreationOptions(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList messages = default; + ToolResources toolResources = default; + IDictionary metadata = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("messages"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ThreadMessageOptions.DeserializeThreadMessageOptions(item, options)); + } + messages = array; + continue; + } + if (property.NameEquals("tool_resources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + toolResources = null; + continue; + } + toolResources = ToolResources.DeserializeToolResources(property.Value, options); + continue; + } + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + metadata = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AgentThreadCreationOptions(messages ?? new ChangeTrackingList(), toolResources, metadata ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AgentThreadCreationOptions)} does not support writing '{options.Format}' format."); + } + } + + AgentThreadCreationOptions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAgentThreadCreationOptions(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AgentThreadCreationOptions)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AgentThreadCreationOptions FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAgentThreadCreationOptions(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AgentThreadCreationOptions.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AgentThreadCreationOptions.cs new file mode 100644 index 000000000000..8995349b0cb2 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AgentThreadCreationOptions.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The details used to create a new agent thread. + public partial class AgentThreadCreationOptions + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public AgentThreadCreationOptions() + { + Messages = new ChangeTrackingList(); + Metadata = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The initial messages to associate with the new thread. + /// + /// A set of resources that are made available to the agent's tools in this thread. The resources are specific to the + /// type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires + /// a list of vector store IDs. + /// + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// Keeps track of any properties unknown to the library. + internal AgentThreadCreationOptions(IList messages, ToolResources toolResources, IDictionary metadata, IDictionary serializedAdditionalRawData) + { + Messages = messages; + ToolResources = toolResources; + Metadata = metadata; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The initial messages to associate with the new thread. + public IList Messages { get; } + /// + /// A set of resources that are made available to the agent's tools in this thread. The resources are specific to the + /// type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires + /// a list of vector store IDs. + /// + public ToolResources ToolResources { get; set; } + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + public IDictionary Metadata { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AgentThreadObject.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AgentThreadObject.cs new file mode 100644 index 000000000000..c8060c90ff72 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AgentThreadObject.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// The AgentThread_object. + public readonly partial struct AgentThreadObject : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AgentThreadObject(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ThreadValue = "thread"; + + /// thread. + public static AgentThreadObject Thread { get; } = new AgentThreadObject(ThreadValue); + /// Determines if two values are the same. + public static bool operator ==(AgentThreadObject left, AgentThreadObject right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AgentThreadObject left, AgentThreadObject right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AgentThreadObject(string value) => new AgentThreadObject(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AgentThreadObject other && Equals(other); + /// + public bool Equals(AgentThreadObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AgentsApiResponseFormat.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AgentsApiResponseFormat.Serialization.cs new file mode 100644 index 000000000000..9a6b4f67d12e --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AgentsApiResponseFormat.Serialization.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class AgentsApiResponseFormat : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AgentsApiResponseFormat)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Type)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AgentsApiResponseFormat IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AgentsApiResponseFormat)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAgentsApiResponseFormat(document.RootElement, options); + } + + internal static AgentsApiResponseFormat DeserializeAgentsApiResponseFormat(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResponseFormat? type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new ResponseFormat(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AgentsApiResponseFormat(type, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AgentsApiResponseFormat)} does not support writing '{options.Format}' format."); + } + } + + AgentsApiResponseFormat IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAgentsApiResponseFormat(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AgentsApiResponseFormat)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AgentsApiResponseFormat FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAgentsApiResponseFormat(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AgentsApiResponseFormat.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AgentsApiResponseFormat.cs new file mode 100644 index 000000000000..6341ee5055bb --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AgentsApiResponseFormat.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// + /// An object describing the expected output of the model. If `json_object` only `function` type `tools` are allowed to be passed to the Run. + /// If `text` the model can return text or any value needed. + /// + public partial class AgentsApiResponseFormat + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public AgentsApiResponseFormat() + { + } + + /// Initializes a new instance of . + /// Must be one of `text` or `json_object`. + /// Keeps track of any properties unknown to the library. + internal AgentsApiResponseFormat(ResponseFormat? type, IDictionary serializedAdditionalRawData) + { + Type = type; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Must be one of `text` or `json_object`. + public ResponseFormat? Type { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AgentsApiResponseFormatMode.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AgentsApiResponseFormatMode.cs new file mode 100644 index 000000000000..da1202481d5d --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AgentsApiResponseFormatMode.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// Represents the mode in which the model will handle the return format of a tool call. + public readonly partial struct AgentsApiResponseFormatMode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AgentsApiResponseFormatMode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AutoValue = "auto"; + private const string NoneValue = "none"; + + /// Default value. Let the model handle the return format. + public static AgentsApiResponseFormatMode Auto { get; } = new AgentsApiResponseFormatMode(AutoValue); + /// Setting the value to `none`, will result in a 400 Bad request. + public static AgentsApiResponseFormatMode None { get; } = new AgentsApiResponseFormatMode(NoneValue); + /// Determines if two values are the same. + public static bool operator ==(AgentsApiResponseFormatMode left, AgentsApiResponseFormatMode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AgentsApiResponseFormatMode left, AgentsApiResponseFormatMode right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AgentsApiResponseFormatMode(string value) => new AgentsApiResponseFormatMode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AgentsApiResponseFormatMode other && Equals(other); + /// + public bool Equals(AgentsApiResponseFormatMode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AgentsApiToolChoiceOptionMode.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AgentsApiToolChoiceOptionMode.cs new file mode 100644 index 000000000000..52be907737a8 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AgentsApiToolChoiceOptionMode.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// Specifies how the tool choice will be used. + public readonly partial struct AgentsApiToolChoiceOptionMode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AgentsApiToolChoiceOptionMode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "none"; + private const string AutoValue = "auto"; + + /// The model will not call a function and instead generates a message. + public static AgentsApiToolChoiceOptionMode None { get; } = new AgentsApiToolChoiceOptionMode(NoneValue); + /// The model can pick between generating a message or calling a function. + public static AgentsApiToolChoiceOptionMode Auto { get; } = new AgentsApiToolChoiceOptionMode(AutoValue); + /// Determines if two values are the same. + public static bool operator ==(AgentsApiToolChoiceOptionMode left, AgentsApiToolChoiceOptionMode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AgentsApiToolChoiceOptionMode left, AgentsApiToolChoiceOptionMode right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AgentsApiToolChoiceOptionMode(string value) => new AgentsApiToolChoiceOptionMode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AgentsApiToolChoiceOptionMode other && Equals(other); + /// + public bool Equals(AgentsApiToolChoiceOptionMode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AgentsNamedToolChoice.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AgentsNamedToolChoice.Serialization.cs new file mode 100644 index 000000000000..42a01e3071e8 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AgentsNamedToolChoice.Serialization.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class AgentsNamedToolChoice : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AgentsNamedToolChoice)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type.ToString()); + if (Optional.IsDefined(Function)) + { + writer.WritePropertyName("function"u8); + writer.WriteObjectValue(Function, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AgentsNamedToolChoice IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AgentsNamedToolChoice)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAgentsNamedToolChoice(document.RootElement, options); + } + + internal static AgentsNamedToolChoice DeserializeAgentsNamedToolChoice(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AgentsNamedToolChoiceType type = default; + FunctionName function = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new AgentsNamedToolChoiceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("function"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + function = FunctionName.DeserializeFunctionName(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AgentsNamedToolChoice(type, function, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AgentsNamedToolChoice)} does not support writing '{options.Format}' format."); + } + } + + AgentsNamedToolChoice IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAgentsNamedToolChoice(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AgentsNamedToolChoice)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AgentsNamedToolChoice FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAgentsNamedToolChoice(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AgentsNamedToolChoice.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AgentsNamedToolChoice.cs new file mode 100644 index 000000000000..ae610dc35e30 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AgentsNamedToolChoice.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Specifies a tool the model should use. Use to force the model to call a specific tool. + public partial class AgentsNamedToolChoice + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// the type of tool. If type is `function`, the function name must be set. + public AgentsNamedToolChoice(AgentsNamedToolChoiceType type) + { + Type = type; + } + + /// Initializes a new instance of . + /// the type of tool. If type is `function`, the function name must be set. + /// The name of the function to call. + /// Keeps track of any properties unknown to the library. + internal AgentsNamedToolChoice(AgentsNamedToolChoiceType type, FunctionName function, IDictionary serializedAdditionalRawData) + { + Type = type; + Function = function; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AgentsNamedToolChoice() + { + } + + /// the type of tool. If type is `function`, the function name must be set. + public AgentsNamedToolChoiceType Type { get; set; } + /// The name of the function to call. + public FunctionName Function { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AgentsNamedToolChoiceType.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AgentsNamedToolChoiceType.cs new file mode 100644 index 000000000000..dbcf1e6d6a08 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AgentsNamedToolChoiceType.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// Available tool types for agents named tools. + public readonly partial struct AgentsNamedToolChoiceType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AgentsNamedToolChoiceType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string FunctionValue = "function"; + private const string CodeInterpreterValue = "code_interpreter"; + private const string FileSearchValue = "file_search"; + private const string BingGroundingValue = "bing_grounding"; + private const string MicrosoftFabricValue = "fabric_dataagent"; + private const string SharepointValue = "sharepoint_grounding"; + private const string AzureAISearchValue = "azure_ai_search"; + + /// Tool type `function`. + public static AgentsNamedToolChoiceType Function { get; } = new AgentsNamedToolChoiceType(FunctionValue); + /// Tool type `code_interpreter`. + public static AgentsNamedToolChoiceType CodeInterpreter { get; } = new AgentsNamedToolChoiceType(CodeInterpreterValue); + /// Tool type `file_search`. + public static AgentsNamedToolChoiceType FileSearch { get; } = new AgentsNamedToolChoiceType(FileSearchValue); + /// Tool type `bing_grounding`. + public static AgentsNamedToolChoiceType BingGrounding { get; } = new AgentsNamedToolChoiceType(BingGroundingValue); + /// Tool type `fabric_dataagent`. + public static AgentsNamedToolChoiceType MicrosoftFabric { get; } = new AgentsNamedToolChoiceType(MicrosoftFabricValue); + /// Tool type `sharepoint_grounding`. + public static AgentsNamedToolChoiceType Sharepoint { get; } = new AgentsNamedToolChoiceType(SharepointValue); + /// Tool type `azure_ai_search`. + public static AgentsNamedToolChoiceType AzureAISearch { get; } = new AgentsNamedToolChoiceType(AzureAISearchValue); + /// Determines if two values are the same. + public static bool operator ==(AgentsNamedToolChoiceType left, AgentsNamedToolChoiceType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AgentsNamedToolChoiceType left, AgentsNamedToolChoiceType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AgentsNamedToolChoiceType(string value) => new AgentsNamedToolChoiceType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AgentsNamedToolChoiceType other && Equals(other); + /// + public bool Equals(AgentsNamedToolChoiceType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AzureAISearchQueryType.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AzureAISearchQueryType.cs new file mode 100644 index 000000000000..069865dab98f --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AzureAISearchQueryType.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// Available query types for Azure AI Search tool. + public readonly partial struct AzureAISearchQueryType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AzureAISearchQueryType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SimpleValue = "simple"; + private const string SemanticValue = "semantic"; + private const string VectorValue = "vector"; + private const string VectorSimpleHybridValue = "vector_simple_hybrid"; + private const string VectorSemanticHybridValue = "vector_semantic_hybrid"; + + /// Query type `simple`. + public static AzureAISearchQueryType Simple { get; } = new AzureAISearchQueryType(SimpleValue); + /// Query type `semantic`. + public static AzureAISearchQueryType Semantic { get; } = new AzureAISearchQueryType(SemanticValue); + /// Query type `vector`. + public static AzureAISearchQueryType Vector { get; } = new AzureAISearchQueryType(VectorValue); + /// Query type `vector_simple_hybrid`. + public static AzureAISearchQueryType VectorSimpleHybrid { get; } = new AzureAISearchQueryType(VectorSimpleHybridValue); + /// Query type `vector_semantic_hybrid`. + public static AzureAISearchQueryType VectorSemanticHybrid { get; } = new AzureAISearchQueryType(VectorSemanticHybridValue); + /// Determines if two values are the same. + public static bool operator ==(AzureAISearchQueryType left, AzureAISearchQueryType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AzureAISearchQueryType left, AzureAISearchQueryType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AzureAISearchQueryType(string value) => new AzureAISearchQueryType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AzureAISearchQueryType other && Equals(other); + /// + public bool Equals(AzureAISearchQueryType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AzureAISearchResource.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AzureAISearchResource.Serialization.cs new file mode 100644 index 000000000000..0f39c316e645 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AzureAISearchResource.Serialization.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class AzureAISearchResource : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AzureAISearchResource)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(IndexList)) + { + writer.WritePropertyName("indexes"u8); + writer.WriteStartArray(); + foreach (var item in IndexList) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AzureAISearchResource IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AzureAISearchResource)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAzureAISearchResource(document.RootElement, options); + } + + internal static AzureAISearchResource DeserializeAzureAISearchResource(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList indexes = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("indexes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AISearchIndexResource.DeserializeAISearchIndexResource(item, options)); + } + indexes = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AzureAISearchResource(indexes ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AzureAISearchResource)} does not support writing '{options.Format}' format."); + } + } + + AzureAISearchResource IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAzureAISearchResource(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AzureAISearchResource)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AzureAISearchResource FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAzureAISearchResource(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AzureAISearchResource.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AzureAISearchResource.cs new file mode 100644 index 000000000000..e2139dacead1 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AzureAISearchResource.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// A set of index resources used by the `azure_ai_search` tool. + public partial class AzureAISearchResource + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public AzureAISearchResource() + { + IndexList = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// + /// The indices attached to this agent. There can be a maximum of 1 index + /// resource attached to the agent. + /// + /// Keeps track of any properties unknown to the library. + internal AzureAISearchResource(IList indexList, IDictionary serializedAdditionalRawData) + { + IndexList = indexList; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// + /// The indices attached to this agent. There can be a maximum of 1 index + /// resource attached to the agent. + /// + public IList IndexList { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AzureAISearchToolDefinition.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AzureAISearchToolDefinition.Serialization.cs new file mode 100644 index 000000000000..0f3c97794500 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AzureAISearchToolDefinition.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class AzureAISearchToolDefinition : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AzureAISearchToolDefinition)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + AzureAISearchToolDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AzureAISearchToolDefinition)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAzureAISearchToolDefinition(document.RootElement, options); + } + + internal static AzureAISearchToolDefinition DeserializeAzureAISearchToolDefinition(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AzureAISearchToolDefinition(type, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AzureAISearchToolDefinition)} does not support writing '{options.Format}' format."); + } + } + + AzureAISearchToolDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAzureAISearchToolDefinition(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AzureAISearchToolDefinition)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new AzureAISearchToolDefinition FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAzureAISearchToolDefinition(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AzureAISearchToolDefinition.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AzureAISearchToolDefinition.cs new file mode 100644 index 000000000000..a3ace6e94800 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AzureAISearchToolDefinition.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The input definition information for an Azure AI search tool as used to configure an agent. + public partial class AzureAISearchToolDefinition : ToolDefinition + { + /// Initializes a new instance of . + public AzureAISearchToolDefinition() + { + Type = "azure_ai_search"; + } + + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + internal AzureAISearchToolDefinition(string type, IDictionary serializedAdditionalRawData) : base(type, serializedAdditionalRawData) + { + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AzureFunctionBinding.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AzureFunctionBinding.Serialization.cs new file mode 100644 index 000000000000..29fa082d0db3 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AzureFunctionBinding.Serialization.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class AzureFunctionBinding : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AzureFunctionBinding)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type.ToString()); + writer.WritePropertyName("storage_queue"u8); + writer.WriteObjectValue(StorageQueue, options); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AzureFunctionBinding IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AzureFunctionBinding)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAzureFunctionBinding(document.RootElement, options); + } + + internal static AzureFunctionBinding DeserializeAzureFunctionBinding(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AzureFunctionBindingType type = default; + AzureFunctionStorageQueue storageQueue = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new AzureFunctionBindingType(property.Value.GetString()); + continue; + } + if (property.NameEquals("storage_queue"u8)) + { + storageQueue = AzureFunctionStorageQueue.DeserializeAzureFunctionStorageQueue(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AzureFunctionBinding(type, storageQueue, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AzureFunctionBinding)} does not support writing '{options.Format}' format."); + } + } + + AzureFunctionBinding IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAzureFunctionBinding(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AzureFunctionBinding)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AzureFunctionBinding FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAzureFunctionBinding(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AzureFunctionBinding.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AzureFunctionBinding.cs new file mode 100644 index 000000000000..9fa84108cd27 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AzureFunctionBinding.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The structure for keeping storage queue name and URI. + public partial class AzureFunctionBinding + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Storage queue. + /// is null. + public AzureFunctionBinding(AzureFunctionStorageQueue storageQueue) + { + Argument.AssertNotNull(storageQueue, nameof(storageQueue)); + + StorageQueue = storageQueue; + } + + /// Initializes a new instance of . + /// The type of binding, which is always 'storage_queue'. + /// Storage queue. + /// Keeps track of any properties unknown to the library. + internal AzureFunctionBinding(AzureFunctionBindingType type, AzureFunctionStorageQueue storageQueue, IDictionary serializedAdditionalRawData) + { + Type = type; + StorageQueue = storageQueue; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AzureFunctionBinding() + { + } + + /// The type of binding, which is always 'storage_queue'. + public AzureFunctionBindingType Type { get; } = AzureFunctionBindingType.StorageQueue; + + /// Storage queue. + public AzureFunctionStorageQueue StorageQueue { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AzureFunctionBindingType.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AzureFunctionBindingType.cs new file mode 100644 index 000000000000..1dc3b9069bd8 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AzureFunctionBindingType.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// The AzureFunctionBinding_type. + public readonly partial struct AzureFunctionBindingType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AzureFunctionBindingType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string StorageQueueValue = "storage_queue"; + + /// storage_queue. + public static AzureFunctionBindingType StorageQueue { get; } = new AzureFunctionBindingType(StorageQueueValue); + /// Determines if two values are the same. + public static bool operator ==(AzureFunctionBindingType left, AzureFunctionBindingType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AzureFunctionBindingType left, AzureFunctionBindingType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AzureFunctionBindingType(string value) => new AzureFunctionBindingType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AzureFunctionBindingType other && Equals(other); + /// + public bool Equals(AzureFunctionBindingType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AzureFunctionStorageQueue.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AzureFunctionStorageQueue.Serialization.cs new file mode 100644 index 000000000000..c0639b7cf9dd --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AzureFunctionStorageQueue.Serialization.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class AzureFunctionStorageQueue : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AzureFunctionStorageQueue)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("queue_service_endpoint"u8); + writer.WriteStringValue(StorageServiceEndpoint); + writer.WritePropertyName("queue_name"u8); + writer.WriteStringValue(QueueName); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AzureFunctionStorageQueue IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AzureFunctionStorageQueue)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAzureFunctionStorageQueue(document.RootElement, options); + } + + internal static AzureFunctionStorageQueue DeserializeAzureFunctionStorageQueue(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string queueServiceEndpoint = default; + string queueName = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("queue_service_endpoint"u8)) + { + queueServiceEndpoint = property.Value.GetString(); + continue; + } + if (property.NameEquals("queue_name"u8)) + { + queueName = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AzureFunctionStorageQueue(queueServiceEndpoint, queueName, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AzureFunctionStorageQueue)} does not support writing '{options.Format}' format."); + } + } + + AzureFunctionStorageQueue IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAzureFunctionStorageQueue(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AzureFunctionStorageQueue)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AzureFunctionStorageQueue FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAzureFunctionStorageQueue(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AzureFunctionStorageQueue.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AzureFunctionStorageQueue.cs new file mode 100644 index 000000000000..097da3275966 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AzureFunctionStorageQueue.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The structure for keeping storage queue name and URI. + public partial class AzureFunctionStorageQueue + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// URI to the Azure Storage Queue service allowing you to manipulate a queue. + /// The name of an Azure function storage queue. + /// or is null. + public AzureFunctionStorageQueue(string storageServiceEndpoint, string queueName) + { + Argument.AssertNotNull(storageServiceEndpoint, nameof(storageServiceEndpoint)); + Argument.AssertNotNull(queueName, nameof(queueName)); + + StorageServiceEndpoint = storageServiceEndpoint; + QueueName = queueName; + } + + /// Initializes a new instance of . + /// URI to the Azure Storage Queue service allowing you to manipulate a queue. + /// The name of an Azure function storage queue. + /// Keeps track of any properties unknown to the library. + internal AzureFunctionStorageQueue(string storageServiceEndpoint, string queueName, IDictionary serializedAdditionalRawData) + { + StorageServiceEndpoint = storageServiceEndpoint; + QueueName = queueName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AzureFunctionStorageQueue() + { + } + + /// URI to the Azure Storage Queue service allowing you to manipulate a queue. + public string StorageServiceEndpoint { get; set; } + /// The name of an Azure function storage queue. + public string QueueName { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AzureFunctionToolDefinition.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AzureFunctionToolDefinition.Serialization.cs new file mode 100644 index 000000000000..8fa56545358b --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AzureFunctionToolDefinition.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class AzureFunctionToolDefinition : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AzureFunctionToolDefinition)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("azure_function"u8); + writer.WriteObjectValue(InternalAzureFunction, options); + } + + AzureFunctionToolDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AzureFunctionToolDefinition)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAzureFunctionToolDefinition(document.RootElement, options); + } + + internal static AzureFunctionToolDefinition DeserializeAzureFunctionToolDefinition(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + InternalAzureFunctionDefinition azureFunction = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("azure_function"u8)) + { + azureFunction = InternalAzureFunctionDefinition.DeserializeInternalAzureFunctionDefinition(property.Value, options); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AzureFunctionToolDefinition(type, serializedAdditionalRawData, azureFunction); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AzureFunctionToolDefinition)} does not support writing '{options.Format}' format."); + } + } + + AzureFunctionToolDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAzureFunctionToolDefinition(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AzureFunctionToolDefinition)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new AzureFunctionToolDefinition FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAzureFunctionToolDefinition(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AzureFunctionToolDefinition.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AzureFunctionToolDefinition.cs new file mode 100644 index 000000000000..33d7debbbd15 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AzureFunctionToolDefinition.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The input definition information for a azure function tool as used to configure an agent. + public partial class AzureFunctionToolDefinition : ToolDefinition + { + /// Initializes a new instance of . + /// The definition of the concrete function that the function tool should call. + /// is null. + public AzureFunctionToolDefinition(InternalAzureFunctionDefinition internalAzureFunction) + { + Argument.AssertNotNull(internalAzureFunction, nameof(internalAzureFunction)); + + Type = "azure_function"; + InternalAzureFunction = internalAzureFunction; + } + + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + /// The definition of the concrete function that the function tool should call. + internal AzureFunctionToolDefinition(string type, IDictionary serializedAdditionalRawData, InternalAzureFunctionDefinition internalAzureFunction) : base(type, serializedAdditionalRawData) + { + InternalAzureFunction = internalAzureFunction; + } + + /// Initializes a new instance of for deserialization. + internal AzureFunctionToolDefinition() + { + } + + /// The definition of the concrete function that the function tool should call. + public InternalAzureFunctionDefinition InternalAzureFunction { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/BingGroundingToolDefinition.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/BingGroundingToolDefinition.Serialization.cs new file mode 100644 index 000000000000..67844327ae7f --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/BingGroundingToolDefinition.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class BingGroundingToolDefinition : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BingGroundingToolDefinition)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("bing_grounding"u8); + writer.WriteObjectValue(BingGrounding, options); + } + + BingGroundingToolDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BingGroundingToolDefinition)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBingGroundingToolDefinition(document.RootElement, options); + } + + internal static BingGroundingToolDefinition DeserializeBingGroundingToolDefinition(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ToolConnectionList bingGrounding = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("bing_grounding"u8)) + { + bingGrounding = ToolConnectionList.DeserializeToolConnectionList(property.Value, options); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BingGroundingToolDefinition(type, serializedAdditionalRawData, bingGrounding); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BingGroundingToolDefinition)} does not support writing '{options.Format}' format."); + } + } + + BingGroundingToolDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeBingGroundingToolDefinition(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BingGroundingToolDefinition)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new BingGroundingToolDefinition FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeBingGroundingToolDefinition(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/BingGroundingToolDefinition.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/BingGroundingToolDefinition.cs new file mode 100644 index 000000000000..8df59f58c6f1 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/BingGroundingToolDefinition.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The input definition information for a bing grounding search tool as used to configure an agent. + public partial class BingGroundingToolDefinition : ToolDefinition + { + /// Initializes a new instance of . + /// The list of connections used by the bing grounding tool. + /// is null. + public BingGroundingToolDefinition(ToolConnectionList bingGrounding) + { + Argument.AssertNotNull(bingGrounding, nameof(bingGrounding)); + + Type = "bing_grounding"; + BingGrounding = bingGrounding; + } + + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + /// The list of connections used by the bing grounding tool. + internal BingGroundingToolDefinition(string type, IDictionary serializedAdditionalRawData, ToolConnectionList bingGrounding) : base(type, serializedAdditionalRawData) + { + BingGrounding = bingGrounding; + } + + /// Initializes a new instance of for deserialization. + internal BingGroundingToolDefinition() + { + } + + /// The list of connections used by the bing grounding tool. + public ToolConnectionList BingGrounding { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/CodeInterpreterToolDefinition.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/CodeInterpreterToolDefinition.Serialization.cs new file mode 100644 index 000000000000..edbde79f577d --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/CodeInterpreterToolDefinition.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class CodeInterpreterToolDefinition : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CodeInterpreterToolDefinition)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + CodeInterpreterToolDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CodeInterpreterToolDefinition)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCodeInterpreterToolDefinition(document.RootElement, options); + } + + internal static CodeInterpreterToolDefinition DeserializeCodeInterpreterToolDefinition(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CodeInterpreterToolDefinition(type, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CodeInterpreterToolDefinition)} does not support writing '{options.Format}' format."); + } + } + + CodeInterpreterToolDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCodeInterpreterToolDefinition(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CodeInterpreterToolDefinition)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new CodeInterpreterToolDefinition FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCodeInterpreterToolDefinition(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/CodeInterpreterToolDefinition.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/CodeInterpreterToolDefinition.cs new file mode 100644 index 000000000000..0f650ef6c5c7 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/CodeInterpreterToolDefinition.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The input definition information for a code interpreter tool as used to configure an agent. + public partial class CodeInterpreterToolDefinition : ToolDefinition + { + /// Initializes a new instance of . + public CodeInterpreterToolDefinition() + { + Type = "code_interpreter"; + } + + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + internal CodeInterpreterToolDefinition(string type, IDictionary serializedAdditionalRawData) : base(type, serializedAdditionalRawData) + { + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/CodeInterpreterToolResource.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/CodeInterpreterToolResource.Serialization.cs new file mode 100644 index 000000000000..6d39b73401d1 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/CodeInterpreterToolResource.Serialization.cs @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class CodeInterpreterToolResource : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CodeInterpreterToolResource)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(FileIds)) + { + writer.WritePropertyName("file_ids"u8); + writer.WriteStartArray(); + foreach (var item in FileIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(DataSources)) + { + writer.WritePropertyName("data_sources"u8); + writer.WriteStartArray(); + foreach (var item in DataSources) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CodeInterpreterToolResource IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CodeInterpreterToolResource)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCodeInterpreterToolResource(document.RootElement, options); + } + + internal static CodeInterpreterToolResource DeserializeCodeInterpreterToolResource(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList fileIds = default; + IList dataSources = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("file_ids"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + fileIds = array; + continue; + } + if (property.NameEquals("data_sources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(VectorStoreDataSource.DeserializeVectorStoreDataSource(item, options)); + } + dataSources = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CodeInterpreterToolResource(fileIds ?? new ChangeTrackingList(), dataSources ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CodeInterpreterToolResource)} does not support writing '{options.Format}' format."); + } + } + + CodeInterpreterToolResource IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCodeInterpreterToolResource(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CodeInterpreterToolResource)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CodeInterpreterToolResource FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCodeInterpreterToolResource(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/CodeInterpreterToolResource.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/CodeInterpreterToolResource.cs new file mode 100644 index 000000000000..9c483ef7f6b9 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/CodeInterpreterToolResource.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// A set of resources that are used by the `code_interpreter` tool. + public partial class CodeInterpreterToolResource + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public CodeInterpreterToolResource() + { + FileIds = new ChangeTrackingList(); + DataSources = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// + /// A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files + /// associated with the tool. + /// + /// The data sources to be used. This option is mutually exclusive with the `fileIds` property. + /// Keeps track of any properties unknown to the library. + internal CodeInterpreterToolResource(IList fileIds, IList dataSources, IDictionary serializedAdditionalRawData) + { + FileIds = fileIds; + DataSources = dataSources; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// + /// A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files + /// associated with the tool. + /// + public IList FileIds { get; } + /// The data sources to be used. This option is mutually exclusive with the `fileIds` property. + public IList DataSources { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/CreateAgentRequest.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/CreateAgentRequest.Serialization.cs new file mode 100644 index 000000000000..5a2a1d2f5a51 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/CreateAgentRequest.Serialization.cs @@ -0,0 +1,379 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class CreateAgentRequest : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CreateAgentRequest)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("model"u8); + writer.WriteStringValue(Model); + if (Optional.IsDefined(Name)) + { + if (Name != null) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + else + { + writer.WriteNull("name"); + } + } + if (Optional.IsDefined(Description)) + { + if (Description != null) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + else + { + writer.WriteNull("description"); + } + } + if (Optional.IsDefined(Instructions)) + { + if (Instructions != null) + { + writer.WritePropertyName("instructions"u8); + writer.WriteStringValue(Instructions); + } + else + { + writer.WriteNull("instructions"); + } + } + if (Optional.IsCollectionDefined(Tools)) + { + writer.WritePropertyName("tools"u8); + writer.WriteStartArray(); + foreach (var item in Tools) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(ToolResources)) + { + if (ToolResources != null) + { + writer.WritePropertyName("tool_resources"u8); + writer.WriteObjectValue(ToolResources, options); + } + else + { + writer.WriteNull("tool_resources"); + } + } + if (Optional.IsDefined(Temperature)) + { + if (Temperature != null) + { + writer.WritePropertyName("temperature"u8); + writer.WriteNumberValue(Temperature.Value); + } + else + { + writer.WriteNull("temperature"); + } + } + if (Optional.IsDefined(TopP)) + { + if (TopP != null) + { + writer.WritePropertyName("top_p"u8); + writer.WriteNumberValue(TopP.Value); + } + else + { + writer.WriteNull("top_p"); + } + } + if (Optional.IsDefined(ResponseFormat)) + { + if (ResponseFormat != null) + { + writer.WritePropertyName("response_format"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(ResponseFormat); +#else + using (JsonDocument document = JsonDocument.Parse(ResponseFormat, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + else + { + writer.WriteNull("response_format"); + } + } + if (Optional.IsCollectionDefined(Metadata)) + { + if (Metadata != null) + { + writer.WritePropertyName("metadata"u8); + writer.WriteStartObject(); + foreach (var item in Metadata) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + else + { + writer.WriteNull("metadata"); + } + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CreateAgentRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CreateAgentRequest)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCreateAgentRequest(document.RootElement, options); + } + + internal static CreateAgentRequest DeserializeCreateAgentRequest(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string model = default; + string name = default; + string description = default; + string instructions = default; + IReadOnlyList tools = default; + ToolResources toolResources = default; + float? temperature = default; + float? topP = default; + BinaryData responseFormat = default; + IReadOnlyDictionary metadata = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("model"u8)) + { + model = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + name = null; + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + description = null; + continue; + } + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("instructions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + instructions = null; + continue; + } + instructions = property.Value.GetString(); + continue; + } + if (property.NameEquals("tools"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ToolDefinition.DeserializeToolDefinition(item, options)); + } + tools = array; + continue; + } + if (property.NameEquals("tool_resources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + toolResources = null; + continue; + } + toolResources = ToolResources.DeserializeToolResources(property.Value, options); + continue; + } + if (property.NameEquals("temperature"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + temperature = null; + continue; + } + temperature = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("top_p"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + topP = null; + continue; + } + topP = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("response_format"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + responseFormat = null; + continue; + } + responseFormat = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + metadata = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CreateAgentRequest( + model, + name, + description, + instructions, + tools ?? new ChangeTrackingList(), + toolResources, + temperature, + topP, + responseFormat, + metadata ?? new ChangeTrackingDictionary(), + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CreateAgentRequest)} does not support writing '{options.Format}' format."); + } + } + + CreateAgentRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCreateAgentRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CreateAgentRequest)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CreateAgentRequest FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCreateAgentRequest(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/CreateAgentRequest.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/CreateAgentRequest.cs new file mode 100644 index 000000000000..f3eb86dc9133 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/CreateAgentRequest.cs @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The CreateAgentRequest. + internal partial class CreateAgentRequest + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The ID of the model to use. + /// is null. + internal CreateAgentRequest(string model) + { + Argument.AssertNotNull(model, nameof(model)); + + Model = model; + Tools = new ChangeTrackingList(); + Metadata = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The ID of the model to use. + /// The name of the new agent. + /// The description of the new agent. + /// The system instructions for the new agent to use. + /// + /// The collection of tools to enable for the new agent. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , and . + /// + /// + /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, the `code_interpreter` + /// tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. + /// + /// + /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, + /// while lower values like 0.2 will make it more focused and deterministic. + /// + /// + /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. + /// So 0.1 means only the tokens comprising the top 10% probability mass are considered. + /// + /// We generally recommend altering this or temperature but not both. + /// + /// The response format of the tool calls used by this agent. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// Keeps track of any properties unknown to the library. + internal CreateAgentRequest(string model, string name, string description, string instructions, IReadOnlyList tools, ToolResources toolResources, float? temperature, float? topP, BinaryData responseFormat, IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) + { + Model = model; + Name = name; + Description = description; + Instructions = instructions; + Tools = tools; + ToolResources = toolResources; + Temperature = temperature; + TopP = topP; + ResponseFormat = responseFormat; + Metadata = metadata; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CreateAgentRequest() + { + } + + /// The ID of the model to use. + public string Model { get; } + /// The name of the new agent. + public string Name { get; } + /// The description of the new agent. + public string Description { get; } + /// The system instructions for the new agent to use. + public string Instructions { get; } + /// + /// The collection of tools to enable for the new agent. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , and . + /// + public IReadOnlyList Tools { get; } + /// + /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, the `code_interpreter` + /// tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. + /// + public ToolResources ToolResources { get; } + /// + /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, + /// while lower values like 0.2 will make it more focused and deterministic. + /// + public float? Temperature { get; } + /// + /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. + /// So 0.1 means only the tokens comprising the top 10% probability mass are considered. + /// + /// We generally recommend altering this or temperature but not both. + /// + public float? TopP { get; } + /// + /// The response format of the tool calls used by this agent. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// + /// Supported types: + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + public BinaryData ResponseFormat { get; } + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + public IReadOnlyDictionary Metadata { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/CreateMessageRequest.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/CreateMessageRequest.Serialization.cs new file mode 100644 index 000000000000..844cefc5c385 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/CreateMessageRequest.Serialization.cs @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class CreateMessageRequest : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CreateMessageRequest)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("role"u8); + writer.WriteStringValue(Role.ToString()); + writer.WritePropertyName("content"u8); + writer.WriteStringValue(Content); + if (Optional.IsCollectionDefined(Attachments)) + { + if (Attachments != null) + { + writer.WritePropertyName("attachments"u8); + writer.WriteStartArray(); + foreach (var item in Attachments) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + else + { + writer.WriteNull("attachments"); + } + } + if (Optional.IsCollectionDefined(Metadata)) + { + if (Metadata != null) + { + writer.WritePropertyName("metadata"u8); + writer.WriteStartObject(); + foreach (var item in Metadata) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + else + { + writer.WriteNull("metadata"); + } + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CreateMessageRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CreateMessageRequest)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCreateMessageRequest(document.RootElement, options); + } + + internal static CreateMessageRequest DeserializeCreateMessageRequest(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + MessageRole role = default; + string content = default; + IReadOnlyList attachments = default; + IReadOnlyDictionary metadata = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("role"u8)) + { + role = new MessageRole(property.Value.GetString()); + continue; + } + if (property.NameEquals("content"u8)) + { + content = property.Value.GetString(); + continue; + } + if (property.NameEquals("attachments"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MessageAttachment.DeserializeMessageAttachment(item, options)); + } + attachments = array; + continue; + } + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + metadata = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CreateMessageRequest(role, content, attachments ?? new ChangeTrackingList(), metadata ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CreateMessageRequest)} does not support writing '{options.Format}' format."); + } + } + + CreateMessageRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCreateMessageRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CreateMessageRequest)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CreateMessageRequest FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCreateMessageRequest(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/CreateMessageRequest.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/CreateMessageRequest.cs new file mode 100644 index 000000000000..22374dcf75ca --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/CreateMessageRequest.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The CreateMessageRequest. + internal partial class CreateMessageRequest + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// + /// The role of the entity that is creating the message. Allowed values include: + /// - `user`: Indicates the message is sent by an actual user and should be used in most + /// cases to represent user-generated messages. + /// - `assistant`: Indicates the message is generated by the agent. Use this value to insert + /// messages from the agent into the + /// conversation. + /// + /// + /// The textual content of the initial message. Currently, robust input including images and annotated text may only be provided via + /// a separate call to the create message API. + /// + /// is null. + internal CreateMessageRequest(MessageRole role, string content) + { + Argument.AssertNotNull(content, nameof(content)); + + Role = role; + Content = content; + Attachments = new ChangeTrackingList(); + Metadata = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// + /// The role of the entity that is creating the message. Allowed values include: + /// - `user`: Indicates the message is sent by an actual user and should be used in most + /// cases to represent user-generated messages. + /// - `assistant`: Indicates the message is generated by the agent. Use this value to insert + /// messages from the agent into the + /// conversation. + /// + /// + /// The textual content of the initial message. Currently, robust input including images and annotated text may only be provided via + /// a separate call to the create message API. + /// + /// A list of files attached to the message, and the tools they should be added to. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// Keeps track of any properties unknown to the library. + internal CreateMessageRequest(MessageRole role, string content, IReadOnlyList attachments, IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) + { + Role = role; + Content = content; + Attachments = attachments; + Metadata = metadata; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CreateMessageRequest() + { + } + + /// + /// The role of the entity that is creating the message. Allowed values include: + /// - `user`: Indicates the message is sent by an actual user and should be used in most + /// cases to represent user-generated messages. + /// - `assistant`: Indicates the message is generated by the agent. Use this value to insert + /// messages from the agent into the + /// conversation. + /// + public MessageRole Role { get; } + /// + /// The textual content of the initial message. Currently, robust input including images and annotated text may only be provided via + /// a separate call to the create message API. + /// + public string Content { get; } + /// A list of files attached to the message, and the tools they should be added to. + public IReadOnlyList Attachments { get; } + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + public IReadOnlyDictionary Metadata { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/CreateRunRequest.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/CreateRunRequest.Serialization.cs new file mode 100644 index 000000000000..a4df5c295102 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/CreateRunRequest.Serialization.cs @@ -0,0 +1,530 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class CreateRunRequest : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CreateRunRequest)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("assistant_id"u8); + writer.WriteStringValue(AssistantId); + if (Optional.IsDefined(OverrideModelName)) + { + if (OverrideModelName != null) + { + writer.WritePropertyName("model"u8); + writer.WriteStringValue(OverrideModelName); + } + else + { + writer.WriteNull("model"); + } + } + if (Optional.IsDefined(OverrideInstructions)) + { + if (OverrideInstructions != null) + { + writer.WritePropertyName("instructions"u8); + writer.WriteStringValue(OverrideInstructions); + } + else + { + writer.WriteNull("instructions"); + } + } + if (Optional.IsDefined(AdditionalInstructions)) + { + if (AdditionalInstructions != null) + { + writer.WritePropertyName("additional_instructions"u8); + writer.WriteStringValue(AdditionalInstructions); + } + else + { + writer.WriteNull("additional_instructions"); + } + } + if (Optional.IsCollectionDefined(AdditionalMessages)) + { + if (AdditionalMessages != null) + { + writer.WritePropertyName("additional_messages"u8); + writer.WriteStartArray(); + foreach (var item in AdditionalMessages) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + else + { + writer.WriteNull("additional_messages"); + } + } + if (Optional.IsCollectionDefined(OverrideTools)) + { + if (OverrideTools != null) + { + writer.WritePropertyName("tools"u8); + writer.WriteStartArray(); + foreach (var item in OverrideTools) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + else + { + writer.WriteNull("tools"); + } + } + if (Optional.IsDefined(Stream)) + { + writer.WritePropertyName("stream"u8); + writer.WriteBooleanValue(Stream.Value); + } + if (Optional.IsDefined(Temperature)) + { + if (Temperature != null) + { + writer.WritePropertyName("temperature"u8); + writer.WriteNumberValue(Temperature.Value); + } + else + { + writer.WriteNull("temperature"); + } + } + if (Optional.IsDefined(TopP)) + { + if (TopP != null) + { + writer.WritePropertyName("top_p"u8); + writer.WriteNumberValue(TopP.Value); + } + else + { + writer.WriteNull("top_p"); + } + } + if (Optional.IsDefined(MaxPromptTokens)) + { + if (MaxPromptTokens != null) + { + writer.WritePropertyName("max_prompt_tokens"u8); + writer.WriteNumberValue(MaxPromptTokens.Value); + } + else + { + writer.WriteNull("max_prompt_tokens"); + } + } + if (Optional.IsDefined(MaxCompletionTokens)) + { + if (MaxCompletionTokens != null) + { + writer.WritePropertyName("max_completion_tokens"u8); + writer.WriteNumberValue(MaxCompletionTokens.Value); + } + else + { + writer.WriteNull("max_completion_tokens"); + } + } + if (Optional.IsDefined(TruncationStrategy)) + { + if (TruncationStrategy != null) + { + writer.WritePropertyName("truncation_strategy"u8); + writer.WriteObjectValue(TruncationStrategy, options); + } + else + { + writer.WriteNull("truncation_strategy"); + } + } + if (Optional.IsDefined(ToolChoice)) + { + if (ToolChoice != null) + { + writer.WritePropertyName("tool_choice"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(ToolChoice); +#else + using (JsonDocument document = JsonDocument.Parse(ToolChoice, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + else + { + writer.WriteNull("tool_choice"); + } + } + if (Optional.IsDefined(ResponseFormat)) + { + if (ResponseFormat != null) + { + writer.WritePropertyName("response_format"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(ResponseFormat); +#else + using (JsonDocument document = JsonDocument.Parse(ResponseFormat, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + else + { + writer.WriteNull("response_format"); + } + } + if (Optional.IsDefined(ParallelToolCalls)) + { + writer.WritePropertyName("parallel_tool_calls"u8); + writer.WriteBooleanValue(ParallelToolCalls.Value); + } + if (Optional.IsCollectionDefined(Metadata)) + { + if (Metadata != null) + { + writer.WritePropertyName("metadata"u8); + writer.WriteStartObject(); + foreach (var item in Metadata) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + else + { + writer.WriteNull("metadata"); + } + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CreateRunRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CreateRunRequest)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCreateRunRequest(document.RootElement, options); + } + + internal static CreateRunRequest DeserializeCreateRunRequest(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string assistantId = default; + string model = default; + string instructions = default; + string additionalInstructions = default; + IReadOnlyList additionalMessages = default; + IReadOnlyList tools = default; + bool? stream = default; + float? temperature = default; + float? topP = default; + int? maxPromptTokens = default; + int? maxCompletionTokens = default; + TruncationObject truncationStrategy = default; + BinaryData toolChoice = default; + BinaryData responseFormat = default; + bool? parallelToolCalls = default; + IReadOnlyDictionary metadata = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("assistant_id"u8)) + { + assistantId = property.Value.GetString(); + continue; + } + if (property.NameEquals("model"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + model = null; + continue; + } + model = property.Value.GetString(); + continue; + } + if (property.NameEquals("instructions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + instructions = null; + continue; + } + instructions = property.Value.GetString(); + continue; + } + if (property.NameEquals("additional_instructions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + additionalInstructions = null; + continue; + } + additionalInstructions = property.Value.GetString(); + continue; + } + if (property.NameEquals("additional_messages"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ThreadMessageOptions.DeserializeThreadMessageOptions(item, options)); + } + additionalMessages = array; + continue; + } + if (property.NameEquals("tools"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ToolDefinition.DeserializeToolDefinition(item, options)); + } + tools = array; + continue; + } + if (property.NameEquals("stream"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + stream = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("temperature"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + temperature = null; + continue; + } + temperature = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("top_p"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + topP = null; + continue; + } + topP = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("max_prompt_tokens"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + maxPromptTokens = null; + continue; + } + maxPromptTokens = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("max_completion_tokens"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + maxCompletionTokens = null; + continue; + } + maxCompletionTokens = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("truncation_strategy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + truncationStrategy = null; + continue; + } + truncationStrategy = TruncationObject.DeserializeTruncationObject(property.Value, options); + continue; + } + if (property.NameEquals("tool_choice"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + toolChoice = null; + continue; + } + toolChoice = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("response_format"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + responseFormat = null; + continue; + } + responseFormat = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("parallel_tool_calls"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parallelToolCalls = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + metadata = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CreateRunRequest( + assistantId, + model, + instructions, + additionalInstructions, + additionalMessages ?? new ChangeTrackingList(), + tools ?? new ChangeTrackingList(), + stream, + temperature, + topP, + maxPromptTokens, + maxCompletionTokens, + truncationStrategy, + toolChoice, + responseFormat, + parallelToolCalls, + metadata ?? new ChangeTrackingDictionary(), + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CreateRunRequest)} does not support writing '{options.Format}' format."); + } + } + + CreateRunRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCreateRunRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CreateRunRequest)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CreateRunRequest FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCreateRunRequest(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/CreateRunRequest.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/CreateRunRequest.cs new file mode 100644 index 000000000000..9e1750a4363c --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/CreateRunRequest.cs @@ -0,0 +1,281 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The CreateRunRequest. + internal partial class CreateRunRequest + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The ID of the agent that should run the thread. + /// is null. + internal CreateRunRequest(string assistantId) + { + Argument.AssertNotNull(assistantId, nameof(assistantId)); + + AssistantId = assistantId; + AdditionalMessages = new ChangeTrackingList(); + OverrideTools = new ChangeTrackingList(); + Metadata = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The ID of the agent that should run the thread. + /// The overridden model name that the agent should use to run the thread. + /// The overridden system instructions that the agent should use to run the thread. + /// + /// Additional instructions to append at the end of the instructions for the run. This is useful for modifying the behavior + /// on a per-run basis without overriding other instructions. + /// + /// Adds additional messages to the thread before creating the run. + /// + /// The overridden list of enabled tools that the agent should use to run the thread. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , and . + /// + /// + /// If `true`, returns a stream of events that happen during the Run as server-sent events, + /// terminating when the Run enters a terminal state with a `data: [DONE]` message. + /// + /// + /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output + /// more random, while lower values like 0.2 will make it more focused and deterministic. + /// + /// + /// An alternative to sampling with temperature, called nucleus sampling, where the model + /// considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens + /// comprising the top 10% probability mass are considered. + /// + /// We generally recommend altering this or temperature but not both. + /// + /// + /// The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only + /// the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, + /// the run will end with status `incomplete`. See `incomplete_details` for more info. + /// + /// + /// The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort + /// to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of + /// completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info. + /// + /// The strategy to use for dropping messages as the context windows moves forward. + /// Controls whether or not and which tool is called by the model. + /// Specifies the format that the model must output. + /// If `true` functions will run in parallel during tool use. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// Keeps track of any properties unknown to the library. + internal CreateRunRequest(string assistantId, string overrideModelName, string overrideInstructions, string additionalInstructions, IReadOnlyList additionalMessages, IReadOnlyList overrideTools, bool? stream, float? temperature, float? topP, int? maxPromptTokens, int? maxCompletionTokens, TruncationObject truncationStrategy, BinaryData toolChoice, BinaryData responseFormat, bool? parallelToolCalls, IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) + { + AssistantId = assistantId; + OverrideModelName = overrideModelName; + OverrideInstructions = overrideInstructions; + AdditionalInstructions = additionalInstructions; + AdditionalMessages = additionalMessages; + OverrideTools = overrideTools; + Stream = stream; + Temperature = temperature; + TopP = topP; + MaxPromptTokens = maxPromptTokens; + MaxCompletionTokens = maxCompletionTokens; + TruncationStrategy = truncationStrategy; + ToolChoice = toolChoice; + ResponseFormat = responseFormat; + ParallelToolCalls = parallelToolCalls; + Metadata = metadata; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CreateRunRequest() + { + } + + /// The ID of the agent that should run the thread. + public string AssistantId { get; } + /// The overridden model name that the agent should use to run the thread. + public string OverrideModelName { get; } + /// The overridden system instructions that the agent should use to run the thread. + public string OverrideInstructions { get; } + /// + /// Additional instructions to append at the end of the instructions for the run. This is useful for modifying the behavior + /// on a per-run basis without overriding other instructions. + /// + public string AdditionalInstructions { get; } + /// Adds additional messages to the thread before creating the run. + public IReadOnlyList AdditionalMessages { get; } + /// + /// The overridden list of enabled tools that the agent should use to run the thread. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , and . + /// + public IReadOnlyList OverrideTools { get; } + /// + /// If `true`, returns a stream of events that happen during the Run as server-sent events, + /// terminating when the Run enters a terminal state with a `data: [DONE]` message. + /// + public bool? Stream { get; } + /// + /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output + /// more random, while lower values like 0.2 will make it more focused and deterministic. + /// + public float? Temperature { get; } + /// + /// An alternative to sampling with temperature, called nucleus sampling, where the model + /// considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens + /// comprising the top 10% probability mass are considered. + /// + /// We generally recommend altering this or temperature but not both. + /// + public float? TopP { get; } + /// + /// The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only + /// the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, + /// the run will end with status `incomplete`. See `incomplete_details` for more info. + /// + public int? MaxPromptTokens { get; } + /// + /// The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort + /// to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of + /// completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info. + /// + public int? MaxCompletionTokens { get; } + /// The strategy to use for dropping messages as the context windows moves forward. + public TruncationObject TruncationStrategy { get; } + /// + /// Controls whether or not and which tool is called by the model. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// + /// Supported types: + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + public BinaryData ToolChoice { get; } + /// + /// Specifies the format that the model must output. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// + /// Supported types: + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + public BinaryData ResponseFormat { get; } + /// If `true` functions will run in parallel during tool use. + public bool? ParallelToolCalls { get; } + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + public IReadOnlyDictionary Metadata { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/CreateThreadAndRunRequest.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/CreateThreadAndRunRequest.Serialization.cs new file mode 100644 index 000000000000..bb158d8c83a0 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/CreateThreadAndRunRequest.Serialization.cs @@ -0,0 +1,513 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class CreateThreadAndRunRequest : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CreateThreadAndRunRequest)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("assistant_id"u8); + writer.WriteStringValue(AssistantId); + if (Optional.IsDefined(Thread)) + { + writer.WritePropertyName("thread"u8); + writer.WriteObjectValue(Thread, options); + } + if (Optional.IsDefined(OverrideModelName)) + { + if (OverrideModelName != null) + { + writer.WritePropertyName("model"u8); + writer.WriteStringValue(OverrideModelName); + } + else + { + writer.WriteNull("model"); + } + } + if (Optional.IsDefined(OverrideInstructions)) + { + if (OverrideInstructions != null) + { + writer.WritePropertyName("instructions"u8); + writer.WriteStringValue(OverrideInstructions); + } + else + { + writer.WriteNull("instructions"); + } + } + if (Optional.IsCollectionDefined(OverrideTools)) + { + if (OverrideTools != null) + { + writer.WritePropertyName("tools"u8); + writer.WriteStartArray(); + foreach (var item in OverrideTools) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + else + { + writer.WriteNull("tools"); + } + } + if (Optional.IsDefined(ToolResources)) + { + if (ToolResources != null) + { + writer.WritePropertyName("tool_resources"u8); + writer.WriteObjectValue(ToolResources, options); + } + else + { + writer.WriteNull("tool_resources"); + } + } + if (Optional.IsDefined(Stream)) + { + writer.WritePropertyName("stream"u8); + writer.WriteBooleanValue(Stream.Value); + } + if (Optional.IsDefined(Temperature)) + { + if (Temperature != null) + { + writer.WritePropertyName("temperature"u8); + writer.WriteNumberValue(Temperature.Value); + } + else + { + writer.WriteNull("temperature"); + } + } + if (Optional.IsDefined(TopP)) + { + if (TopP != null) + { + writer.WritePropertyName("top_p"u8); + writer.WriteNumberValue(TopP.Value); + } + else + { + writer.WriteNull("top_p"); + } + } + if (Optional.IsDefined(MaxPromptTokens)) + { + if (MaxPromptTokens != null) + { + writer.WritePropertyName("max_prompt_tokens"u8); + writer.WriteNumberValue(MaxPromptTokens.Value); + } + else + { + writer.WriteNull("max_prompt_tokens"); + } + } + if (Optional.IsDefined(MaxCompletionTokens)) + { + if (MaxCompletionTokens != null) + { + writer.WritePropertyName("max_completion_tokens"u8); + writer.WriteNumberValue(MaxCompletionTokens.Value); + } + else + { + writer.WriteNull("max_completion_tokens"); + } + } + if (Optional.IsDefined(TruncationStrategy)) + { + if (TruncationStrategy != null) + { + writer.WritePropertyName("truncation_strategy"u8); + writer.WriteObjectValue(TruncationStrategy, options); + } + else + { + writer.WriteNull("truncation_strategy"); + } + } + if (Optional.IsDefined(ToolChoice)) + { + if (ToolChoice != null) + { + writer.WritePropertyName("tool_choice"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(ToolChoice); +#else + using (JsonDocument document = JsonDocument.Parse(ToolChoice, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + else + { + writer.WriteNull("tool_choice"); + } + } + if (Optional.IsDefined(ResponseFormat)) + { + if (ResponseFormat != null) + { + writer.WritePropertyName("response_format"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(ResponseFormat); +#else + using (JsonDocument document = JsonDocument.Parse(ResponseFormat, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + else + { + writer.WriteNull("response_format"); + } + } + if (Optional.IsDefined(ParallelToolCalls)) + { + writer.WritePropertyName("parallel_tool_calls"u8); + writer.WriteBooleanValue(ParallelToolCalls.Value); + } + if (Optional.IsCollectionDefined(Metadata)) + { + if (Metadata != null) + { + writer.WritePropertyName("metadata"u8); + writer.WriteStartObject(); + foreach (var item in Metadata) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + else + { + writer.WriteNull("metadata"); + } + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CreateThreadAndRunRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CreateThreadAndRunRequest)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCreateThreadAndRunRequest(document.RootElement, options); + } + + internal static CreateThreadAndRunRequest DeserializeCreateThreadAndRunRequest(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string assistantId = default; + AgentThreadCreationOptions thread = default; + string model = default; + string instructions = default; + IReadOnlyList tools = default; + UpdateToolResourcesOptions toolResources = default; + bool? stream = default; + float? temperature = default; + float? topP = default; + int? maxPromptTokens = default; + int? maxCompletionTokens = default; + TruncationObject truncationStrategy = default; + BinaryData toolChoice = default; + BinaryData responseFormat = default; + bool? parallelToolCalls = default; + IReadOnlyDictionary metadata = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("assistant_id"u8)) + { + assistantId = property.Value.GetString(); + continue; + } + if (property.NameEquals("thread"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + thread = AgentThreadCreationOptions.DeserializeAgentThreadCreationOptions(property.Value, options); + continue; + } + if (property.NameEquals("model"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + model = null; + continue; + } + model = property.Value.GetString(); + continue; + } + if (property.NameEquals("instructions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + instructions = null; + continue; + } + instructions = property.Value.GetString(); + continue; + } + if (property.NameEquals("tools"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ToolDefinition.DeserializeToolDefinition(item, options)); + } + tools = array; + continue; + } + if (property.NameEquals("tool_resources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + toolResources = null; + continue; + } + toolResources = UpdateToolResourcesOptions.DeserializeUpdateToolResourcesOptions(property.Value, options); + continue; + } + if (property.NameEquals("stream"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + stream = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("temperature"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + temperature = null; + continue; + } + temperature = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("top_p"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + topP = null; + continue; + } + topP = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("max_prompt_tokens"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + maxPromptTokens = null; + continue; + } + maxPromptTokens = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("max_completion_tokens"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + maxCompletionTokens = null; + continue; + } + maxCompletionTokens = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("truncation_strategy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + truncationStrategy = null; + continue; + } + truncationStrategy = TruncationObject.DeserializeTruncationObject(property.Value, options); + continue; + } + if (property.NameEquals("tool_choice"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + toolChoice = null; + continue; + } + toolChoice = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("response_format"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + responseFormat = null; + continue; + } + responseFormat = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("parallel_tool_calls"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parallelToolCalls = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + metadata = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CreateThreadAndRunRequest( + assistantId, + thread, + model, + instructions, + tools ?? new ChangeTrackingList(), + toolResources, + stream, + temperature, + topP, + maxPromptTokens, + maxCompletionTokens, + truncationStrategy, + toolChoice, + responseFormat, + parallelToolCalls, + metadata ?? new ChangeTrackingDictionary(), + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CreateThreadAndRunRequest)} does not support writing '{options.Format}' format."); + } + } + + CreateThreadAndRunRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCreateThreadAndRunRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CreateThreadAndRunRequest)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CreateThreadAndRunRequest FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCreateThreadAndRunRequest(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/CreateThreadAndRunRequest.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/CreateThreadAndRunRequest.cs new file mode 100644 index 000000000000..fa9f72ff7132 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/CreateThreadAndRunRequest.cs @@ -0,0 +1,274 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The CreateThreadAndRunRequest. + internal partial class CreateThreadAndRunRequest + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The ID of the agent for which the thread should be created. + /// is null. + internal CreateThreadAndRunRequest(string assistantId) + { + Argument.AssertNotNull(assistantId, nameof(assistantId)); + + AssistantId = assistantId; + OverrideTools = new ChangeTrackingList(); + Metadata = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The ID of the agent for which the thread should be created. + /// The details used to create the new thread. If no thread is provided, an empty one will be created. + /// The overridden model that the agent should use to run the thread. + /// The overridden system instructions the agent should use to run the thread. + /// + /// The overridden list of enabled tools the agent should use to run the thread. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , and . + /// + /// Override the tools the agent can use for this run. This is useful for modifying the behavior on a per-run basis. + /// + /// If `true`, returns a stream of events that happen during the Run as server-sent events, + /// terminating when the Run enters a terminal state with a `data: [DONE]` message. + /// + /// + /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output + /// more random, while lower values like 0.2 will make it more focused and deterministic. + /// + /// + /// An alternative to sampling with temperature, called nucleus sampling, where the model + /// considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens + /// comprising the top 10% probability mass are considered. + /// + /// We generally recommend altering this or temperature but not both. + /// + /// + /// The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only + /// the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, + /// the run will end with status `incomplete`. See `incomplete_details` for more info. + /// + /// + /// The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only + /// the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens + /// specified, the run will end with status `incomplete`. See `incomplete_details` for more info. + /// + /// The strategy to use for dropping messages as the context windows moves forward. + /// Controls whether or not and which tool is called by the model. + /// Specifies the format that the model must output. + /// If `true` functions will run in parallel during tool use. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// Keeps track of any properties unknown to the library. + internal CreateThreadAndRunRequest(string assistantId, AgentThreadCreationOptions thread, string overrideModelName, string overrideInstructions, IReadOnlyList overrideTools, UpdateToolResourcesOptions toolResources, bool? stream, float? temperature, float? topP, int? maxPromptTokens, int? maxCompletionTokens, TruncationObject truncationStrategy, BinaryData toolChoice, BinaryData responseFormat, bool? parallelToolCalls, IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) + { + AssistantId = assistantId; + Thread = thread; + OverrideModelName = overrideModelName; + OverrideInstructions = overrideInstructions; + OverrideTools = overrideTools; + ToolResources = toolResources; + Stream = stream; + Temperature = temperature; + TopP = topP; + MaxPromptTokens = maxPromptTokens; + MaxCompletionTokens = maxCompletionTokens; + TruncationStrategy = truncationStrategy; + ToolChoice = toolChoice; + ResponseFormat = responseFormat; + ParallelToolCalls = parallelToolCalls; + Metadata = metadata; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CreateThreadAndRunRequest() + { + } + + /// The ID of the agent for which the thread should be created. + public string AssistantId { get; } + /// The details used to create the new thread. If no thread is provided, an empty one will be created. + public AgentThreadCreationOptions Thread { get; } + /// The overridden model that the agent should use to run the thread. + public string OverrideModelName { get; } + /// The overridden system instructions the agent should use to run the thread. + public string OverrideInstructions { get; } + /// + /// The overridden list of enabled tools the agent should use to run the thread. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , and . + /// + public IReadOnlyList OverrideTools { get; } + /// Override the tools the agent can use for this run. This is useful for modifying the behavior on a per-run basis. + public UpdateToolResourcesOptions ToolResources { get; } + /// + /// If `true`, returns a stream of events that happen during the Run as server-sent events, + /// terminating when the Run enters a terminal state with a `data: [DONE]` message. + /// + public bool? Stream { get; } + /// + /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output + /// more random, while lower values like 0.2 will make it more focused and deterministic. + /// + public float? Temperature { get; } + /// + /// An alternative to sampling with temperature, called nucleus sampling, where the model + /// considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens + /// comprising the top 10% probability mass are considered. + /// + /// We generally recommend altering this or temperature but not both. + /// + public float? TopP { get; } + /// + /// The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only + /// the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, + /// the run will end with status `incomplete`. See `incomplete_details` for more info. + /// + public int? MaxPromptTokens { get; } + /// + /// The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only + /// the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens + /// specified, the run will end with status `incomplete`. See `incomplete_details` for more info. + /// + public int? MaxCompletionTokens { get; } + /// The strategy to use for dropping messages as the context windows moves forward. + public TruncationObject TruncationStrategy { get; } + /// + /// Controls whether or not and which tool is called by the model. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// + /// Supported types: + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + public BinaryData ToolChoice { get; } + /// + /// Specifies the format that the model must output. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// + /// Supported types: + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + public BinaryData ResponseFormat { get; } + /// If `true` functions will run in parallel during tool use. + public bool? ParallelToolCalls { get; } + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + public IReadOnlyDictionary Metadata { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/CreateThreadRequest.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/CreateThreadRequest.Serialization.cs new file mode 100644 index 000000000000..a65bfe89c291 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/CreateThreadRequest.Serialization.cs @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class CreateThreadRequest : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CreateThreadRequest)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Messages)) + { + writer.WritePropertyName("messages"u8); + writer.WriteStartArray(); + foreach (var item in Messages) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(ToolResources)) + { + if (ToolResources != null) + { + writer.WritePropertyName("tool_resources"u8); + writer.WriteObjectValue(ToolResources, options); + } + else + { + writer.WriteNull("tool_resources"); + } + } + if (Optional.IsCollectionDefined(Metadata)) + { + if (Metadata != null) + { + writer.WritePropertyName("metadata"u8); + writer.WriteStartObject(); + foreach (var item in Metadata) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + else + { + writer.WriteNull("metadata"); + } + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CreateThreadRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CreateThreadRequest)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCreateThreadRequest(document.RootElement, options); + } + + internal static CreateThreadRequest DeserializeCreateThreadRequest(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList messages = default; + ToolResources toolResources = default; + IReadOnlyDictionary metadata = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("messages"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ThreadMessageOptions.DeserializeThreadMessageOptions(item, options)); + } + messages = array; + continue; + } + if (property.NameEquals("tool_resources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + toolResources = null; + continue; + } + toolResources = ToolResources.DeserializeToolResources(property.Value, options); + continue; + } + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + metadata = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CreateThreadRequest(messages ?? new ChangeTrackingList(), toolResources, metadata ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CreateThreadRequest)} does not support writing '{options.Format}' format."); + } + } + + CreateThreadRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCreateThreadRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CreateThreadRequest)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CreateThreadRequest FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCreateThreadRequest(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/CreateThreadRequest.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/CreateThreadRequest.cs new file mode 100644 index 000000000000..c462f6a77592 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/CreateThreadRequest.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The CreateThreadRequest. + internal partial class CreateThreadRequest + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal CreateThreadRequest() + { + Messages = new ChangeTrackingList(); + Metadata = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The initial messages to associate with the new thread. + /// + /// A set of resources that are made available to the agent's tools in this thread. The resources are specific to the + /// type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires + /// a list of vector store IDs. + /// + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// Keeps track of any properties unknown to the library. + internal CreateThreadRequest(IReadOnlyList messages, ToolResources toolResources, IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) + { + Messages = messages; + ToolResources = toolResources; + Metadata = metadata; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The initial messages to associate with the new thread. + public IReadOnlyList Messages { get; } + /// + /// A set of resources that are made available to the agent's tools in this thread. The resources are specific to the + /// type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires + /// a list of vector store IDs. + /// + public ToolResources ToolResources { get; } + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + public IReadOnlyDictionary Metadata { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/CreateVectorStoreFileBatchRequest.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/CreateVectorStoreFileBatchRequest.Serialization.cs new file mode 100644 index 000000000000..aea7c529111f --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/CreateVectorStoreFileBatchRequest.Serialization.cs @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class CreateVectorStoreFileBatchRequest : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CreateVectorStoreFileBatchRequest)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(FileIds)) + { + writer.WritePropertyName("file_ids"u8); + writer.WriteStartArray(); + foreach (var item in FileIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(DataSources)) + { + writer.WritePropertyName("data_sources"u8); + writer.WriteStartArray(); + foreach (var item in DataSources) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(ChunkingStrategy)) + { + writer.WritePropertyName("chunking_strategy"u8); + writer.WriteObjectValue(ChunkingStrategy, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CreateVectorStoreFileBatchRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CreateVectorStoreFileBatchRequest)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCreateVectorStoreFileBatchRequest(document.RootElement, options); + } + + internal static CreateVectorStoreFileBatchRequest DeserializeCreateVectorStoreFileBatchRequest(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList fileIds = default; + IReadOnlyList dataSources = default; + VectorStoreChunkingStrategyRequest chunkingStrategy = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("file_ids"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + fileIds = array; + continue; + } + if (property.NameEquals("data_sources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(VectorStoreDataSource.DeserializeVectorStoreDataSource(item, options)); + } + dataSources = array; + continue; + } + if (property.NameEquals("chunking_strategy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + chunkingStrategy = VectorStoreChunkingStrategyRequest.DeserializeVectorStoreChunkingStrategyRequest(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CreateVectorStoreFileBatchRequest(fileIds ?? new ChangeTrackingList(), dataSources ?? new ChangeTrackingList(), chunkingStrategy, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CreateVectorStoreFileBatchRequest)} does not support writing '{options.Format}' format."); + } + } + + CreateVectorStoreFileBatchRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCreateVectorStoreFileBatchRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CreateVectorStoreFileBatchRequest)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CreateVectorStoreFileBatchRequest FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCreateVectorStoreFileBatchRequest(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/CreateVectorStoreFileBatchRequest.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/CreateVectorStoreFileBatchRequest.cs new file mode 100644 index 000000000000..d88ab018cf14 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/CreateVectorStoreFileBatchRequest.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The CreateVectorStoreFileBatchRequest. + internal partial class CreateVectorStoreFileBatchRequest + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal CreateVectorStoreFileBatchRequest() + { + FileIds = new ChangeTrackingList(); + DataSources = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// List of file identifiers. + /// List of Azure assets. + /// + /// The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// Keeps track of any properties unknown to the library. + internal CreateVectorStoreFileBatchRequest(IReadOnlyList fileIds, IReadOnlyList dataSources, VectorStoreChunkingStrategyRequest chunkingStrategy, IDictionary serializedAdditionalRawData) + { + FileIds = fileIds; + DataSources = dataSources; + ChunkingStrategy = chunkingStrategy; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// List of file identifiers. + public IReadOnlyList FileIds { get; } + /// List of Azure assets. + public IReadOnlyList DataSources { get; } + /// + /// The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public VectorStoreChunkingStrategyRequest ChunkingStrategy { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/CreateVectorStoreFileRequest.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/CreateVectorStoreFileRequest.Serialization.cs new file mode 100644 index 000000000000..b9ce32d05af8 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/CreateVectorStoreFileRequest.Serialization.cs @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class CreateVectorStoreFileRequest : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CreateVectorStoreFileRequest)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(FileId)) + { + writer.WritePropertyName("file_id"u8); + writer.WriteStringValue(FileId); + } + if (Optional.IsDefined(DataSource)) + { + writer.WritePropertyName("data_source"u8); + writer.WriteObjectValue(DataSource, options); + } + if (Optional.IsDefined(ChunkingStrategy)) + { + writer.WritePropertyName("chunking_strategy"u8); + writer.WriteObjectValue(ChunkingStrategy, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CreateVectorStoreFileRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CreateVectorStoreFileRequest)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCreateVectorStoreFileRequest(document.RootElement, options); + } + + internal static CreateVectorStoreFileRequest DeserializeCreateVectorStoreFileRequest(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string fileId = default; + VectorStoreDataSource dataSource = default; + VectorStoreChunkingStrategyRequest chunkingStrategy = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("file_id"u8)) + { + fileId = property.Value.GetString(); + continue; + } + if (property.NameEquals("data_source"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dataSource = VectorStoreDataSource.DeserializeVectorStoreDataSource(property.Value, options); + continue; + } + if (property.NameEquals("chunking_strategy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + chunkingStrategy = VectorStoreChunkingStrategyRequest.DeserializeVectorStoreChunkingStrategyRequest(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CreateVectorStoreFileRequest(fileId, dataSource, chunkingStrategy, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CreateVectorStoreFileRequest)} does not support writing '{options.Format}' format."); + } + } + + CreateVectorStoreFileRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCreateVectorStoreFileRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CreateVectorStoreFileRequest)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CreateVectorStoreFileRequest FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCreateVectorStoreFileRequest(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/CreateVectorStoreFileRequest.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/CreateVectorStoreFileRequest.cs new file mode 100644 index 000000000000..06df6358b547 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/CreateVectorStoreFileRequest.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The CreateVectorStoreFileRequest. + internal partial class CreateVectorStoreFileRequest + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal CreateVectorStoreFileRequest() + { + } + + /// Initializes a new instance of . + /// Identifier of the file. + /// Azure asset ID. + /// + /// The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// Keeps track of any properties unknown to the library. + internal CreateVectorStoreFileRequest(string fileId, VectorStoreDataSource dataSource, VectorStoreChunkingStrategyRequest chunkingStrategy, IDictionary serializedAdditionalRawData) + { + FileId = fileId; + DataSource = dataSource; + ChunkingStrategy = chunkingStrategy; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Identifier of the file. + public string FileId { get; } + /// Azure asset ID. + public VectorStoreDataSource DataSource { get; } + /// + /// The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public VectorStoreChunkingStrategyRequest ChunkingStrategy { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/CreateVectorStoreRequest.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/CreateVectorStoreRequest.Serialization.cs new file mode 100644 index 000000000000..fb3f8a95aac4 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/CreateVectorStoreRequest.Serialization.cs @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class CreateVectorStoreRequest : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CreateVectorStoreRequest)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(FileIds)) + { + writer.WritePropertyName("file_ids"u8); + writer.WriteStartArray(); + foreach (var item in FileIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(StoreConfiguration)) + { + writer.WritePropertyName("configuration"u8); + writer.WriteObjectValue(StoreConfiguration, options); + } + if (Optional.IsDefined(ExpiresAfter)) + { + writer.WritePropertyName("expires_after"u8); + writer.WriteObjectValue(ExpiresAfter, options); + } + if (Optional.IsDefined(ChunkingStrategy)) + { + writer.WritePropertyName("chunking_strategy"u8); + writer.WriteObjectValue(ChunkingStrategy, options); + } + if (Optional.IsCollectionDefined(Metadata)) + { + if (Metadata != null) + { + writer.WritePropertyName("metadata"u8); + writer.WriteStartObject(); + foreach (var item in Metadata) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + else + { + writer.WriteNull("metadata"); + } + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CreateVectorStoreRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CreateVectorStoreRequest)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCreateVectorStoreRequest(document.RootElement, options); + } + + internal static CreateVectorStoreRequest DeserializeCreateVectorStoreRequest(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList fileIds = default; + string name = default; + VectorStoreConfiguration configuration = default; + VectorStoreExpirationPolicy expiresAfter = default; + VectorStoreChunkingStrategyRequest chunkingStrategy = default; + IReadOnlyDictionary metadata = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("file_ids"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + fileIds = array; + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("configuration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + configuration = VectorStoreConfiguration.DeserializeVectorStoreConfiguration(property.Value, options); + continue; + } + if (property.NameEquals("expires_after"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expiresAfter = VectorStoreExpirationPolicy.DeserializeVectorStoreExpirationPolicy(property.Value, options); + continue; + } + if (property.NameEquals("chunking_strategy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + chunkingStrategy = VectorStoreChunkingStrategyRequest.DeserializeVectorStoreChunkingStrategyRequest(property.Value, options); + continue; + } + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + metadata = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CreateVectorStoreRequest( + fileIds ?? new ChangeTrackingList(), + name, + configuration, + expiresAfter, + chunkingStrategy, + metadata ?? new ChangeTrackingDictionary(), + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CreateVectorStoreRequest)} does not support writing '{options.Format}' format."); + } + } + + CreateVectorStoreRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCreateVectorStoreRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CreateVectorStoreRequest)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CreateVectorStoreRequest FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCreateVectorStoreRequest(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/CreateVectorStoreRequest.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/CreateVectorStoreRequest.cs new file mode 100644 index 000000000000..d7693cd1b66f --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/CreateVectorStoreRequest.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The CreateVectorStoreRequest. + internal partial class CreateVectorStoreRequest + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal CreateVectorStoreRequest() + { + FileIds = new ChangeTrackingList(); + Metadata = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// A list of file IDs that the vector store should use. Useful for tools like `file_search` that can access files. + /// The name of the vector store. + /// The vector store configuration, used when vector store is created from Azure asset URIs. + /// Details on when this vector store expires. + /// + /// The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. Only applicable if file_ids is non-empty. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// Keeps track of any properties unknown to the library. + internal CreateVectorStoreRequest(IReadOnlyList fileIds, string name, VectorStoreConfiguration storeConfiguration, VectorStoreExpirationPolicy expiresAfter, VectorStoreChunkingStrategyRequest chunkingStrategy, IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) + { + FileIds = fileIds; + Name = name; + StoreConfiguration = storeConfiguration; + ExpiresAfter = expiresAfter; + ChunkingStrategy = chunkingStrategy; + Metadata = metadata; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// A list of file IDs that the vector store should use. Useful for tools like `file_search` that can access files. + public IReadOnlyList FileIds { get; } + /// The name of the vector store. + public string Name { get; } + /// The vector store configuration, used when vector store is created from Azure asset URIs. + public VectorStoreConfiguration StoreConfiguration { get; } + /// Details on when this vector store expires. + public VectorStoreExpirationPolicy ExpiresAfter { get; } + /// + /// The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. Only applicable if file_ids is non-empty. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public VectorStoreChunkingStrategyRequest ChunkingStrategy { get; } + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + public IReadOnlyDictionary Metadata { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/Docs/AIAssistantClient.xml b/sdk/ai/Azure.AI.Assistants/src/Generated/Docs/AIAssistantClient.xml new file mode 100644 index 000000000000..7bcca645a17f --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/Docs/AIAssistantClient.xml @@ -0,0 +1,6647 @@ + + + + + +This sample shows how to call CreateAgentAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.CreateAgentAsync(""); +]]> +This sample shows how to call CreateAgentAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +ToolResources toolResources = new ToolResources +{ + CodeInterpreter = new CodeInterpreterToolResource + { + FileIds = { "" }, + DataSources = { new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset) }, + }, + FileSearch = new FileSearchToolResource + { + VectorStoreIds = { "" }, + VectorStores = {new VectorStoreConfigurations("", new VectorStoreConfiguration(new VectorStoreDataSource[] + { + default + }))}, + }, + AzureAISearch = new AzureAISearchResource + { + IndexList = {new AISearchIndexResource("", "") + { + QueryType = AzureAISearchQueryType.Simple, + TopK = 1234, + Filter = "", + }}, + }, +}; +Response response = await client.CreateAgentAsync("", name: "", description: "", instructions: "", tools: new ToolDefinition[] +{ + new CodeInterpreterToolDefinition() +}, toolResources: toolResources, temperature: 123.45F, topP: 123.45F, responseFormat: BinaryData.FromObjectAsJson(""), metadata: new Dictionary +{ + ["key"] = "" +}); +]]> + + + +This sample shows how to call CreateAgent. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.CreateAgent(""); +]]> +This sample shows how to call CreateAgent with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +ToolResources toolResources = new ToolResources +{ + CodeInterpreter = new CodeInterpreterToolResource + { + FileIds = { "" }, + DataSources = { new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset) }, + }, + FileSearch = new FileSearchToolResource + { + VectorStoreIds = { "" }, + VectorStores = {new VectorStoreConfigurations("", new VectorStoreConfiguration(new VectorStoreDataSource[] + { + default + }))}, + }, + AzureAISearch = new AzureAISearchResource + { + IndexList = {new AISearchIndexResource("", "") + { + QueryType = AzureAISearchQueryType.Simple, + TopK = 1234, + Filter = "", + }}, + }, +}; +Response response = client.CreateAgent("", name: "", description: "", instructions: "", tools: new ToolDefinition[] +{ + new CodeInterpreterToolDefinition() +}, toolResources: toolResources, temperature: 123.45F, topP: 123.45F, responseFormat: BinaryData.FromObjectAsJson(""), metadata: new Dictionary +{ + ["key"] = "" +}); +]]> + + + +This sample shows how to call CreateAgentAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + model = "", +}); +Response response = await client.CreateAgentAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").ToString()); +Console.WriteLine(result.GetProperty("temperature").ToString()); +Console.WriteLine(result.GetProperty("top_p").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> +This sample shows how to call CreateAgentAsync with all request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + model = "", + name = "", + description = "", + instructions = "", + tools = new object[] + { + new + { + type = "code_interpreter", + } + }, + tool_resources = new + { + code_interpreter = new + { + file_ids = new object[] + { + "" + }, + data_sources = new object[] + { + new + { + uri = "", + type = "uri_asset", + } + }, + }, + file_search = new + { + vector_store_ids = new object[] + { + "" + }, + vector_stores = new object[] + { + new + { + name = "", + configuration = new + { + data_sources = new object[] + { + null + }, + }, + } + }, + }, + azure_ai_search = new + { + indexes = new object[] + { + new + { + index_connection_id = "", + index_name = "", + query_type = "simple", + top_k = 1234, + filter = "", + } + }, + }, + }, + temperature = 123.45F, + top_p = 123.45F, + response_format = "", + metadata = new + { + key = "", + }, +}); +Response response = await client.CreateAgentAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("uri").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("uri").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); +Console.WriteLine(result.GetProperty("temperature").ToString()); +Console.WriteLine(result.GetProperty("top_p").ToString()); +Console.WriteLine(result.GetProperty("response_format").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call CreateAgent and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + model = "", +}); +Response response = client.CreateAgent(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").ToString()); +Console.WriteLine(result.GetProperty("temperature").ToString()); +Console.WriteLine(result.GetProperty("top_p").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> +This sample shows how to call CreateAgent with all request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + model = "", + name = "", + description = "", + instructions = "", + tools = new object[] + { + new + { + type = "code_interpreter", + } + }, + tool_resources = new + { + code_interpreter = new + { + file_ids = new object[] + { + "" + }, + data_sources = new object[] + { + new + { + uri = "", + type = "uri_asset", + } + }, + }, + file_search = new + { + vector_store_ids = new object[] + { + "" + }, + vector_stores = new object[] + { + new + { + name = "", + configuration = new + { + data_sources = new object[] + { + null + }, + }, + } + }, + }, + azure_ai_search = new + { + indexes = new object[] + { + new + { + index_connection_id = "", + index_name = "", + query_type = "simple", + top_k = 1234, + filter = "", + } + }, + }, + }, + temperature = 123.45F, + top_p = 123.45F, + response_format = "", + metadata = new + { + key = "", + }, +}); +Response response = client.CreateAgent(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("uri").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("uri").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); +Console.WriteLine(result.GetProperty("temperature").ToString()); +Console.WriteLine(result.GetProperty("top_p").ToString()); +Console.WriteLine(result.GetProperty("response_format").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call GetAgentAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetAgentAsync(""); +]]> +This sample shows how to call GetAgentAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetAgentAsync(""); +]]> + + + +This sample shows how to call GetAgent. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetAgent(""); +]]> +This sample shows how to call GetAgent with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetAgent(""); +]]> + + + +This sample shows how to call GetAgentAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetAgentAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").ToString()); +Console.WriteLine(result.GetProperty("temperature").ToString()); +Console.WriteLine(result.GetProperty("top_p").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> +This sample shows how to call GetAgentAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetAgentAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("uri").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("uri").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); +Console.WriteLine(result.GetProperty("temperature").ToString()); +Console.WriteLine(result.GetProperty("top_p").ToString()); +Console.WriteLine(result.GetProperty("response_format").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call GetAgent and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetAgent("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").ToString()); +Console.WriteLine(result.GetProperty("temperature").ToString()); +Console.WriteLine(result.GetProperty("top_p").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> +This sample shows how to call GetAgent with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetAgent("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("uri").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("uri").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); +Console.WriteLine(result.GetProperty("temperature").ToString()); +Console.WriteLine(result.GetProperty("top_p").ToString()); +Console.WriteLine(result.GetProperty("response_format").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call UpdateAgentAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.UpdateAgentAsync(""); +]]> +This sample shows how to call UpdateAgentAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +ToolResources toolResources = new ToolResources +{ + CodeInterpreter = new CodeInterpreterToolResource + { + FileIds = { "" }, + DataSources = { new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset) }, + }, + FileSearch = new FileSearchToolResource + { + VectorStoreIds = { "" }, + VectorStores = {new VectorStoreConfigurations("", new VectorStoreConfiguration(new VectorStoreDataSource[] + { + default + }))}, + }, + AzureAISearch = new AzureAISearchResource + { + IndexList = {new AISearchIndexResource("", "") + { + QueryType = AzureAISearchQueryType.Simple, + TopK = 1234, + Filter = "", + }}, + }, +}; +Response response = await client.UpdateAgentAsync("", model: "", name: "", description: "", instructions: "", tools: new ToolDefinition[] +{ + new CodeInterpreterToolDefinition() +}, toolResources: toolResources, temperature: 123.45F, topP: 123.45F, responseFormat: BinaryData.FromObjectAsJson(""), metadata: new Dictionary +{ + ["key"] = "" +}); +]]> + + + +This sample shows how to call UpdateAgent. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.UpdateAgent(""); +]]> +This sample shows how to call UpdateAgent with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +ToolResources toolResources = new ToolResources +{ + CodeInterpreter = new CodeInterpreterToolResource + { + FileIds = { "" }, + DataSources = { new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset) }, + }, + FileSearch = new FileSearchToolResource + { + VectorStoreIds = { "" }, + VectorStores = {new VectorStoreConfigurations("", new VectorStoreConfiguration(new VectorStoreDataSource[] + { + default + }))}, + }, + AzureAISearch = new AzureAISearchResource + { + IndexList = {new AISearchIndexResource("", "") + { + QueryType = AzureAISearchQueryType.Simple, + TopK = 1234, + Filter = "", + }}, + }, +}; +Response response = client.UpdateAgent("", model: "", name: "", description: "", instructions: "", tools: new ToolDefinition[] +{ + new CodeInterpreterToolDefinition() +}, toolResources: toolResources, temperature: 123.45F, topP: 123.45F, responseFormat: BinaryData.FromObjectAsJson(""), metadata: new Dictionary +{ + ["key"] = "" +}); +]]> + + + +This sample shows how to call UpdateAgentAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = await client.UpdateAgentAsync("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").ToString()); +Console.WriteLine(result.GetProperty("temperature").ToString()); +Console.WriteLine(result.GetProperty("top_p").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> +This sample shows how to call UpdateAgentAsync with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + model = "", + name = "", + description = "", + instructions = "", + tools = new object[] + { + new + { + type = "code_interpreter", + } + }, + tool_resources = new + { + code_interpreter = new + { + file_ids = new object[] + { + "" + }, + data_sources = new object[] + { + new + { + uri = "", + type = "uri_asset", + } + }, + }, + file_search = new + { + vector_store_ids = new object[] + { + "" + }, + vector_stores = new object[] + { + new + { + name = "", + configuration = new + { + data_sources = new object[] + { + null + }, + }, + } + }, + }, + azure_ai_search = new + { + indexes = new object[] + { + new + { + index_connection_id = "", + index_name = "", + query_type = "simple", + top_k = 1234, + filter = "", + } + }, + }, + }, + temperature = 123.45F, + top_p = 123.45F, + response_format = "", + metadata = new + { + key = "", + }, +}); +Response response = await client.UpdateAgentAsync("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("uri").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("uri").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); +Console.WriteLine(result.GetProperty("temperature").ToString()); +Console.WriteLine(result.GetProperty("top_p").ToString()); +Console.WriteLine(result.GetProperty("response_format").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call UpdateAgent and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = client.UpdateAgent("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").ToString()); +Console.WriteLine(result.GetProperty("temperature").ToString()); +Console.WriteLine(result.GetProperty("top_p").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> +This sample shows how to call UpdateAgent with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + model = "", + name = "", + description = "", + instructions = "", + tools = new object[] + { + new + { + type = "code_interpreter", + } + }, + tool_resources = new + { + code_interpreter = new + { + file_ids = new object[] + { + "" + }, + data_sources = new object[] + { + new + { + uri = "", + type = "uri_asset", + } + }, + }, + file_search = new + { + vector_store_ids = new object[] + { + "" + }, + vector_stores = new object[] + { + new + { + name = "", + configuration = new + { + data_sources = new object[] + { + null + }, + }, + } + }, + }, + azure_ai_search = new + { + indexes = new object[] + { + new + { + index_connection_id = "", + index_name = "", + query_type = "simple", + top_k = 1234, + filter = "", + } + }, + }, + }, + temperature = 123.45F, + top_p = 123.45F, + response_format = "", + metadata = new + { + key = "", + }, +}); +Response response = client.UpdateAgent("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("uri").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("uri").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); +Console.WriteLine(result.GetProperty("temperature").ToString()); +Console.WriteLine(result.GetProperty("top_p").ToString()); +Console.WriteLine(result.GetProperty("response_format").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call CreateThreadAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.CreateThreadAsync(); +]]> +This sample shows how to call CreateThreadAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +ToolResources toolResources = new ToolResources +{ + CodeInterpreter = new CodeInterpreterToolResource + { + FileIds = { "" }, + DataSources = { default }, + }, + FileSearch = new FileSearchToolResource + { + VectorStoreIds = { "" }, + VectorStores = {new VectorStoreConfigurations("", new VectorStoreConfiguration(new VectorStoreDataSource[] + { + default + }))}, + }, + AzureAISearch = new AzureAISearchResource + { + IndexList = {new AISearchIndexResource("", "") + { + QueryType = AzureAISearchQueryType.Simple, + TopK = 1234, + Filter = "", + }}, + }, +}; +Response response = await client.CreateThreadAsync(messages: new ThreadMessageOptions[] +{ + new ThreadMessageOptions(MessageRole.User, "") + { + Attachments = {new MessageAttachment(new BinaryData[] + { + BinaryData.FromObjectAsJson(new + { + type = "code_interpreter", + }) + }) + { + FileId = "", + DataSource = new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset), + }}, + Metadata = + { + ["key"] = "" + }, + } +}, toolResources: toolResources, metadata: new Dictionary +{ + ["key"] = "" +}); +]]> + + + +This sample shows how to call CreateThread. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.CreateThread(); +]]> +This sample shows how to call CreateThread with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +ToolResources toolResources = new ToolResources +{ + CodeInterpreter = new CodeInterpreterToolResource + { + FileIds = { "" }, + DataSources = { default }, + }, + FileSearch = new FileSearchToolResource + { + VectorStoreIds = { "" }, + VectorStores = {new VectorStoreConfigurations("", new VectorStoreConfiguration(new VectorStoreDataSource[] + { + default + }))}, + }, + AzureAISearch = new AzureAISearchResource + { + IndexList = {new AISearchIndexResource("", "") + { + QueryType = AzureAISearchQueryType.Simple, + TopK = 1234, + Filter = "", + }}, + }, +}; +Response response = client.CreateThread(messages: new ThreadMessageOptions[] +{ + new ThreadMessageOptions(MessageRole.User, "") + { + Attachments = {new MessageAttachment(new BinaryData[] + { + BinaryData.FromObjectAsJson(new + { + type = "code_interpreter", + }) + }) + { + FileId = "", + DataSource = new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset), + }}, + Metadata = + { + ["key"] = "" + }, + } +}, toolResources: toolResources, metadata: new Dictionary +{ + ["key"] = "" +}); +]]> + + + +This sample shows how to call CreateThreadAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = await client.CreateThreadAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> +This sample shows how to call CreateThreadAsync with all request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + messages = new object[] + { + new + { + role = "user", + content = "", + attachments = new object[] + { + new + { + file_id = "", + data_source = new + { + uri = "", + type = "uri_asset", + }, + tools = new object[] + { + new + { + type = "code_interpreter", + } + }, + } + }, + metadata = new + { + key = "", + }, + } + }, + tool_resources = new + { + code_interpreter = new + { + file_ids = new object[] + { + "" + }, + data_sources = new object[] + { + null + }, + }, + file_search = new + { + vector_store_ids = new object[] + { + "" + }, + vector_stores = new object[] + { + new + { + name = "", + configuration = new + { + data_sources = new object[] + { + null + }, + }, + } + }, + }, + azure_ai_search = new + { + indexes = new object[] + { + new + { + index_connection_id = "", + index_name = "", + query_type = "simple", + top_k = 1234, + filter = "", + } + }, + }, + }, + metadata = new + { + key = "", + }, +}); +Response response = await client.CreateThreadAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("uri").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("uri").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call CreateThread and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = client.CreateThread(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> +This sample shows how to call CreateThread with all request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + messages = new object[] + { + new + { + role = "user", + content = "", + attachments = new object[] + { + new + { + file_id = "", + data_source = new + { + uri = "", + type = "uri_asset", + }, + tools = new object[] + { + new + { + type = "code_interpreter", + } + }, + } + }, + metadata = new + { + key = "", + }, + } + }, + tool_resources = new + { + code_interpreter = new + { + file_ids = new object[] + { + "" + }, + data_sources = new object[] + { + null + }, + }, + file_search = new + { + vector_store_ids = new object[] + { + "" + }, + vector_stores = new object[] + { + new + { + name = "", + configuration = new + { + data_sources = new object[] + { + null + }, + }, + } + }, + }, + azure_ai_search = new + { + indexes = new object[] + { + new + { + index_connection_id = "", + index_name = "", + query_type = "simple", + top_k = 1234, + filter = "", + } + }, + }, + }, + metadata = new + { + key = "", + }, +}); +Response response = client.CreateThread(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("uri").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("uri").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call GetThreadAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetThreadAsync(""); +]]> +This sample shows how to call GetThreadAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetThreadAsync(""); +]]> + + + +This sample shows how to call GetThread. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetThread(""); +]]> +This sample shows how to call GetThread with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetThread(""); +]]> + + + +This sample shows how to call GetThreadAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetThreadAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> +This sample shows how to call GetThreadAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetThreadAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("uri").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("uri").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call GetThread and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetThread("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> +This sample shows how to call GetThread with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetThread("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("uri").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("uri").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call UpdateThreadAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.UpdateThreadAsync(""); +]]> +This sample shows how to call UpdateThreadAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +ToolResources toolResources = new ToolResources +{ + CodeInterpreter = new CodeInterpreterToolResource + { + FileIds = { "" }, + DataSources = { new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset) }, + }, + FileSearch = new FileSearchToolResource + { + VectorStoreIds = { "" }, + VectorStores = {new VectorStoreConfigurations("", new VectorStoreConfiguration(new VectorStoreDataSource[] + { + default + }))}, + }, + AzureAISearch = new AzureAISearchResource + { + IndexList = {new AISearchIndexResource("", "") + { + QueryType = AzureAISearchQueryType.Simple, + TopK = 1234, + Filter = "", + }}, + }, +}; +Response response = await client.UpdateThreadAsync("", toolResources: toolResources, metadata: new Dictionary +{ + ["key"] = "" +}); +]]> + + + +This sample shows how to call UpdateThread. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.UpdateThread(""); +]]> +This sample shows how to call UpdateThread with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +ToolResources toolResources = new ToolResources +{ + CodeInterpreter = new CodeInterpreterToolResource + { + FileIds = { "" }, + DataSources = { new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset) }, + }, + FileSearch = new FileSearchToolResource + { + VectorStoreIds = { "" }, + VectorStores = {new VectorStoreConfigurations("", new VectorStoreConfiguration(new VectorStoreDataSource[] + { + default + }))}, + }, + AzureAISearch = new AzureAISearchResource + { + IndexList = {new AISearchIndexResource("", "") + { + QueryType = AzureAISearchQueryType.Simple, + TopK = 1234, + Filter = "", + }}, + }, +}; +Response response = client.UpdateThread("", toolResources: toolResources, metadata: new Dictionary +{ + ["key"] = "" +}); +]]> + + + +This sample shows how to call UpdateThreadAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = await client.UpdateThreadAsync("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> +This sample shows how to call UpdateThreadAsync with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + tool_resources = new + { + code_interpreter = new + { + file_ids = new object[] + { + "" + }, + data_sources = new object[] + { + new + { + uri = "", + type = "uri_asset", + } + }, + }, + file_search = new + { + vector_store_ids = new object[] + { + "" + }, + vector_stores = new object[] + { + new + { + name = "", + configuration = new + { + data_sources = new object[] + { + null + }, + }, + } + }, + }, + azure_ai_search = new + { + indexes = new object[] + { + new + { + index_connection_id = "", + index_name = "", + query_type = "simple", + top_k = 1234, + filter = "", + } + }, + }, + }, + metadata = new + { + key = "", + }, +}); +Response response = await client.UpdateThreadAsync("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("uri").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("uri").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call UpdateThread and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = client.UpdateThread("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> +This sample shows how to call UpdateThread with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + tool_resources = new + { + code_interpreter = new + { + file_ids = new object[] + { + "" + }, + data_sources = new object[] + { + new + { + uri = "", + type = "uri_asset", + } + }, + }, + file_search = new + { + vector_store_ids = new object[] + { + "" + }, + vector_stores = new object[] + { + new + { + name = "", + configuration = new + { + data_sources = new object[] + { + null + }, + }, + } + }, + }, + azure_ai_search = new + { + indexes = new object[] + { + new + { + index_connection_id = "", + index_name = "", + query_type = "simple", + top_k = 1234, + filter = "", + } + }, + }, + }, + metadata = new + { + key = "", + }, +}); +Response response = client.UpdateThread("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("uri").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("uri").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call CreateMessageAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.CreateMessageAsync("", MessageRole.User, ""); +]]> +This sample shows how to call CreateMessageAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.CreateMessageAsync("", MessageRole.User, "", attachments: new MessageAttachment[] +{ + new MessageAttachment(new BinaryData[] + { + BinaryData.FromObjectAsJson(new + { + type = "code_interpreter", + }) + }) + { + FileId = "", + DataSource = new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset), + } +}, metadata: new Dictionary +{ + ["key"] = "" +}); +]]> + + + +This sample shows how to call CreateMessage. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.CreateMessage("", MessageRole.User, ""); +]]> +This sample shows how to call CreateMessage with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.CreateMessage("", MessageRole.User, "", attachments: new MessageAttachment[] +{ + new MessageAttachment(new BinaryData[] + { + BinaryData.FromObjectAsJson(new + { + type = "code_interpreter", + }) + }) + { + FileId = "", + DataSource = new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset), + } +}, metadata: new Dictionary +{ + ["key"] = "" +}); +]]> + + + +This sample shows how to call CreateMessageAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + role = "user", + content = "", +}); +Response response = await client.CreateMessageAsync("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_at").ToString()); +Console.WriteLine(result.GetProperty("role").ToString()); +Console.WriteLine(result.GetProperty("content")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("run_id").ToString()); +Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("tools")[0].ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> +This sample shows how to call CreateMessageAsync with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + role = "user", + content = "", + attachments = new object[] + { + new + { + file_id = "", + data_source = new + { + uri = "", + type = "uri_asset", + }, + tools = new object[] + { + new + { + type = "code_interpreter", + } + }, + } + }, + metadata = new + { + key = "", + }, +}); +Response response = await client.CreateMessageAsync("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_at").ToString()); +Console.WriteLine(result.GetProperty("role").ToString()); +Console.WriteLine(result.GetProperty("content")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("run_id").ToString()); +Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("file_id").ToString()); +Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("data_source").GetProperty("uri").ToString()); +Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("data_source").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("tools")[0].ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call CreateMessage and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + role = "user", + content = "", +}); +Response response = client.CreateMessage("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_at").ToString()); +Console.WriteLine(result.GetProperty("role").ToString()); +Console.WriteLine(result.GetProperty("content")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("run_id").ToString()); +Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("tools")[0].ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> +This sample shows how to call CreateMessage with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + role = "user", + content = "", + attachments = new object[] + { + new + { + file_id = "", + data_source = new + { + uri = "", + type = "uri_asset", + }, + tools = new object[] + { + new + { + type = "code_interpreter", + } + }, + } + }, + metadata = new + { + key = "", + }, +}); +Response response = client.CreateMessage("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_at").ToString()); +Console.WriteLine(result.GetProperty("role").ToString()); +Console.WriteLine(result.GetProperty("content")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("run_id").ToString()); +Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("file_id").ToString()); +Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("data_source").GetProperty("uri").ToString()); +Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("data_source").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("tools")[0].ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call GetMessageAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetMessageAsync("", ""); +]]> +This sample shows how to call GetMessageAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetMessageAsync("", ""); +]]> + + + +This sample shows how to call GetMessage. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetMessage("", ""); +]]> +This sample shows how to call GetMessage with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetMessage("", ""); +]]> + + + +This sample shows how to call GetMessageAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetMessageAsync("", "", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_at").ToString()); +Console.WriteLine(result.GetProperty("role").ToString()); +Console.WriteLine(result.GetProperty("content")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("run_id").ToString()); +Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("tools")[0].ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> +This sample shows how to call GetMessageAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetMessageAsync("", "", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_at").ToString()); +Console.WriteLine(result.GetProperty("role").ToString()); +Console.WriteLine(result.GetProperty("content")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("run_id").ToString()); +Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("file_id").ToString()); +Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("data_source").GetProperty("uri").ToString()); +Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("data_source").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("tools")[0].ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call GetMessage and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetMessage("", "", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_at").ToString()); +Console.WriteLine(result.GetProperty("role").ToString()); +Console.WriteLine(result.GetProperty("content")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("run_id").ToString()); +Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("tools")[0].ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> +This sample shows how to call GetMessage with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetMessage("", "", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_at").ToString()); +Console.WriteLine(result.GetProperty("role").ToString()); +Console.WriteLine(result.GetProperty("content")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("run_id").ToString()); +Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("file_id").ToString()); +Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("data_source").GetProperty("uri").ToString()); +Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("data_source").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("tools")[0].ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call UpdateMessageAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.UpdateMessageAsync("", ""); +]]> +This sample shows how to call UpdateMessageAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.UpdateMessageAsync("", "", metadata: new Dictionary +{ + ["key"] = "" +}); +]]> + + + +This sample shows how to call UpdateMessage. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.UpdateMessage("", ""); +]]> +This sample shows how to call UpdateMessage with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.UpdateMessage("", "", metadata: new Dictionary +{ + ["key"] = "" +}); +]]> + + + +This sample shows how to call UpdateMessageAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = await client.UpdateMessageAsync("", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_at").ToString()); +Console.WriteLine(result.GetProperty("role").ToString()); +Console.WriteLine(result.GetProperty("content")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("run_id").ToString()); +Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("tools")[0].ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> +This sample shows how to call UpdateMessageAsync with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + metadata = new + { + key = "", + }, +}); +Response response = await client.UpdateMessageAsync("", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_at").ToString()); +Console.WriteLine(result.GetProperty("role").ToString()); +Console.WriteLine(result.GetProperty("content")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("run_id").ToString()); +Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("file_id").ToString()); +Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("data_source").GetProperty("uri").ToString()); +Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("data_source").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("tools")[0].ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call UpdateMessage and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = client.UpdateMessage("", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_at").ToString()); +Console.WriteLine(result.GetProperty("role").ToString()); +Console.WriteLine(result.GetProperty("content")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("run_id").ToString()); +Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("tools")[0].ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> +This sample shows how to call UpdateMessage with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + metadata = new + { + key = "", + }, +}); +Response response = client.UpdateMessage("", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_at").ToString()); +Console.WriteLine(result.GetProperty("role").ToString()); +Console.WriteLine(result.GetProperty("content")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("run_id").ToString()); +Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("file_id").ToString()); +Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("data_source").GetProperty("uri").ToString()); +Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("data_source").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("tools")[0].ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call CreateRunAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.CreateRunAsync("", ""); +]]> +This sample shows how to call CreateRunAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +TruncationObject truncationStrategy = new TruncationObject(TruncationStrategy.Auto) +{ + LastMessages = 1234, +}; +Response response = await client.CreateRunAsync("", "", overrideModelName: "", overrideInstructions: "", additionalInstructions: "", additionalMessages: new ThreadMessageOptions[] +{ + new ThreadMessageOptions(MessageRole.User, "") + { + Attachments = {new MessageAttachment(new BinaryData[] + { + BinaryData.FromObjectAsJson(new + { + type = "code_interpreter", + }) + }) + { + FileId = "", + DataSource = new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset), + }}, + Metadata = + { + ["key"] = "" + }, + } +}, overrideTools: new ToolDefinition[] +{ + new CodeInterpreterToolDefinition() +}, stream: true, temperature: 123.45F, topP: 123.45F, maxPromptTokens: 1234, maxCompletionTokens: 1234, truncationStrategy: truncationStrategy, toolChoice: BinaryData.FromObjectAsJson(""), responseFormat: BinaryData.FromObjectAsJson(""), parallelToolCalls: true, metadata: new Dictionary +{ + ["key"] = "" +}, include: new RunAdditionalFieldList[] { RunAdditionalFieldList.FileSearchContents }); +]]> + + + +This sample shows how to call CreateRun. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.CreateRun("", ""); +]]> +This sample shows how to call CreateRun with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +TruncationObject truncationStrategy = new TruncationObject(TruncationStrategy.Auto) +{ + LastMessages = 1234, +}; +Response response = client.CreateRun("", "", overrideModelName: "", overrideInstructions: "", additionalInstructions: "", additionalMessages: new ThreadMessageOptions[] +{ + new ThreadMessageOptions(MessageRole.User, "") + { + Attachments = {new MessageAttachment(new BinaryData[] + { + BinaryData.FromObjectAsJson(new + { + type = "code_interpreter", + }) + }) + { + FileId = "", + DataSource = new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset), + }}, + Metadata = + { + ["key"] = "" + }, + } +}, overrideTools: new ToolDefinition[] +{ + new CodeInterpreterToolDefinition() +}, stream: true, temperature: 123.45F, topP: 123.45F, maxPromptTokens: 1234, maxCompletionTokens: 1234, truncationStrategy: truncationStrategy, toolChoice: BinaryData.FromObjectAsJson(""), responseFormat: BinaryData.FromObjectAsJson(""), parallelToolCalls: true, metadata: new Dictionary +{ + ["key"] = "" +}, include: new RunAdditionalFieldList[] { RunAdditionalFieldList.FileSearchContents }); +]]> + + + +This sample shows how to call CreateRunAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + assistant_id = "", +}); +Response response = await client.CreateRunAsync("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("expires_at").ToString()); +Console.WriteLine(result.GetProperty("started_at").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("cancelled_at").ToString()); +Console.WriteLine(result.GetProperty("failed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_choice").ToString()); +Console.WriteLine(result.GetProperty("response_format").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); +]]> +This sample shows how to call CreateRunAsync with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + assistant_id = "", + model = "", + instructions = "", + additional_instructions = "", + additional_messages = new object[] + { + new + { + role = "user", + content = "", + attachments = new object[] + { + new + { + file_id = "", + data_source = new + { + uri = "", + type = "uri_asset", + }, + tools = new object[] + { + new + { + type = "code_interpreter", + } + }, + } + }, + metadata = new + { + key = "", + }, + } + }, + tools = new object[] + { + new + { + type = "code_interpreter", + } + }, + stream = true, + temperature = 123.45F, + top_p = 123.45F, + max_prompt_tokens = 1234, + max_completion_tokens = 1234, + truncation_strategy = new + { + type = "auto", + last_messages = 1234, + }, + tool_choice = "", + response_format = "", + parallel_tool_calls = true, + metadata = new + { + key = "", + }, +}); +Response response = await client.CreateRunAsync("", content, include: new RunAdditionalFieldList[] { RunAdditionalFieldList.FileSearchContents }); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("required_action").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("expires_at").ToString()); +Console.WriteLine(result.GetProperty("started_at").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("cancelled_at").ToString()); +Console.WriteLine(result.GetProperty("failed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); +Console.WriteLine(result.GetProperty("temperature").ToString()); +Console.WriteLine(result.GetProperty("top_p").ToString()); +Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("last_messages").ToString()); +Console.WriteLine(result.GetProperty("tool_choice").ToString()); +Console.WriteLine(result.GetProperty("response_format").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); +Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); +]]> + + + +This sample shows how to call CreateRun and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + assistant_id = "", +}); +Response response = client.CreateRun("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("expires_at").ToString()); +Console.WriteLine(result.GetProperty("started_at").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("cancelled_at").ToString()); +Console.WriteLine(result.GetProperty("failed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_choice").ToString()); +Console.WriteLine(result.GetProperty("response_format").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); +]]> +This sample shows how to call CreateRun with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + assistant_id = "", + model = "", + instructions = "", + additional_instructions = "", + additional_messages = new object[] + { + new + { + role = "user", + content = "", + attachments = new object[] + { + new + { + file_id = "", + data_source = new + { + uri = "", + type = "uri_asset", + }, + tools = new object[] + { + new + { + type = "code_interpreter", + } + }, + } + }, + metadata = new + { + key = "", + }, + } + }, + tools = new object[] + { + new + { + type = "code_interpreter", + } + }, + stream = true, + temperature = 123.45F, + top_p = 123.45F, + max_prompt_tokens = 1234, + max_completion_tokens = 1234, + truncation_strategy = new + { + type = "auto", + last_messages = 1234, + }, + tool_choice = "", + response_format = "", + parallel_tool_calls = true, + metadata = new + { + key = "", + }, +}); +Response response = client.CreateRun("", content, include: new RunAdditionalFieldList[] { RunAdditionalFieldList.FileSearchContents }); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("required_action").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("expires_at").ToString()); +Console.WriteLine(result.GetProperty("started_at").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("cancelled_at").ToString()); +Console.WriteLine(result.GetProperty("failed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); +Console.WriteLine(result.GetProperty("temperature").ToString()); +Console.WriteLine(result.GetProperty("top_p").ToString()); +Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("last_messages").ToString()); +Console.WriteLine(result.GetProperty("tool_choice").ToString()); +Console.WriteLine(result.GetProperty("response_format").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); +Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); +]]> + + + +This sample shows how to call GetRunAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetRunAsync("", ""); +]]> +This sample shows how to call GetRunAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetRunAsync("", ""); +]]> + + + +This sample shows how to call GetRun. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetRun("", ""); +]]> +This sample shows how to call GetRun with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetRun("", ""); +]]> + + + +This sample shows how to call GetRunAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetRunAsync("", "", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("expires_at").ToString()); +Console.WriteLine(result.GetProperty("started_at").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("cancelled_at").ToString()); +Console.WriteLine(result.GetProperty("failed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_choice").ToString()); +Console.WriteLine(result.GetProperty("response_format").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); +]]> +This sample shows how to call GetRunAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetRunAsync("", "", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("required_action").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("expires_at").ToString()); +Console.WriteLine(result.GetProperty("started_at").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("cancelled_at").ToString()); +Console.WriteLine(result.GetProperty("failed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); +Console.WriteLine(result.GetProperty("temperature").ToString()); +Console.WriteLine(result.GetProperty("top_p").ToString()); +Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("last_messages").ToString()); +Console.WriteLine(result.GetProperty("tool_choice").ToString()); +Console.WriteLine(result.GetProperty("response_format").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); +Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); +]]> + + + +This sample shows how to call GetRun and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetRun("", "", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("expires_at").ToString()); +Console.WriteLine(result.GetProperty("started_at").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("cancelled_at").ToString()); +Console.WriteLine(result.GetProperty("failed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_choice").ToString()); +Console.WriteLine(result.GetProperty("response_format").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); +]]> +This sample shows how to call GetRun with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetRun("", "", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("required_action").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("expires_at").ToString()); +Console.WriteLine(result.GetProperty("started_at").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("cancelled_at").ToString()); +Console.WriteLine(result.GetProperty("failed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); +Console.WriteLine(result.GetProperty("temperature").ToString()); +Console.WriteLine(result.GetProperty("top_p").ToString()); +Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("last_messages").ToString()); +Console.WriteLine(result.GetProperty("tool_choice").ToString()); +Console.WriteLine(result.GetProperty("response_format").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); +Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); +]]> + + + +This sample shows how to call UpdateRunAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.UpdateRunAsync("", ""); +]]> +This sample shows how to call UpdateRunAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.UpdateRunAsync("", "", metadata: new Dictionary +{ + ["key"] = "" +}); +]]> + + + +This sample shows how to call UpdateRun. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.UpdateRun("", ""); +]]> +This sample shows how to call UpdateRun with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.UpdateRun("", "", metadata: new Dictionary +{ + ["key"] = "" +}); +]]> + + + +This sample shows how to call UpdateRunAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = await client.UpdateRunAsync("", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("expires_at").ToString()); +Console.WriteLine(result.GetProperty("started_at").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("cancelled_at").ToString()); +Console.WriteLine(result.GetProperty("failed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_choice").ToString()); +Console.WriteLine(result.GetProperty("response_format").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); +]]> +This sample shows how to call UpdateRunAsync with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + metadata = new + { + key = "", + }, +}); +Response response = await client.UpdateRunAsync("", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("required_action").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("expires_at").ToString()); +Console.WriteLine(result.GetProperty("started_at").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("cancelled_at").ToString()); +Console.WriteLine(result.GetProperty("failed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); +Console.WriteLine(result.GetProperty("temperature").ToString()); +Console.WriteLine(result.GetProperty("top_p").ToString()); +Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("last_messages").ToString()); +Console.WriteLine(result.GetProperty("tool_choice").ToString()); +Console.WriteLine(result.GetProperty("response_format").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); +Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); +]]> + + + +This sample shows how to call UpdateRun and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = client.UpdateRun("", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("expires_at").ToString()); +Console.WriteLine(result.GetProperty("started_at").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("cancelled_at").ToString()); +Console.WriteLine(result.GetProperty("failed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_choice").ToString()); +Console.WriteLine(result.GetProperty("response_format").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); +]]> +This sample shows how to call UpdateRun with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + metadata = new + { + key = "", + }, +}); +Response response = client.UpdateRun("", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("required_action").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("expires_at").ToString()); +Console.WriteLine(result.GetProperty("started_at").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("cancelled_at").ToString()); +Console.WriteLine(result.GetProperty("failed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); +Console.WriteLine(result.GetProperty("temperature").ToString()); +Console.WriteLine(result.GetProperty("top_p").ToString()); +Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("last_messages").ToString()); +Console.WriteLine(result.GetProperty("tool_choice").ToString()); +Console.WriteLine(result.GetProperty("response_format").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); +Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); +]]> + + + +This sample shows how to call SubmitToolOutputsToRunAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.SubmitToolOutputsToRunAsync("", "", new ToolOutput[] +{ + new ToolOutput() +}); +]]> +This sample shows how to call SubmitToolOutputsToRunAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.SubmitToolOutputsToRunAsync("", "", new ToolOutput[] +{ + new ToolOutput + { + ToolCallId = "", + Output = "", + } +}, stream: true); +]]> + + + +This sample shows how to call SubmitToolOutputsToRun. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.SubmitToolOutputsToRun("", "", new ToolOutput[] +{ + new ToolOutput() +}); +]]> +This sample shows how to call SubmitToolOutputsToRun with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.SubmitToolOutputsToRun("", "", new ToolOutput[] +{ + new ToolOutput + { + ToolCallId = "", + Output = "", + } +}, stream: true); +]]> + + + +This sample shows how to call SubmitToolOutputsToRunAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + tool_outputs = new object[] + { + new object() + }, +}); +Response response = await client.SubmitToolOutputsToRunAsync("", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("expires_at").ToString()); +Console.WriteLine(result.GetProperty("started_at").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("cancelled_at").ToString()); +Console.WriteLine(result.GetProperty("failed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_choice").ToString()); +Console.WriteLine(result.GetProperty("response_format").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); +]]> +This sample shows how to call SubmitToolOutputsToRunAsync with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + tool_outputs = new object[] + { + new + { + tool_call_id = "", + output = "", + } + }, + stream = true, +}); +Response response = await client.SubmitToolOutputsToRunAsync("", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("required_action").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("expires_at").ToString()); +Console.WriteLine(result.GetProperty("started_at").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("cancelled_at").ToString()); +Console.WriteLine(result.GetProperty("failed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); +Console.WriteLine(result.GetProperty("temperature").ToString()); +Console.WriteLine(result.GetProperty("top_p").ToString()); +Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("last_messages").ToString()); +Console.WriteLine(result.GetProperty("tool_choice").ToString()); +Console.WriteLine(result.GetProperty("response_format").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); +Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); +]]> + + + +This sample shows how to call SubmitToolOutputsToRun and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + tool_outputs = new object[] + { + new object() + }, +}); +Response response = client.SubmitToolOutputsToRun("", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("expires_at").ToString()); +Console.WriteLine(result.GetProperty("started_at").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("cancelled_at").ToString()); +Console.WriteLine(result.GetProperty("failed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_choice").ToString()); +Console.WriteLine(result.GetProperty("response_format").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); +]]> +This sample shows how to call SubmitToolOutputsToRun with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + tool_outputs = new object[] + { + new + { + tool_call_id = "", + output = "", + } + }, + stream = true, +}); +Response response = client.SubmitToolOutputsToRun("", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("required_action").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("expires_at").ToString()); +Console.WriteLine(result.GetProperty("started_at").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("cancelled_at").ToString()); +Console.WriteLine(result.GetProperty("failed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); +Console.WriteLine(result.GetProperty("temperature").ToString()); +Console.WriteLine(result.GetProperty("top_p").ToString()); +Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("last_messages").ToString()); +Console.WriteLine(result.GetProperty("tool_choice").ToString()); +Console.WriteLine(result.GetProperty("response_format").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); +Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); +]]> + + + +This sample shows how to call CancelRunAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.CancelRunAsync("", ""); +]]> +This sample shows how to call CancelRunAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.CancelRunAsync("", ""); +]]> + + + +This sample shows how to call CancelRun. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.CancelRun("", ""); +]]> +This sample shows how to call CancelRun with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.CancelRun("", ""); +]]> + + + +This sample shows how to call CancelRunAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.CancelRunAsync("", "", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("expires_at").ToString()); +Console.WriteLine(result.GetProperty("started_at").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("cancelled_at").ToString()); +Console.WriteLine(result.GetProperty("failed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_choice").ToString()); +Console.WriteLine(result.GetProperty("response_format").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); +]]> +This sample shows how to call CancelRunAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.CancelRunAsync("", "", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("required_action").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("expires_at").ToString()); +Console.WriteLine(result.GetProperty("started_at").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("cancelled_at").ToString()); +Console.WriteLine(result.GetProperty("failed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); +Console.WriteLine(result.GetProperty("temperature").ToString()); +Console.WriteLine(result.GetProperty("top_p").ToString()); +Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("last_messages").ToString()); +Console.WriteLine(result.GetProperty("tool_choice").ToString()); +Console.WriteLine(result.GetProperty("response_format").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); +Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); +]]> + + + +This sample shows how to call CancelRun and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.CancelRun("", "", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("expires_at").ToString()); +Console.WriteLine(result.GetProperty("started_at").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("cancelled_at").ToString()); +Console.WriteLine(result.GetProperty("failed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_choice").ToString()); +Console.WriteLine(result.GetProperty("response_format").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); +]]> +This sample shows how to call CancelRun with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.CancelRun("", "", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("required_action").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("expires_at").ToString()); +Console.WriteLine(result.GetProperty("started_at").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("cancelled_at").ToString()); +Console.WriteLine(result.GetProperty("failed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); +Console.WriteLine(result.GetProperty("temperature").ToString()); +Console.WriteLine(result.GetProperty("top_p").ToString()); +Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("last_messages").ToString()); +Console.WriteLine(result.GetProperty("tool_choice").ToString()); +Console.WriteLine(result.GetProperty("response_format").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); +Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); +]]> + + + +This sample shows how to call CreateThreadAndRunAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.CreateThreadAndRunAsync(""); +]]> +This sample shows how to call CreateThreadAndRunAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +AgentThreadCreationOptions thread = new AgentThreadCreationOptions +{ + Messages = {new ThreadMessageOptions(MessageRole.User, "") + { + Attachments = {new MessageAttachment(new BinaryData[] + { + BinaryData.FromObjectAsJson(new + { + type = "code_interpreter", + }) + }) + { + FileId = "", + DataSource = new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset), + }}, + Metadata = + { + ["key"] = "" + }, + }}, + ToolResources = new ToolResources + { + CodeInterpreter = new CodeInterpreterToolResource + { + FileIds = { "" }, + DataSources = { default }, + }, + FileSearch = new FileSearchToolResource + { + VectorStoreIds = { "" }, + VectorStores = {new VectorStoreConfigurations("", new VectorStoreConfiguration(new VectorStoreDataSource[] + { + default + }))}, + }, + AzureAISearch = new AzureAISearchResource + { + IndexList = {new AISearchIndexResource("", "") + { + QueryType = AzureAISearchQueryType.Simple, + TopK = 1234, + Filter = "", + }}, + }, + }, + Metadata = + { + ["key"] = "" + }, +}; +UpdateToolResourcesOptions toolResources = new UpdateToolResourcesOptions +{ + CodeInterpreter = new UpdateCodeInterpreterToolResourceOptions + { + FileIds = { "" }, + }, + FileSearch = new UpdateFileSearchToolResourceOptions + { + VectorStoreIds = { "" }, + }, + AzureAISearch = default, +}; +TruncationObject truncationStrategy = new TruncationObject(TruncationStrategy.Auto) +{ + LastMessages = 1234, +}; +Response response = await client.CreateThreadAndRunAsync("", thread: thread, overrideModelName: "", overrideInstructions: "", overrideTools: new ToolDefinition[] +{ + new CodeInterpreterToolDefinition() +}, toolResources: toolResources, stream: true, temperature: 123.45F, topP: 123.45F, maxPromptTokens: 1234, maxCompletionTokens: 1234, truncationStrategy: truncationStrategy, toolChoice: BinaryData.FromObjectAsJson(""), responseFormat: BinaryData.FromObjectAsJson(""), parallelToolCalls: true, metadata: new Dictionary +{ + ["key"] = "" +}); +]]> + + + +This sample shows how to call CreateThreadAndRun. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.CreateThreadAndRun(""); +]]> +This sample shows how to call CreateThreadAndRun with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +AgentThreadCreationOptions thread = new AgentThreadCreationOptions +{ + Messages = {new ThreadMessageOptions(MessageRole.User, "") + { + Attachments = {new MessageAttachment(new BinaryData[] + { + BinaryData.FromObjectAsJson(new + { + type = "code_interpreter", + }) + }) + { + FileId = "", + DataSource = new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset), + }}, + Metadata = + { + ["key"] = "" + }, + }}, + ToolResources = new ToolResources + { + CodeInterpreter = new CodeInterpreterToolResource + { + FileIds = { "" }, + DataSources = { default }, + }, + FileSearch = new FileSearchToolResource + { + VectorStoreIds = { "" }, + VectorStores = {new VectorStoreConfigurations("", new VectorStoreConfiguration(new VectorStoreDataSource[] + { + default + }))}, + }, + AzureAISearch = new AzureAISearchResource + { + IndexList = {new AISearchIndexResource("", "") + { + QueryType = AzureAISearchQueryType.Simple, + TopK = 1234, + Filter = "", + }}, + }, + }, + Metadata = + { + ["key"] = "" + }, +}; +UpdateToolResourcesOptions toolResources = new UpdateToolResourcesOptions +{ + CodeInterpreter = new UpdateCodeInterpreterToolResourceOptions + { + FileIds = { "" }, + }, + FileSearch = new UpdateFileSearchToolResourceOptions + { + VectorStoreIds = { "" }, + }, + AzureAISearch = default, +}; +TruncationObject truncationStrategy = new TruncationObject(TruncationStrategy.Auto) +{ + LastMessages = 1234, +}; +Response response = client.CreateThreadAndRun("", thread: thread, overrideModelName: "", overrideInstructions: "", overrideTools: new ToolDefinition[] +{ + new CodeInterpreterToolDefinition() +}, toolResources: toolResources, stream: true, temperature: 123.45F, topP: 123.45F, maxPromptTokens: 1234, maxCompletionTokens: 1234, truncationStrategy: truncationStrategy, toolChoice: BinaryData.FromObjectAsJson(""), responseFormat: BinaryData.FromObjectAsJson(""), parallelToolCalls: true, metadata: new Dictionary +{ + ["key"] = "" +}); +]]> + + + +This sample shows how to call CreateThreadAndRunAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + assistant_id = "", +}); +Response response = await client.CreateThreadAndRunAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("expires_at").ToString()); +Console.WriteLine(result.GetProperty("started_at").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("cancelled_at").ToString()); +Console.WriteLine(result.GetProperty("failed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_choice").ToString()); +Console.WriteLine(result.GetProperty("response_format").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); +]]> +This sample shows how to call CreateThreadAndRunAsync with all request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + assistant_id = "", + thread = new + { + messages = new object[] + { + new + { + role = "user", + content = "", + attachments = new object[] + { + new + { + file_id = "", + data_source = new + { + uri = "", + type = "uri_asset", + }, + tools = new object[] + { + new + { + type = "code_interpreter", + } + }, + } + }, + metadata = new + { + key = "", + }, + } + }, + tool_resources = new + { + code_interpreter = new + { + file_ids = new object[] + { + "" + }, + data_sources = new object[] + { + null + }, + }, + file_search = new + { + vector_store_ids = new object[] + { + "" + }, + vector_stores = new object[] + { + new + { + name = "", + configuration = new + { + data_sources = new object[] + { + null + }, + }, + } + }, + }, + azure_ai_search = new + { + indexes = new object[] + { + new + { + index_connection_id = "", + index_name = "", + query_type = "simple", + top_k = 1234, + filter = "", + } + }, + }, + }, + metadata = new + { + key = "", + }, + }, + model = "", + instructions = "", + tools = new object[] + { + new + { + type = "code_interpreter", + } + }, + tool_resources = new + { + code_interpreter = new + { + file_ids = new object[] + { + "" + }, + }, + file_search = new + { + vector_store_ids = new object[] + { + "" + }, + }, + }, + stream = true, + temperature = 123.45F, + top_p = 123.45F, + max_prompt_tokens = 1234, + max_completion_tokens = 1234, + truncation_strategy = new + { + type = "auto", + last_messages = 1234, + }, + tool_choice = "", + response_format = "", + parallel_tool_calls = true, + metadata = new + { + key = "", + }, +}); +Response response = await client.CreateThreadAndRunAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("required_action").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("expires_at").ToString()); +Console.WriteLine(result.GetProperty("started_at").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("cancelled_at").ToString()); +Console.WriteLine(result.GetProperty("failed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); +Console.WriteLine(result.GetProperty("temperature").ToString()); +Console.WriteLine(result.GetProperty("top_p").ToString()); +Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("last_messages").ToString()); +Console.WriteLine(result.GetProperty("tool_choice").ToString()); +Console.WriteLine(result.GetProperty("response_format").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); +Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); +]]> + + + +This sample shows how to call CreateThreadAndRun and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + assistant_id = "", +}); +Response response = client.CreateThreadAndRun(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("expires_at").ToString()); +Console.WriteLine(result.GetProperty("started_at").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("cancelled_at").ToString()); +Console.WriteLine(result.GetProperty("failed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("tool_choice").ToString()); +Console.WriteLine(result.GetProperty("response_format").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); +]]> +This sample shows how to call CreateThreadAndRun with all request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + assistant_id = "", + thread = new + { + messages = new object[] + { + new + { + role = "user", + content = "", + attachments = new object[] + { + new + { + file_id = "", + data_source = new + { + uri = "", + type = "uri_asset", + }, + tools = new object[] + { + new + { + type = "code_interpreter", + } + }, + } + }, + metadata = new + { + key = "", + }, + } + }, + tool_resources = new + { + code_interpreter = new + { + file_ids = new object[] + { + "" + }, + data_sources = new object[] + { + null + }, + }, + file_search = new + { + vector_store_ids = new object[] + { + "" + }, + vector_stores = new object[] + { + new + { + name = "", + configuration = new + { + data_sources = new object[] + { + null + }, + }, + } + }, + }, + azure_ai_search = new + { + indexes = new object[] + { + new + { + index_connection_id = "", + index_name = "", + query_type = "simple", + top_k = 1234, + filter = "", + } + }, + }, + }, + metadata = new + { + key = "", + }, + }, + model = "", + instructions = "", + tools = new object[] + { + new + { + type = "code_interpreter", + } + }, + tool_resources = new + { + code_interpreter = new + { + file_ids = new object[] + { + "" + }, + }, + file_search = new + { + vector_store_ids = new object[] + { + "" + }, + }, + }, + stream = true, + temperature = 123.45F, + top_p = 123.45F, + max_prompt_tokens = 1234, + max_completion_tokens = 1234, + truncation_strategy = new + { + type = "auto", + last_messages = 1234, + }, + tool_choice = "", + response_format = "", + parallel_tool_calls = true, + metadata = new + { + key = "", + }, +}); +Response response = client.CreateThreadAndRun(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("required_action").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("model").ToString()); +Console.WriteLine(result.GetProperty("instructions").ToString()); +Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("expires_at").ToString()); +Console.WriteLine(result.GetProperty("started_at").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("cancelled_at").ToString()); +Console.WriteLine(result.GetProperty("failed_at").ToString()); +Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); +Console.WriteLine(result.GetProperty("temperature").ToString()); +Console.WriteLine(result.GetProperty("top_p").ToString()); +Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("last_messages").ToString()); +Console.WriteLine(result.GetProperty("tool_choice").ToString()); +Console.WriteLine(result.GetProperty("response_format").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); +Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); +Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); +]]> + + + +This sample shows how to call GetRunStepAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetRunStepAsync("", "", ""); +]]> +This sample shows how to call GetRunStepAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetRunStepAsync("", "", "", include: new RunAdditionalFieldList[] { RunAdditionalFieldList.FileSearchContents }); +]]> + + + +This sample shows how to call GetRunStep. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetRunStep("", "", ""); +]]> +This sample shows how to call GetRunStep with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetRunStep("", "", "", include: new RunAdditionalFieldList[] { RunAdditionalFieldList.FileSearchContents }); +]]> + + + +This sample shows how to call GetRunStepAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetRunStepAsync("", "", "", null, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("run_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("step_details").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("expired_at").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("cancelled_at").ToString()); +Console.WriteLine(result.GetProperty("failed_at").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> +This sample shows how to call GetRunStepAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetRunStepAsync("", "", "", new RunAdditionalFieldList[] { RunAdditionalFieldList.FileSearchContents }, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("run_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("step_details").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("expired_at").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("cancelled_at").ToString()); +Console.WriteLine(result.GetProperty("failed_at").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call GetRunStep and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetRunStep("", "", "", null, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("run_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("step_details").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("expired_at").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("cancelled_at").ToString()); +Console.WriteLine(result.GetProperty("failed_at").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> +This sample shows how to call GetRunStep with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetRunStep("", "", "", new RunAdditionalFieldList[] { RunAdditionalFieldList.FileSearchContents }, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("assistant_id").ToString()); +Console.WriteLine(result.GetProperty("thread_id").ToString()); +Console.WriteLine(result.GetProperty("run_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("step_details").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("expired_at").ToString()); +Console.WriteLine(result.GetProperty("completed_at").ToString()); +Console.WriteLine(result.GetProperty("cancelled_at").ToString()); +Console.WriteLine(result.GetProperty("failed_at").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); +Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call UploadFileAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +UploadFileRequest body = new UploadFileRequest(new File(BinaryData.FromObjectAsJson(new object())), OpenAIFilePurpose.FineTune); +Response response = await client.UploadFileAsync(body); +]]> +This sample shows how to call UploadFileAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +UploadFileRequest body = new UploadFileRequest(new File(BinaryData.FromObjectAsJson(new object())) +{ + ContentType = "", + Filename = "", +}, OpenAIFilePurpose.FineTune) +{ + Filename = "", +}; +Response response = await client.UploadFileAsync(body); +]]> + + + +This sample shows how to call UploadFile. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +UploadFileRequest body = new UploadFileRequest(new File(BinaryData.FromObjectAsJson(new object())), OpenAIFilePurpose.FineTune); +Response response = client.UploadFile(body); +]]> +This sample shows how to call UploadFile with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +UploadFileRequest body = new UploadFileRequest(new File(BinaryData.FromObjectAsJson(new object())) +{ + ContentType = "", + Filename = "", +}, OpenAIFilePurpose.FineTune) +{ + Filename = "", +}; +Response response = client.UploadFile(body); +]]> + + + +This sample shows how to call UploadFileAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + file = new + { + contents = new object(), + }, + purpose = "fine-tune", +}); +Response response = await client.UploadFileAsync(content, "multipart/form-data"); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("bytes").ToString()); +Console.WriteLine(result.GetProperty("filename").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("purpose").ToString()); +]]> +This sample shows how to call UploadFileAsync with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + file = new + { + contentType = "", + filename = "", + contents = new object(), + }, + purpose = "fine-tune", + filename = "", +}); +Response response = await client.UploadFileAsync(content, "multipart/form-data"); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("bytes").ToString()); +Console.WriteLine(result.GetProperty("filename").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("purpose").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("status_details").ToString()); +]]> + + + +This sample shows how to call UploadFile and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + file = new + { + contents = new object(), + }, + purpose = "fine-tune", +}); +Response response = client.UploadFile(content, "multipart/form-data"); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("bytes").ToString()); +Console.WriteLine(result.GetProperty("filename").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("purpose").ToString()); +]]> +This sample shows how to call UploadFile with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + file = new + { + contentType = "", + filename = "", + contents = new object(), + }, + purpose = "fine-tune", + filename = "", +}); +Response response = client.UploadFile(content, "multipart/form-data"); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("bytes").ToString()); +Console.WriteLine(result.GetProperty("filename").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("purpose").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("status_details").ToString()); +]]> + + + +This sample shows how to call GetFileAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetFileAsync(""); +]]> +This sample shows how to call GetFileAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetFileAsync(""); +]]> + + + +This sample shows how to call GetFile. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetFile(""); +]]> +This sample shows how to call GetFile with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetFile(""); +]]> + + + +This sample shows how to call GetFileAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetFileAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("bytes").ToString()); +Console.WriteLine(result.GetProperty("filename").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("purpose").ToString()); +]]> +This sample shows how to call GetFileAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetFileAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("bytes").ToString()); +Console.WriteLine(result.GetProperty("filename").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("purpose").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("status_details").ToString()); +]]> + + + +This sample shows how to call GetFile and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetFile("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("bytes").ToString()); +Console.WriteLine(result.GetProperty("filename").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("purpose").ToString()); +]]> +This sample shows how to call GetFile with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetFile("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("bytes").ToString()); +Console.WriteLine(result.GetProperty("filename").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("purpose").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("status_details").ToString()); +]]> + + + +This sample shows how to call GetFileContentAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetFileContentAsync(""); +]]> +This sample shows how to call GetFileContentAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetFileContentAsync(""); +]]> + + + +This sample shows how to call GetFileContent. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetFileContent(""); +]]> +This sample shows how to call GetFileContent with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetFileContent(""); +]]> + + + +This sample shows how to call GetFileContentAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetFileContentAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> +This sample shows how to call GetFileContentAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetFileContentAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> + + + +This sample shows how to call GetFileContent and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetFileContent("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> +This sample shows how to call GetFileContent with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetFileContent("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> + + + +This sample shows how to call GetVectorStoresAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetVectorStoresAsync(); +]]> +This sample shows how to call GetVectorStoresAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetVectorStoresAsync(limit: 1234, order: ListSortOrder.Ascending, after: "", before: ""); +]]> + + + +This sample shows how to call GetVectorStores. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetVectorStores(); +]]> +This sample shows how to call GetVectorStores with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetVectorStores(limit: 1234, order: ListSortOrder.Ascending, after: "", before: ""); +]]> + + + +This sample shows how to call GetVectorStoresAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetVectorStoresAsync(null, null, null, null, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("total").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_active_at").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("metadata").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("first_id").ToString()); +Console.WriteLine(result.GetProperty("last_id").ToString()); +Console.WriteLine(result.GetProperty("has_more").ToString()); +]]> +This sample shows how to call GetVectorStoresAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetVectorStoresAsync(1234, "asc", "", "", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("total").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("expires_after").GetProperty("anchor").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("expires_after").GetProperty("days").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("expires_at").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_active_at").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("metadata").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("first_id").ToString()); +Console.WriteLine(result.GetProperty("last_id").ToString()); +Console.WriteLine(result.GetProperty("has_more").ToString()); +]]> + + + +This sample shows how to call GetVectorStores and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetVectorStores(null, null, null, null, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("total").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_active_at").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("metadata").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("first_id").ToString()); +Console.WriteLine(result.GetProperty("last_id").ToString()); +Console.WriteLine(result.GetProperty("has_more").ToString()); +]]> +This sample shows how to call GetVectorStores with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetVectorStores(1234, "asc", "", "", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("total").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("expires_after").GetProperty("anchor").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("expires_after").GetProperty("days").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("expires_at").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_active_at").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("metadata").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("first_id").ToString()); +Console.WriteLine(result.GetProperty("last_id").ToString()); +Console.WriteLine(result.GetProperty("has_more").ToString()); +]]> + + + +This sample shows how to call CreateVectorStoreAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.CreateVectorStoreAsync(); +]]> +This sample shows how to call CreateVectorStoreAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +VectorStoreConfiguration storeConfiguration = new VectorStoreConfiguration(new VectorStoreDataSource[] +{ + new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset) +}); +VectorStoreExpirationPolicy expiresAfter = new VectorStoreExpirationPolicy(VectorStoreExpirationPolicyAnchor.LastActiveAt, 1234); +VectorStoreChunkingStrategyRequest chunkingStrategy = new VectorStoreAutoChunkingStrategyRequest(); +Response response = await client.CreateVectorStoreAsync(fileIds: new string[] { "" }, name: "", storeConfiguration: storeConfiguration, expiresAfter: expiresAfter, chunkingStrategy: chunkingStrategy, metadata: new Dictionary +{ + ["key"] = "" +}); +]]> + + + +This sample shows how to call CreateVectorStore. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.CreateVectorStore(); +]]> +This sample shows how to call CreateVectorStore with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +VectorStoreConfiguration storeConfiguration = new VectorStoreConfiguration(new VectorStoreDataSource[] +{ + new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset) +}); +VectorStoreExpirationPolicy expiresAfter = new VectorStoreExpirationPolicy(VectorStoreExpirationPolicyAnchor.LastActiveAt, 1234); +VectorStoreChunkingStrategyRequest chunkingStrategy = new VectorStoreAutoChunkingStrategyRequest(); +Response response = client.CreateVectorStore(fileIds: new string[] { "" }, name: "", storeConfiguration: storeConfiguration, expiresAfter: expiresAfter, chunkingStrategy: chunkingStrategy, metadata: new Dictionary +{ + ["key"] = "" +}); +]]> + + + +This sample shows how to call CreateVectorStoreAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = await client.CreateVectorStoreAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_active_at").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> +This sample shows how to call CreateVectorStoreAsync with all request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + file_ids = new object[] + { + "" + }, + name = "", + configuration = new + { + data_sources = new object[] + { + new + { + uri = "", + type = "uri_asset", + } + }, + }, + expires_after = new + { + anchor = "last_active_at", + days = 1234, + }, + chunking_strategy = new + { + type = "auto", + }, + metadata = new + { + key = "", + }, +}); +Response response = await client.CreateVectorStoreAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("expires_after").GetProperty("anchor").ToString()); +Console.WriteLine(result.GetProperty("expires_after").GetProperty("days").ToString()); +Console.WriteLine(result.GetProperty("expires_at").ToString()); +Console.WriteLine(result.GetProperty("last_active_at").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call CreateVectorStore and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = client.CreateVectorStore(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_active_at").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> +This sample shows how to call CreateVectorStore with all request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + file_ids = new object[] + { + "" + }, + name = "", + configuration = new + { + data_sources = new object[] + { + new + { + uri = "", + type = "uri_asset", + } + }, + }, + expires_after = new + { + anchor = "last_active_at", + days = 1234, + }, + chunking_strategy = new + { + type = "auto", + }, + metadata = new + { + key = "", + }, +}); +Response response = client.CreateVectorStore(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("expires_after").GetProperty("anchor").ToString()); +Console.WriteLine(result.GetProperty("expires_after").GetProperty("days").ToString()); +Console.WriteLine(result.GetProperty("expires_at").ToString()); +Console.WriteLine(result.GetProperty("last_active_at").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call GetVectorStoreAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetVectorStoreAsync(""); +]]> +This sample shows how to call GetVectorStoreAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetVectorStoreAsync(""); +]]> + + + +This sample shows how to call GetVectorStore. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetVectorStore(""); +]]> +This sample shows how to call GetVectorStore with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetVectorStore(""); +]]> + + + +This sample shows how to call GetVectorStoreAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetVectorStoreAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_active_at").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> +This sample shows how to call GetVectorStoreAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetVectorStoreAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("expires_after").GetProperty("anchor").ToString()); +Console.WriteLine(result.GetProperty("expires_after").GetProperty("days").ToString()); +Console.WriteLine(result.GetProperty("expires_at").ToString()); +Console.WriteLine(result.GetProperty("last_active_at").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call GetVectorStore and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetVectorStore("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_active_at").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> +This sample shows how to call GetVectorStore with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetVectorStore("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("expires_after").GetProperty("anchor").ToString()); +Console.WriteLine(result.GetProperty("expires_after").GetProperty("days").ToString()); +Console.WriteLine(result.GetProperty("expires_at").ToString()); +Console.WriteLine(result.GetProperty("last_active_at").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call ModifyVectorStoreAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.ModifyVectorStoreAsync(""); +]]> +This sample shows how to call ModifyVectorStoreAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +VectorStoreExpirationPolicy expiresAfter = new VectorStoreExpirationPolicy(VectorStoreExpirationPolicyAnchor.LastActiveAt, 1234); +Response response = await client.ModifyVectorStoreAsync("", name: "", expiresAfter: expiresAfter, metadata: new Dictionary +{ + ["key"] = "" +}); +]]> + + + +This sample shows how to call ModifyVectorStore. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.ModifyVectorStore(""); +]]> +This sample shows how to call ModifyVectorStore with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +VectorStoreExpirationPolicy expiresAfter = new VectorStoreExpirationPolicy(VectorStoreExpirationPolicyAnchor.LastActiveAt, 1234); +Response response = client.ModifyVectorStore("", name: "", expiresAfter: expiresAfter, metadata: new Dictionary +{ + ["key"] = "" +}); +]]> + + + +This sample shows how to call ModifyVectorStoreAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = await client.ModifyVectorStoreAsync("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_active_at").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> +This sample shows how to call ModifyVectorStoreAsync with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + name = "", + expires_after = new + { + anchor = "last_active_at", + days = 1234, + }, + metadata = new + { + key = "", + }, +}); +Response response = await client.ModifyVectorStoreAsync("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("expires_after").GetProperty("anchor").ToString()); +Console.WriteLine(result.GetProperty("expires_after").GetProperty("days").ToString()); +Console.WriteLine(result.GetProperty("expires_at").ToString()); +Console.WriteLine(result.GetProperty("last_active_at").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call ModifyVectorStore and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = client.ModifyVectorStore("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_active_at").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> +This sample shows how to call ModifyVectorStore with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + name = "", + expires_after = new + { + anchor = "last_active_at", + days = 1234, + }, + metadata = new + { + key = "", + }, +}); +Response response = client.ModifyVectorStore("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("expires_after").GetProperty("anchor").ToString()); +Console.WriteLine(result.GetProperty("expires_after").GetProperty("days").ToString()); +Console.WriteLine(result.GetProperty("expires_at").ToString()); +Console.WriteLine(result.GetProperty("last_active_at").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call DeleteVectorStoreAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.DeleteVectorStoreAsync(""); +]]> +This sample shows how to call DeleteVectorStoreAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.DeleteVectorStoreAsync(""); +]]> + + + +This sample shows how to call DeleteVectorStore. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.DeleteVectorStore(""); +]]> +This sample shows how to call DeleteVectorStore with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.DeleteVectorStore(""); +]]> + + + +This sample shows how to call DeleteVectorStoreAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.DeleteVectorStoreAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("deleted").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +]]> +This sample shows how to call DeleteVectorStoreAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.DeleteVectorStoreAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("deleted").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +]]> + + + +This sample shows how to call DeleteVectorStore and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.DeleteVectorStore("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("deleted").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +]]> +This sample shows how to call DeleteVectorStore with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.DeleteVectorStore("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("deleted").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +]]> + + + +This sample shows how to call GetVectorStoreFilesAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetVectorStoreFilesAsync(""); +]]> +This sample shows how to call GetVectorStoreFilesAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetVectorStoreFilesAsync("", filter: VectorStoreFileStatusFilter.InProgress, limit: 1234, order: ListSortOrder.Ascending, after: "", before: ""); +]]> + + + +This sample shows how to call GetVectorStoreFiles. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetVectorStoreFiles(""); +]]> +This sample shows how to call GetVectorStoreFiles with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetVectorStoreFiles("", filter: VectorStoreFileStatusFilter.InProgress, limit: 1234, order: ListSortOrder.Ascending, after: "", before: ""); +]]> + + + +This sample shows how to call GetVectorStoreFilesAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetVectorStoreFilesAsync("", null, null, null, null, null, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("chunking_strategy").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("first_id").ToString()); +Console.WriteLine(result.GetProperty("last_id").ToString()); +Console.WriteLine(result.GetProperty("has_more").ToString()); +]]> +This sample shows how to call GetVectorStoreFilesAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetVectorStoreFilesAsync("", "in_progress", 1234, "asc", "", "", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("chunking_strategy").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("first_id").ToString()); +Console.WriteLine(result.GetProperty("last_id").ToString()); +Console.WriteLine(result.GetProperty("has_more").ToString()); +]]> + + + +This sample shows how to call GetVectorStoreFiles and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetVectorStoreFiles("", null, null, null, null, null, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("chunking_strategy").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("first_id").ToString()); +Console.WriteLine(result.GetProperty("last_id").ToString()); +Console.WriteLine(result.GetProperty("has_more").ToString()); +]]> +This sample shows how to call GetVectorStoreFiles with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetVectorStoreFiles("", "in_progress", 1234, "asc", "", "", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("chunking_strategy").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("first_id").ToString()); +Console.WriteLine(result.GetProperty("last_id").ToString()); +Console.WriteLine(result.GetProperty("has_more").ToString()); +]]> + + + +This sample shows how to call CreateVectorStoreFileAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.CreateVectorStoreFileAsync(""); +]]> +This sample shows how to call CreateVectorStoreFileAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +VectorStoreDataSource dataSource = new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset); +VectorStoreChunkingStrategyRequest chunkingStrategy = new VectorStoreAutoChunkingStrategyRequest(); +Response response = await client.CreateVectorStoreFileAsync("", fileId: "", dataSource: dataSource, chunkingStrategy: chunkingStrategy); +]]> + + + +This sample shows how to call CreateVectorStoreFile. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.CreateVectorStoreFile(""); +]]> +This sample shows how to call CreateVectorStoreFile with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +VectorStoreDataSource dataSource = new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset); +VectorStoreChunkingStrategyRequest chunkingStrategy = new VectorStoreAutoChunkingStrategyRequest(); +Response response = client.CreateVectorStoreFile("", fileId: "", dataSource: dataSource, chunkingStrategy: chunkingStrategy); +]]> + + + +This sample shows how to call CreateVectorStoreFileAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = await client.CreateVectorStoreFileAsync("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); +]]> +This sample shows how to call CreateVectorStoreFileAsync with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + file_id = "", + data_source = new + { + uri = "", + type = "uri_asset", + }, + chunking_strategy = new + { + type = "auto", + }, +}); +Response response = await client.CreateVectorStoreFileAsync("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); +]]> + + + +This sample shows how to call CreateVectorStoreFile and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = client.CreateVectorStoreFile("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); +]]> +This sample shows how to call CreateVectorStoreFile with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + file_id = "", + data_source = new + { + uri = "", + type = "uri_asset", + }, + chunking_strategy = new + { + type = "auto", + }, +}); +Response response = client.CreateVectorStoreFile("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); +]]> + + + +This sample shows how to call GetVectorStoreFileAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetVectorStoreFileAsync("", ""); +]]> +This sample shows how to call GetVectorStoreFileAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetVectorStoreFileAsync("", ""); +]]> + + + +This sample shows how to call GetVectorStoreFile. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetVectorStoreFile("", ""); +]]> +This sample shows how to call GetVectorStoreFile with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetVectorStoreFile("", ""); +]]> + + + +This sample shows how to call GetVectorStoreFileAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetVectorStoreFileAsync("", "", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); +]]> +This sample shows how to call GetVectorStoreFileAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetVectorStoreFileAsync("", "", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); +]]> + + + +This sample shows how to call GetVectorStoreFile and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetVectorStoreFile("", "", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); +]]> +This sample shows how to call GetVectorStoreFile with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetVectorStoreFile("", "", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); +]]> + + + +This sample shows how to call DeleteVectorStoreFileAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.DeleteVectorStoreFileAsync("", ""); +]]> +This sample shows how to call DeleteVectorStoreFileAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.DeleteVectorStoreFileAsync("", ""); +]]> + + + +This sample shows how to call DeleteVectorStoreFile. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.DeleteVectorStoreFile("", ""); +]]> +This sample shows how to call DeleteVectorStoreFile with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.DeleteVectorStoreFile("", ""); +]]> + + + +This sample shows how to call DeleteVectorStoreFileAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.DeleteVectorStoreFileAsync("", "", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("deleted").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +]]> +This sample shows how to call DeleteVectorStoreFileAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.DeleteVectorStoreFileAsync("", "", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("deleted").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +]]> + + + +This sample shows how to call DeleteVectorStoreFile and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.DeleteVectorStoreFile("", "", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("deleted").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +]]> +This sample shows how to call DeleteVectorStoreFile with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.DeleteVectorStoreFile("", "", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("deleted").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +]]> + + + +This sample shows how to call CreateVectorStoreFileBatchAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.CreateVectorStoreFileBatchAsync(""); +]]> +This sample shows how to call CreateVectorStoreFileBatchAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +VectorStoreChunkingStrategyRequest chunkingStrategy = new VectorStoreAutoChunkingStrategyRequest(); +Response response = await client.CreateVectorStoreFileBatchAsync("", fileIds: new string[] { "" }, dataSources: new VectorStoreDataSource[] +{ + new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset) +}, chunkingStrategy: chunkingStrategy); +]]> + + + +This sample shows how to call CreateVectorStoreFileBatch. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.CreateVectorStoreFileBatch(""); +]]> +This sample shows how to call CreateVectorStoreFileBatch with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +VectorStoreChunkingStrategyRequest chunkingStrategy = new VectorStoreAutoChunkingStrategyRequest(); +Response response = client.CreateVectorStoreFileBatch("", fileIds: new string[] { "" }, dataSources: new VectorStoreDataSource[] +{ + new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset) +}, chunkingStrategy: chunkingStrategy); +]]> + + + +This sample shows how to call CreateVectorStoreFileBatchAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = await client.CreateVectorStoreFileBatchAsync("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +]]> +This sample shows how to call CreateVectorStoreFileBatchAsync with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + file_ids = new object[] + { + "" + }, + data_sources = new object[] + { + new + { + uri = "", + type = "uri_asset", + } + }, + chunking_strategy = new + { + type = "auto", + }, +}); +Response response = await client.CreateVectorStoreFileBatchAsync("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +]]> + + + +This sample shows how to call CreateVectorStoreFileBatch and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = client.CreateVectorStoreFileBatch("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +]]> +This sample shows how to call CreateVectorStoreFileBatch with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + file_ids = new object[] + { + "" + }, + data_sources = new object[] + { + new + { + uri = "", + type = "uri_asset", + } + }, + chunking_strategy = new + { + type = "auto", + }, +}); +Response response = client.CreateVectorStoreFileBatch("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +]]> + + + +This sample shows how to call GetVectorStoreFileBatchAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetVectorStoreFileBatchAsync("", ""); +]]> +This sample shows how to call GetVectorStoreFileBatchAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetVectorStoreFileBatchAsync("", ""); +]]> + + + +This sample shows how to call GetVectorStoreFileBatch. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetVectorStoreFileBatch("", ""); +]]> +This sample shows how to call GetVectorStoreFileBatch with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetVectorStoreFileBatch("", ""); +]]> + + + +This sample shows how to call GetVectorStoreFileBatchAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetVectorStoreFileBatchAsync("", "", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +]]> +This sample shows how to call GetVectorStoreFileBatchAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetVectorStoreFileBatchAsync("", "", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +]]> + + + +This sample shows how to call GetVectorStoreFileBatch and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetVectorStoreFileBatch("", "", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +]]> +This sample shows how to call GetVectorStoreFileBatch with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetVectorStoreFileBatch("", "", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +]]> + + + +This sample shows how to call CancelVectorStoreFileBatchAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.CancelVectorStoreFileBatchAsync("", ""); +]]> +This sample shows how to call CancelVectorStoreFileBatchAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.CancelVectorStoreFileBatchAsync("", ""); +]]> + + + +This sample shows how to call CancelVectorStoreFileBatch. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.CancelVectorStoreFileBatch("", ""); +]]> +This sample shows how to call CancelVectorStoreFileBatch with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.CancelVectorStoreFileBatch("", ""); +]]> + + + +This sample shows how to call CancelVectorStoreFileBatchAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.CancelVectorStoreFileBatchAsync("", "", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +]]> +This sample shows how to call CancelVectorStoreFileBatchAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.CancelVectorStoreFileBatchAsync("", "", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +]]> + + + +This sample shows how to call CancelVectorStoreFileBatch and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.CancelVectorStoreFileBatch("", "", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +]]> +This sample shows how to call CancelVectorStoreFileBatch with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.CancelVectorStoreFileBatch("", "", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +]]> + + + +This sample shows how to call GetVectorStoreFileBatchFilesAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetVectorStoreFileBatchFilesAsync("", ""); +]]> +This sample shows how to call GetVectorStoreFileBatchFilesAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetVectorStoreFileBatchFilesAsync("", "", filter: VectorStoreFileStatusFilter.InProgress, limit: 1234, order: ListSortOrder.Ascending, after: "", before: ""); +]]> + + + +This sample shows how to call GetVectorStoreFileBatchFiles. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetVectorStoreFileBatchFiles("", ""); +]]> +This sample shows how to call GetVectorStoreFileBatchFiles with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetVectorStoreFileBatchFiles("", "", filter: VectorStoreFileStatusFilter.InProgress, limit: 1234, order: ListSortOrder.Ascending, after: "", before: ""); +]]> + + + +This sample shows how to call GetVectorStoreFileBatchFilesAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetVectorStoreFileBatchFilesAsync("", "", null, null, null, null, null, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("chunking_strategy").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("first_id").ToString()); +Console.WriteLine(result.GetProperty("last_id").ToString()); +Console.WriteLine(result.GetProperty("has_more").ToString()); +]]> +This sample shows how to call GetVectorStoreFileBatchFilesAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = await client.GetVectorStoreFileBatchFilesAsync("", "", "in_progress", 1234, "asc", "", "", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("chunking_strategy").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("first_id").ToString()); +Console.WriteLine(result.GetProperty("last_id").ToString()); +Console.WriteLine(result.GetProperty("has_more").ToString()); +]]> + + + +This sample shows how to call GetVectorStoreFileBatchFiles and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetVectorStoreFileBatchFiles("", "", null, null, null, null, null, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("chunking_strategy").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("first_id").ToString()); +Console.WriteLine(result.GetProperty("last_id").ToString()); +Console.WriteLine(result.GetProperty("has_more").ToString()); +]]> +This sample shows how to call GetVectorStoreFileBatchFiles with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AIAssistantClient client = new AIAssistantClient(endpoint, credential); + +Response response = client.GetVectorStoreFileBatchFiles("", "", "in_progress", 1234, "asc", "", "", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("data")[0].GetProperty("chunking_strategy").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("first_id").ToString()); +Console.WriteLine(result.GetProperty("last_id").ToString()); +Console.WriteLine(result.GetProperty("has_more").ToString()); +]]> + + + \ No newline at end of file diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/DoneEvent.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/DoneEvent.cs new file mode 100644 index 000000000000..0cecf7b5b88e --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/DoneEvent.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// Terminal event indicating the successful end of a stream. + public readonly partial struct DoneEvent : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DoneEvent(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DoneValue = "done"; + + /// Event sent when the stream is done. + public static DoneEvent Done { get; } = new DoneEvent(DoneValue); + /// Determines if two values are the same. + public static bool operator ==(DoneEvent left, DoneEvent right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DoneEvent left, DoneEvent right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DoneEvent(string value) => new DoneEvent(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DoneEvent other && Equals(other); + /// + public bool Equals(DoneEvent other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/ErrorEvent.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/ErrorEvent.cs new file mode 100644 index 000000000000..a74b656128d2 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/ErrorEvent.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// Terminal event indicating a server side error while streaming. + public readonly partial struct ErrorEvent : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ErrorEvent(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ErrorValue = "error"; + + /// Event sent when an error occurs, such as an internal server error or a timeout. + public static ErrorEvent Error { get; } = new ErrorEvent(ErrorValue); + /// Determines if two values are the same. + public static bool operator ==(ErrorEvent left, ErrorEvent right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ErrorEvent left, ErrorEvent right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ErrorEvent(string value) => new ErrorEvent(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ErrorEvent other && Equals(other); + /// + public bool Equals(ErrorEvent other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/File.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/File.Serialization.cs new file mode 100644 index 000000000000..cb4f6d07b710 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/File.Serialization.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class File : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(File)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ContentType)) + { + writer.WritePropertyName("contentType"u8); + writer.WriteStringValue(ContentType); + } + if (Optional.IsDefined(Filename)) + { + writer.WritePropertyName("filename"u8); + writer.WriteStringValue(Filename); + } + writer.WritePropertyName("contents"u8); + writer.WriteBase64StringValue(Contents.ToArray(), "D"); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + File IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(File)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFile(document.RootElement, options); + } + + internal static File DeserializeFile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string contentType = default; + string filename = default; + BinaryData contents = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("contentType"u8)) + { + contentType = property.Value.GetString(); + continue; + } + if (property.NameEquals("filename"u8)) + { + filename = property.Value.GetString(); + continue; + } + if (property.NameEquals("contents"u8)) + { + contents = BinaryData.FromBytes(property.Value.GetBytesFromBase64("D")); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new File(contentType, filename, contents, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(File)} does not support writing '{options.Format}' format."); + } + } + + File IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(File)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static File FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFile(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/File.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/File.cs new file mode 100644 index 000000000000..716b87c25ac6 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/File.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The File. + public partial class File + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// + /// is null. + public File(BinaryData contents) + { + Argument.AssertNotNull(contents, nameof(contents)); + + Contents = contents; + } + + /// Initializes a new instance of . + /// + /// + /// + /// Keeps track of any properties unknown to the library. + internal File(string contentType, string filename, BinaryData contents, IDictionary serializedAdditionalRawData) + { + ContentType = contentType; + Filename = filename; + Contents = contents; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal File() + { + } + + /// Gets or sets the content type. + public string ContentType { get; set; } + /// Gets or sets the filename. + public string Filename { get; set; } + /// + /// Gets the contents + /// + /// To assign a byte[] to this property use . + /// The byte[] will be serialized to a Base64 encoded string. + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromBytes(new byte[] { 1, 2, 3 }) + /// Creates a payload of "AQID". + /// + /// + /// + /// + public BinaryData Contents { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchRankingOptions.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchRankingOptions.Serialization.cs new file mode 100644 index 000000000000..4210a19d86dc --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchRankingOptions.Serialization.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class FileSearchRankingOptions : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FileSearchRankingOptions)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("ranker"u8); + writer.WriteStringValue(Ranker); + writer.WritePropertyName("score_threshold"u8); + writer.WriteNumberValue(ScoreThreshold); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + FileSearchRankingOptions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FileSearchRankingOptions)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFileSearchRankingOptions(document.RootElement, options); + } + + internal static FileSearchRankingOptions DeserializeFileSearchRankingOptions(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string ranker = default; + float scoreThreshold = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("ranker"u8)) + { + ranker = property.Value.GetString(); + continue; + } + if (property.NameEquals("score_threshold"u8)) + { + scoreThreshold = property.Value.GetSingle(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FileSearchRankingOptions(ranker, scoreThreshold, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(FileSearchRankingOptions)} does not support writing '{options.Format}' format."); + } + } + + FileSearchRankingOptions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFileSearchRankingOptions(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FileSearchRankingOptions)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static FileSearchRankingOptions FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFileSearchRankingOptions(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchRankingOptions.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchRankingOptions.cs new file mode 100644 index 000000000000..4d1b21adbd93 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchRankingOptions.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Ranking options for file search. + public partial class FileSearchRankingOptions + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// File search ranker. + /// Ranker search threshold. + /// is null. + public FileSearchRankingOptions(string ranker, float scoreThreshold) + { + Argument.AssertNotNull(ranker, nameof(ranker)); + + Ranker = ranker; + ScoreThreshold = scoreThreshold; + } + + /// Initializes a new instance of . + /// File search ranker. + /// Ranker search threshold. + /// Keeps track of any properties unknown to the library. + internal FileSearchRankingOptions(string ranker, float scoreThreshold, IDictionary serializedAdditionalRawData) + { + Ranker = ranker; + ScoreThreshold = scoreThreshold; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal FileSearchRankingOptions() + { + } + + /// File search ranker. + public string Ranker { get; set; } + /// Ranker search threshold. + public float ScoreThreshold { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolCallContent.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolCallContent.Serialization.cs new file mode 100644 index 000000000000..6011e4e8cd8e --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolCallContent.Serialization.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class FileSearchToolCallContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FileSearchToolCallContent)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type.ToString()); + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + FileSearchToolCallContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FileSearchToolCallContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFileSearchToolCallContent(document.RootElement, options); + } + + internal static FileSearchToolCallContent DeserializeFileSearchToolCallContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + FileSearchToolCallContentType type = default; + string text = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new FileSearchToolCallContentType(property.Value.GetString()); + continue; + } + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FileSearchToolCallContent(type, text, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(FileSearchToolCallContent)} does not support writing '{options.Format}' format."); + } + } + + FileSearchToolCallContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFileSearchToolCallContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FileSearchToolCallContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static FileSearchToolCallContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFileSearchToolCallContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolCallContent.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolCallContent.cs new file mode 100644 index 000000000000..571eb8d66bb0 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolCallContent.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The file search result content object. + public partial class FileSearchToolCallContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The text content of the file. + /// is null. + internal FileSearchToolCallContent(string text) + { + Argument.AssertNotNull(text, nameof(text)); + + Text = text; + } + + /// Initializes a new instance of . + /// The type of the content. + /// The text content of the file. + /// Keeps track of any properties unknown to the library. + internal FileSearchToolCallContent(FileSearchToolCallContentType type, string text, IDictionary serializedAdditionalRawData) + { + Type = type; + Text = text; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal FileSearchToolCallContent() + { + } + + /// The type of the content. + public FileSearchToolCallContentType Type { get; } = FileSearchToolCallContentType.Text; + + /// The text content of the file. + public string Text { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolCallContentType.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolCallContentType.cs new file mode 100644 index 000000000000..db29542234c4 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolCallContentType.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// The FileSearchToolCallContent_type. + public readonly partial struct FileSearchToolCallContentType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public FileSearchToolCallContentType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string TextValue = "text"; + + /// text. + public static FileSearchToolCallContentType Text { get; } = new FileSearchToolCallContentType(TextValue); + /// Determines if two values are the same. + public static bool operator ==(FileSearchToolCallContentType left, FileSearchToolCallContentType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(FileSearchToolCallContentType left, FileSearchToolCallContentType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator FileSearchToolCallContentType(string value) => new FileSearchToolCallContentType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is FileSearchToolCallContentType other && Equals(other); + /// + public bool Equals(FileSearchToolCallContentType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolDefinition.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolDefinition.Serialization.cs new file mode 100644 index 000000000000..02196c9c2762 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolDefinition.Serialization.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class FileSearchToolDefinition : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FileSearchToolDefinition)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(FileSearch)) + { + writer.WritePropertyName("file_search"u8); + writer.WriteObjectValue(FileSearch, options); + } + } + + FileSearchToolDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FileSearchToolDefinition)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFileSearchToolDefinition(document.RootElement, options); + } + + internal static FileSearchToolDefinition DeserializeFileSearchToolDefinition(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + FileSearchToolDefinitionDetails fileSearch = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("file_search"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + fileSearch = FileSearchToolDefinitionDetails.DeserializeFileSearchToolDefinitionDetails(property.Value, options); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FileSearchToolDefinition(type, serializedAdditionalRawData, fileSearch); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(FileSearchToolDefinition)} does not support writing '{options.Format}' format."); + } + } + + FileSearchToolDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFileSearchToolDefinition(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FileSearchToolDefinition)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new FileSearchToolDefinition FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFileSearchToolDefinition(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolDefinition.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolDefinition.cs new file mode 100644 index 000000000000..4096f95870f0 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolDefinition.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The input definition information for a file search tool as used to configure an agent. + public partial class FileSearchToolDefinition : ToolDefinition + { + /// Initializes a new instance of . + public FileSearchToolDefinition() + { + Type = "file_search"; + } + + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + /// Options overrides for the file search tool. + internal FileSearchToolDefinition(string type, IDictionary serializedAdditionalRawData, FileSearchToolDefinitionDetails fileSearch) : base(type, serializedAdditionalRawData) + { + FileSearch = fileSearch; + } + + /// Options overrides for the file search tool. + public FileSearchToolDefinitionDetails FileSearch { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolDefinitionDetails.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolDefinitionDetails.Serialization.cs new file mode 100644 index 000000000000..9512ff0d4847 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolDefinitionDetails.Serialization.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class FileSearchToolDefinitionDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FileSearchToolDefinitionDetails)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(MaxNumResults)) + { + writer.WritePropertyName("max_num_results"u8); + writer.WriteNumberValue(MaxNumResults.Value); + } + if (Optional.IsDefined(RankingOptions)) + { + writer.WritePropertyName("ranking_options"u8); + writer.WriteObjectValue(RankingOptions, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + FileSearchToolDefinitionDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FileSearchToolDefinitionDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFileSearchToolDefinitionDetails(document.RootElement, options); + } + + internal static FileSearchToolDefinitionDetails DeserializeFileSearchToolDefinitionDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int? maxNumResults = default; + FileSearchRankingOptions rankingOptions = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("max_num_results"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maxNumResults = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("ranking_options"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rankingOptions = FileSearchRankingOptions.DeserializeFileSearchRankingOptions(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FileSearchToolDefinitionDetails(maxNumResults, rankingOptions, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(FileSearchToolDefinitionDetails)} does not support writing '{options.Format}' format."); + } + } + + FileSearchToolDefinitionDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFileSearchToolDefinitionDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FileSearchToolDefinitionDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static FileSearchToolDefinitionDetails FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFileSearchToolDefinitionDetails(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolDefinitionDetails.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolDefinitionDetails.cs new file mode 100644 index 000000000000..7dd46e200bce --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolDefinitionDetails.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Options overrides for the file search tool. + public partial class FileSearchToolDefinitionDetails + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public FileSearchToolDefinitionDetails() + { + } + + /// Initializes a new instance of . + /// + /// The maximum number of results the file search tool should output. The default is 20 for gpt-4* models and 5 for gpt-3.5-turbo. This number should be between 1 and 50 inclusive. + /// + /// Note that the file search tool may output fewer than `max_num_results` results. See the file search tool documentation for more information. + /// + /// Ranking options for file search. + /// Keeps track of any properties unknown to the library. + internal FileSearchToolDefinitionDetails(int? maxNumResults, FileSearchRankingOptions rankingOptions, IDictionary serializedAdditionalRawData) + { + MaxNumResults = maxNumResults; + RankingOptions = rankingOptions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// + /// The maximum number of results the file search tool should output. The default is 20 for gpt-4* models and 5 for gpt-3.5-turbo. This number should be between 1 and 50 inclusive. + /// + /// Note that the file search tool may output fewer than `max_num_results` results. See the file search tool documentation for more information. + /// + public int? MaxNumResults { get; set; } + /// Ranking options for file search. + public FileSearchRankingOptions RankingOptions { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolResource.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolResource.Serialization.cs new file mode 100644 index 000000000000..bc5a539a33ec --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolResource.Serialization.cs @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class FileSearchToolResource : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FileSearchToolResource)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(VectorStoreIds)) + { + writer.WritePropertyName("vector_store_ids"u8); + writer.WriteStartArray(); + foreach (var item in VectorStoreIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(VectorStores)) + { + writer.WritePropertyName("vector_stores"u8); + writer.WriteStartArray(); + foreach (var item in VectorStores) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + FileSearchToolResource IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FileSearchToolResource)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFileSearchToolResource(document.RootElement, options); + } + + internal static FileSearchToolResource DeserializeFileSearchToolResource(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList vectorStoreIds = default; + IList vectorStores = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("vector_store_ids"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + vectorStoreIds = array; + continue; + } + if (property.NameEquals("vector_stores"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(VectorStoreConfigurations.DeserializeVectorStoreConfigurations(item, options)); + } + vectorStores = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FileSearchToolResource(vectorStoreIds ?? new ChangeTrackingList(), vectorStores ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(FileSearchToolResource)} does not support writing '{options.Format}' format."); + } + } + + FileSearchToolResource IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFileSearchToolResource(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FileSearchToolResource)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static FileSearchToolResource FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFileSearchToolResource(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolResource.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolResource.cs new file mode 100644 index 000000000000..739a8a4b4c71 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/FileSearchToolResource.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// A set of resources that are used by the `file_search` tool. + public partial class FileSearchToolResource + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public FileSearchToolResource() + { + VectorStoreIds = new ChangeTrackingList(); + VectorStores = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// + /// The ID of the vector store attached to this agent. There can be a maximum of 1 vector + /// store attached to the agent. + /// + /// + /// The list of vector store configuration objects from Azure. + /// This list is limited to one element. + /// The only element of this list contains the list of azure asset IDs used by the search tool. + /// + /// Keeps track of any properties unknown to the library. + internal FileSearchToolResource(IList vectorStoreIds, IList vectorStores, IDictionary serializedAdditionalRawData) + { + VectorStoreIds = vectorStoreIds; + VectorStores = vectorStores; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// + /// The ID of the vector store attached to this agent. There can be a maximum of 1 vector + /// store attached to the agent. + /// + public IList VectorStoreIds { get; } + /// + /// The list of vector store configuration objects from Azure. + /// This list is limited to one element. + /// The only element of this list contains the list of azure asset IDs used by the search tool. + /// + public IList VectorStores { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/FileState.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/FileState.cs new file mode 100644 index 000000000000..edd9526cae24 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/FileState.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// The state of the file. + public readonly partial struct FileState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public FileState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UploadedValue = "uploaded"; + private const string PendingValue = "pending"; + private const string RunningValue = "running"; + private const string ProcessedValue = "processed"; + private const string ErrorValue = "error"; + private const string DeletingValue = "deleting"; + private const string DeletedValue = "deleted"; + + /// + /// The file has been uploaded but it's not yet processed. This state is not returned by Azure OpenAI and exposed only for + /// compatibility. It can be categorized as an inactive state. + /// + public static FileState Uploaded { get; } = new FileState(UploadedValue); + /// The operation was created and is not queued to be processed in the future. It can be categorized as an inactive state. + public static FileState Pending { get; } = new FileState(PendingValue); + /// The operation has started to be processed. It can be categorized as an active state. + public static FileState Running { get; } = new FileState(RunningValue); + /// The operation has successfully processed and is ready for consumption. It can be categorized as a terminal state. + public static FileState Processed { get; } = new FileState(ProcessedValue); + /// The operation has completed processing with a failure and cannot be further consumed. It can be categorized as a terminal state. + public static FileState Error { get; } = new FileState(ErrorValue); + /// + /// The entity is in the process to be deleted. This state is not returned by Azure OpenAI and exposed only for compatibility. + /// It can be categorized as an active state. + /// + public static FileState Deleting { get; } = new FileState(DeletingValue); + /// + /// The entity has been deleted but may still be referenced by other entities predating the deletion. It can be categorized as a + /// terminal state. + /// + public static FileState Deleted { get; } = new FileState(DeletedValue); + /// Determines if two values are the same. + public static bool operator ==(FileState left, FileState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(FileState left, FileState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator FileState(string value) => new FileState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is FileState other && Equals(other); + /// + public bool Equals(FileState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/FunctionName.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/FunctionName.Serialization.cs new file mode 100644 index 000000000000..df2b53cd7dd7 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/FunctionName.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class FunctionName : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FunctionName)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + FunctionName IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FunctionName)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFunctionName(document.RootElement, options); + } + + internal static FunctionName DeserializeFunctionName(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FunctionName(name, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(FunctionName)} does not support writing '{options.Format}' format."); + } + } + + FunctionName IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFunctionName(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FunctionName)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static FunctionName FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFunctionName(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/FunctionName.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/FunctionName.cs new file mode 100644 index 000000000000..74569e36c3de --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/FunctionName.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The function name that will be used, if using the `function` tool. + public partial class FunctionName + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The name of the function to call. + /// is null. + public FunctionName(string name) + { + Argument.AssertNotNull(name, nameof(name)); + + Name = name; + } + + /// Initializes a new instance of . + /// The name of the function to call. + /// Keeps track of any properties unknown to the library. + internal FunctionName(string name, IDictionary serializedAdditionalRawData) + { + Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal FunctionName() + { + } + + /// The name of the function to call. + public string Name { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/FunctionToolDefinition.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/FunctionToolDefinition.Serialization.cs new file mode 100644 index 000000000000..5cc519c97ce5 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/FunctionToolDefinition.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class FunctionToolDefinition : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FunctionToolDefinition)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("function"u8); + writer.WriteObjectValue(InternalFunction, options); + } + + FunctionToolDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FunctionToolDefinition)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFunctionToolDefinition(document.RootElement, options); + } + + internal static FunctionToolDefinition DeserializeFunctionToolDefinition(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + InternalFunctionDefinition function = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("function"u8)) + { + function = InternalFunctionDefinition.DeserializeInternalFunctionDefinition(property.Value, options); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FunctionToolDefinition(type, serializedAdditionalRawData, function); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(FunctionToolDefinition)} does not support writing '{options.Format}' format."); + } + } + + FunctionToolDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFunctionToolDefinition(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FunctionToolDefinition)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new FunctionToolDefinition FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFunctionToolDefinition(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/FunctionToolDefinition.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/FunctionToolDefinition.cs new file mode 100644 index 000000000000..1d991aa6da4f --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/FunctionToolDefinition.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The input definition information for a function tool as used to configure an agent. + public partial class FunctionToolDefinition : ToolDefinition + { + /// Initializes a new instance of . + /// The definition of the concrete function that the function tool should call. + /// is null. + public FunctionToolDefinition(InternalFunctionDefinition internalFunction) + { + Argument.AssertNotNull(internalFunction, nameof(internalFunction)); + + Type = "function"; + InternalFunction = internalFunction; + } + + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + /// The definition of the concrete function that the function tool should call. + internal FunctionToolDefinition(string type, IDictionary serializedAdditionalRawData, InternalFunctionDefinition internalFunction) : base(type, serializedAdditionalRawData) + { + InternalFunction = internalFunction; + } + + /// Initializes a new instance of for deserialization. + internal FunctionToolDefinition() + { + } + + /// The definition of the concrete function that the function tool should call. + public InternalFunctionDefinition InternalFunction { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/IncompleteDetailsReason.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/IncompleteDetailsReason.cs new file mode 100644 index 000000000000..b75bae2f32a8 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/IncompleteDetailsReason.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// The reason why the run is incomplete. This will point to which specific token limit was reached over the course of the run. + public readonly partial struct IncompleteDetailsReason : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public IncompleteDetailsReason(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string MaxCompletionTokensValue = "max_completion_tokens"; + private const string MaxPromptTokensValue = "max_prompt_tokens"; + + /// Maximum completion tokens exceeded. + public static IncompleteDetailsReason MaxCompletionTokens { get; } = new IncompleteDetailsReason(MaxCompletionTokensValue); + /// Maximum prompt tokens exceeded. + public static IncompleteDetailsReason MaxPromptTokens { get; } = new IncompleteDetailsReason(MaxPromptTokensValue); + /// Determines if two values are the same. + public static bool operator ==(IncompleteDetailsReason left, IncompleteDetailsReason right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(IncompleteDetailsReason left, IncompleteDetailsReason right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator IncompleteDetailsReason(string value) => new IncompleteDetailsReason(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is IncompleteDetailsReason other && Equals(other); + /// + public bool Equals(IncompleteDetailsReason other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/IncompleteRunDetails.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/IncompleteRunDetails.Serialization.cs new file mode 100644 index 000000000000..460fa886b6bc --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/IncompleteRunDetails.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class IncompleteRunDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(IncompleteRunDetails)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("reason"u8); + writer.WriteStringValue(Reason.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + IncompleteRunDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(IncompleteRunDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeIncompleteRunDetails(document.RootElement, options); + } + + internal static IncompleteRunDetails DeserializeIncompleteRunDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IncompleteDetailsReason reason = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("reason"u8)) + { + reason = new IncompleteDetailsReason(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new IncompleteRunDetails(reason, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(IncompleteRunDetails)} does not support writing '{options.Format}' format."); + } + } + + IncompleteRunDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeIncompleteRunDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(IncompleteRunDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static IncompleteRunDetails FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeIncompleteRunDetails(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/IncompleteRunDetails.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/IncompleteRunDetails.cs new file mode 100644 index 000000000000..47aee369bd7b --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/IncompleteRunDetails.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Details on why the run is incomplete. Will be `null` if the run is not incomplete. + public partial class IncompleteRunDetails + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The reason why the run is incomplete. This indicates which specific token limit was reached during the run. + internal IncompleteRunDetails(IncompleteDetailsReason reason) + { + Reason = reason; + } + + /// Initializes a new instance of . + /// The reason why the run is incomplete. This indicates which specific token limit was reached during the run. + /// Keeps track of any properties unknown to the library. + internal IncompleteRunDetails(IncompleteDetailsReason reason, IDictionary serializedAdditionalRawData) + { + Reason = reason; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal IncompleteRunDetails() + { + } + + /// The reason why the run is incomplete. This indicates which specific token limit was reached during the run. + public IncompleteDetailsReason Reason { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/Internal/Argument.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/Internal/Argument.cs new file mode 100644 index 000000000000..e8798a5af10c --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/Internal/Argument.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + internal static class Argument + { + public static void AssertNotNull(T value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + } + + public static void AssertNotNull(T? value, string name) + where T : struct + { + if (!value.HasValue) + { + throw new ArgumentNullException(name); + } + } + + public static void AssertNotNullOrEmpty(IEnumerable value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value is ICollection collectionOfT && collectionOfT.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + if (value is ICollection collection && collection.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + using IEnumerator e = value.GetEnumerator(); + if (!e.MoveNext()) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + } + + public static void AssertNotNullOrEmpty(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value.Length == 0) + { + throw new ArgumentException("Value cannot be an empty string.", name); + } + } + + public static void AssertNotNullOrWhiteSpace(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (string.IsNullOrWhiteSpace(value)) + { + throw new ArgumentException("Value cannot be empty or contain only white-space characters.", name); + } + } + + public static void AssertNotDefault(ref T value, string name) + where T : struct, IEquatable + { + if (value.Equals(default)) + { + throw new ArgumentException("Value cannot be empty.", name); + } + } + + public static void AssertInRange(T value, T minimum, T maximum, string name) + where T : notnull, IComparable + { + if (minimum.CompareTo(value) > 0) + { + throw new ArgumentOutOfRangeException(name, "Value is less than the minimum allowed."); + } + if (maximum.CompareTo(value) < 0) + { + throw new ArgumentOutOfRangeException(name, "Value is greater than the maximum allowed."); + } + } + + public static void AssertEnumDefined(Type enumType, object value, string name) + { + if (!Enum.IsDefined(enumType, value)) + { + throw new ArgumentException($"Value not defined for {enumType.FullName}.", name); + } + } + + public static T CheckNotNull(T value, string name) + where T : class + { + AssertNotNull(value, name); + return value; + } + + public static string CheckNotNullOrEmpty(string value, string name) + { + AssertNotNullOrEmpty(value, name); + return value; + } + + public static void AssertNull(T value, string name, string message = null) + { + if (value != null) + { + throw new ArgumentException(message ?? "Value must be null.", name); + } + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/Internal/ChangeTrackingDictionary.cs new file mode 100644 index 000000000000..2277595ee782 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/Internal/ChangeTrackingDictionary.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + internal class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary where TKey : notnull + { + private IDictionary _innerDictionary; + + public ChangeTrackingDictionary() + { + } + + public ChangeTrackingDictionary(IDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(dictionary); + } + + public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(); + foreach (var pair in dictionary) + { + _innerDictionary.Add(pair); + } + } + + public bool IsUndefined => _innerDictionary == null; + + public int Count => IsUndefined ? 0 : EnsureDictionary().Count; + + public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly; + + public ICollection Keys => IsUndefined ? Array.Empty() : EnsureDictionary().Keys; + + public ICollection Values => IsUndefined ? Array.Empty() : EnsureDictionary().Values; + + public TValue this[TKey key] + { + get + { + if (IsUndefined) + { + throw new KeyNotFoundException(nameof(key)); + } + return EnsureDictionary()[key]; + } + set + { + EnsureDictionary()[key] = value; + } + } + + IEnumerable IReadOnlyDictionary.Keys => Keys; + + IEnumerable IReadOnlyDictionary.Values => Values; + + public IEnumerator> GetEnumerator() + { + if (IsUndefined) + { + IEnumerator> enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureDictionary().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(KeyValuePair item) + { + EnsureDictionary().Add(item); + } + + public void Clear() + { + EnsureDictionary().Clear(); + } + + public bool Contains(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Contains(item); + } + + public void CopyTo(KeyValuePair[] array, int index) + { + if (IsUndefined) + { + return; + } + EnsureDictionary().CopyTo(array, index); + } + + public bool Remove(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(item); + } + + public void Add(TKey key, TValue value) + { + EnsureDictionary().Add(key, value); + } + + public bool ContainsKey(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().ContainsKey(key); + } + + public bool Remove(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(key); + } + + public bool TryGetValue(TKey key, out TValue value) + { + if (IsUndefined) + { + value = default; + return false; + } + return EnsureDictionary().TryGetValue(key, out value); + } + + public IDictionary EnsureDictionary() + { + return _innerDictionary ??= new Dictionary(); + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/Internal/ChangeTrackingList.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/Internal/ChangeTrackingList.cs new file mode 100644 index 000000000000..56f30ee657d5 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/Internal/ChangeTrackingList.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Assistants +{ + internal class ChangeTrackingList : IList, IReadOnlyList + { + private IList _innerList; + + public ChangeTrackingList() + { + } + + public ChangeTrackingList(IList innerList) + { + if (innerList != null) + { + _innerList = innerList; + } + } + + public ChangeTrackingList(IReadOnlyList innerList) + { + if (innerList != null) + { + _innerList = innerList.ToList(); + } + } + + public bool IsUndefined => _innerList == null; + + public int Count => IsUndefined ? 0 : EnsureList().Count; + + public bool IsReadOnly => IsUndefined ? false : EnsureList().IsReadOnly; + + public T this[int index] + { + get + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + return EnsureList()[index]; + } + set + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList()[index] = value; + } + } + + public void Reset() + { + _innerList = null; + } + + public IEnumerator GetEnumerator() + { + if (IsUndefined) + { + IEnumerator enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureList().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(T item) + { + EnsureList().Add(item); + } + + public void Clear() + { + EnsureList().Clear(); + } + + public bool Contains(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Contains(item); + } + + public void CopyTo(T[] array, int arrayIndex) + { + if (IsUndefined) + { + return; + } + EnsureList().CopyTo(array, arrayIndex); + } + + public bool Remove(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Remove(item); + } + + public int IndexOf(T item) + { + if (IsUndefined) + { + return -1; + } + return EnsureList().IndexOf(item); + } + + public void Insert(int index, T item) + { + EnsureList().Insert(index, item); + } + + public void RemoveAt(int index) + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList().RemoveAt(index); + } + + public IList EnsureList() + { + return _innerList ??= new List(); + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/Internal/ModelSerializationExtensions.cs new file mode 100644 index 000000000000..46339113e9f9 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/Internal/ModelSerializationExtensions.cs @@ -0,0 +1,399 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.Text.Json; +using System.Xml; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal static class ModelSerializationExtensions + { + internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions { MaxDepth = 256 }; + internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); + + public static object GetObject(this JsonElement element) + { + switch (element.ValueKind) + { + case JsonValueKind.String: + return element.GetString(); + case JsonValueKind.Number: + if (element.TryGetInt32(out int intValue)) + { + return intValue; + } + if (element.TryGetInt64(out long longValue)) + { + return longValue; + } + return element.GetDouble(); + case JsonValueKind.True: + return true; + case JsonValueKind.False: + return false; + case JsonValueKind.Undefined: + case JsonValueKind.Null: + return null; + case JsonValueKind.Object: + var dictionary = new Dictionary(); + foreach (var jsonProperty in element.EnumerateObject()) + { + dictionary.Add(jsonProperty.Name, jsonProperty.Value.GetObject()); + } + return dictionary; + case JsonValueKind.Array: + var list = new List(); + foreach (var item in element.EnumerateArray()) + { + list.Add(item.GetObject()); + } + return list.ToArray(); + default: + throw new NotSupportedException($"Not supported value kind {element.ValueKind}"); + } + } + + public static byte[] GetBytesFromBase64(this JsonElement element, string format) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + + return format switch + { + "U" => TypeFormatters.FromBase64UrlString(element.GetRequiredString()), + "D" => element.GetBytesFromBase64(), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + } + + public static DateTimeOffset GetDateTimeOffset(this JsonElement element, string format) => format switch + { + "U" when element.ValueKind == JsonValueKind.Number => DateTimeOffset.FromUnixTimeSeconds(element.GetInt64()), + _ => TypeFormatters.ParseDateTimeOffset(element.GetString(), format) + }; + + public static TimeSpan GetTimeSpan(this JsonElement element, string format) => TypeFormatters.ParseTimeSpan(element.GetString(), format); + + public static char GetChar(this JsonElement element) + { + if (element.ValueKind == JsonValueKind.String) + { + var text = element.GetString(); + if (text == null || text.Length != 1) + { + throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); + } + return text[0]; + } + else + { + throw new NotSupportedException($"Cannot convert {element.ValueKind} to a char"); + } + } + + [Conditional("DEBUG")] + public static void ThrowNonNullablePropertyIsNull(this JsonProperty property) + { + throw new JsonException($"A property '{property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); + } + + public static string GetRequiredString(this JsonElement element) + { + var value = element.GetString(); + if (value == null) + { + throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{element.ValueKind}'."); + } + return value; + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTime value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, TimeSpan value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, char value) + { + writer.WriteStringValue(value.ToString(CultureInfo.InvariantCulture)); + } + + public static void WriteBase64StringValue(this Utf8JsonWriter writer, byte[] value, string format) + { + if (value == null) + { + writer.WriteNullValue(); + return; + } + switch (format) + { + case "U": + writer.WriteStringValue(TypeFormatters.ToBase64UrlString(value)); + break; + case "D": + writer.WriteBase64StringValue(value); + break; + default: + throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)); + } + } + + public static void WriteNumberValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + if (format != "U") + { + throw new ArgumentOutOfRangeException(nameof(format), "Only 'U' format is supported when writing a DateTimeOffset as a Number."); + } + writer.WriteNumberValue(value.ToUnixTimeSeconds()); + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, T value, ModelReaderWriterOptions options = null) + { + switch (value) + { + case null: + writer.WriteNullValue(); + break; + case IJsonModel jsonModel: + jsonModel.Write(writer, options ?? WireOptions); + break; + case IUtf8JsonSerializable serializable: + serializable.Write(writer); + break; + case byte[] bytes: + writer.WriteBase64StringValue(bytes); + break; + case BinaryData bytes0: + writer.WriteBase64StringValue(bytes0); + break; + case JsonElement json: + json.WriteTo(writer); + break; + case int i: + writer.WriteNumberValue(i); + break; + case decimal d: + writer.WriteNumberValue(d); + break; + case double d0: + if (double.IsNaN(d0)) + { + writer.WriteStringValue("NaN"); + } + else + { + writer.WriteNumberValue(d0); + } + break; + case float f: + writer.WriteNumberValue(f); + break; + case long l: + writer.WriteNumberValue(l); + break; + case string s: + writer.WriteStringValue(s); + break; + case bool b: + writer.WriteBooleanValue(b); + break; + case Guid g: + writer.WriteStringValue(g); + break; + case DateTimeOffset dateTimeOffset: + writer.WriteStringValue(dateTimeOffset, "O"); + break; + case DateTime dateTime: + writer.WriteStringValue(dateTime, "O"); + break; + case IEnumerable> enumerable: + writer.WriteStartObject(); + foreach (var pair in enumerable) + { + writer.WritePropertyName(pair.Key); + writer.WriteObjectValue(pair.Value, options); + } + writer.WriteEndObject(); + break; + case IEnumerable objectEnumerable: + writer.WriteStartArray(); + foreach (var item in objectEnumerable) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + break; + case TimeSpan timeSpan: + writer.WriteStringValue(timeSpan, "P"); + break; + default: + throw new NotSupportedException($"Not supported type {value.GetType()}"); + } + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, object value, ModelReaderWriterOptions options = null) + { + writer.WriteObjectValue(value, options); + } + + internal static class TypeFormatters + { + private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; + public const string DefaultNumberFormat = "G"; + + public static string ToString(bool value) => value ? "true" : "false"; + + public static string ToString(DateTime value, string format) => value.Kind switch + { + DateTimeKind.Utc => ToString((DateTimeOffset)value, format), + _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Azure SDK requires it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") + }; + + public static string ToString(DateTimeOffset value, string format) => format switch + { + "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), + "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), + "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "R" => value.ToString("r", CultureInfo.InvariantCulture), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(TimeSpan value, string format) => format switch + { + "P" => XmlConvert.ToString(value), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(byte[] value, string format) => format switch + { + "U" => ToBase64UrlString(value), + "D" => Convert.ToBase64String(value), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + + public static string ToBase64UrlString(byte[] value) + { + int numWholeOrPartialInputBlocks = checked(value.Length + 2) / 3; + int size = checked(numWholeOrPartialInputBlocks * 4); + char[] output = new char[size]; + + int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); + + int i = 0; + for (; i < numBase64Chars; i++) + { + char ch = output[i]; + if (ch == '+') + { + output[i] = '-'; + } + else + { + if (ch == '/') + { + output[i] = '_'; + } + else + { + if (ch == '=') + { + break; + } + } + } + } + + return new string(output, 0, i); + } + + public static byte[] FromBase64UrlString(string value) + { + int paddingCharsToAdd = (value.Length % 4) switch + { + 0 => 0, + 2 => 2, + 3 => 1, + _ => throw new InvalidOperationException("Malformed input") + }; + char[] output = new char[(value.Length + paddingCharsToAdd)]; + int i = 0; + for (; i < value.Length; i++) + { + char ch = value[i]; + if (ch == '-') + { + output[i] = '+'; + } + else + { + if (ch == '_') + { + output[i] = '/'; + } + else + { + output[i] = ch; + } + } + } + + for (; i < output.Length; i++) + { + output[i] = '='; + } + + return Convert.FromBase64CharArray(output, 0, output.Length); + } + + public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch + { + "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), + _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) + }; + + public static TimeSpan ParseTimeSpan(string value, string format) => format switch + { + "P" => XmlConvert.ToTimeSpan(value), + _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) + }; + + public static string ConvertToString(object value, string format = null) => value switch + { + null => "null", + string s => s, + bool b => ToString(b), + int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), + byte[] b0 when format != null => ToString(b0, format), + IEnumerable s0 => string.Join(",", s0), + DateTimeOffset dateTime when format != null => ToString(dateTime, format), + TimeSpan timeSpan when format != null => ToString(timeSpan, format), + TimeSpan timeSpan0 => XmlConvert.ToString(timeSpan0), + Guid guid => guid.ToString(), + BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), + _ => value.ToString() + }; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/Internal/MultipartFormDataRequestContent.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/Internal/MultipartFormDataRequestContent.cs new file mode 100644 index 000000000000..e05edb7cf474 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/Internal/MultipartFormDataRequestContent.cs @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.IO; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.Assistants +{ + internal class MultipartFormDataRequestContent : RequestContent + { + private readonly System.Net.Http.MultipartFormDataContent _multipartContent; + private static readonly Random _random = new Random(); + private static readonly char[] _boundaryValues = "0123456789=ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".ToCharArray(); + + public MultipartFormDataRequestContent() + { + _multipartContent = new System.Net.Http.MultipartFormDataContent(CreateBoundary()); + } + + public string ContentType + { + get + { + return _multipartContent.Headers.ContentType.ToString(); + } + } + + internal HttpContent HttpContent => _multipartContent; + + private static string CreateBoundary() + { + Span chars = new char[70]; + byte[] random = new byte[70]; + _random.NextBytes(random); + int mask = 255 >> 2; + for (int i = 0; i < 70; i++) + { + chars[i] = _boundaryValues[random[i] & mask]; + } + return chars.ToString(); + } + + public void Add(string content, string name, string filename = null, string contentType = null) + { + Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + Add(new StringContent(content), name, filename, contentType); + } + + public void Add(int content, string name, string filename = null, string contentType = null) + { + Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + string value = content.ToString("G", CultureInfo.InvariantCulture); + Add(new StringContent(value), name, filename, contentType); + } + + public void Add(long content, string name, string filename = null, string contentType = null) + { + Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + string value = content.ToString("G", CultureInfo.InvariantCulture); + Add(new StringContent(value), name, filename, contentType); + } + + public void Add(float content, string name, string filename = null, string contentType = null) + { + Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + string value = content.ToString("G", CultureInfo.InvariantCulture); + Add(new StringContent(value), name, filename, contentType); + } + + public void Add(double content, string name, string filename = null, string contentType = null) + { + Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + string value = content.ToString("G", CultureInfo.InvariantCulture); + Add(new StringContent(value), name, filename, contentType); + } + + public void Add(decimal content, string name, string filename = null, string contentType = null) + { + Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + string value = content.ToString("G", CultureInfo.InvariantCulture); + Add(new StringContent(value), name, filename, contentType); + } + + public void Add(bool content, string name, string filename = null, string contentType = null) + { + Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + string value = content ? "true" : "false"; + Add(new StringContent(value), name, filename, contentType); + } + + public void Add(Stream content, string name, string filename = null, string contentType = null) + { + Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + Add(new StreamContent(content), name, filename, contentType); + } + + public void Add(byte[] content, string name, string filename = null, string contentType = null) + { + Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + Add(new ByteArrayContent(content), name, filename, contentType); + } + + public void Add(BinaryData content, string name, string filename = null, string contentType = null) + { + Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + Add(new ByteArrayContent(content.ToArray()), name, filename, contentType); + } + + private void Add(HttpContent content, string name, string filename, string contentType) + { + if (filename != null) + { + Argument.AssertNotNullOrEmpty(filename, nameof(filename)); + AddFilenameHeader(content, name, filename); + } + if (contentType != null) + { + Argument.AssertNotNullOrEmpty(contentType, nameof(contentType)); + AddContentTypeHeader(content, contentType); + } + _multipartContent.Add(content, name); + } + + public static void AddFilenameHeader(HttpContent content, string name, string filename) + { + ContentDispositionHeaderValue header = new ContentDispositionHeaderValue("form-data") { Name = name, FileName = filename }; + content.Headers.ContentDisposition = header; + } + + public static void AddContentTypeHeader(HttpContent content, string contentType) + { + MediaTypeHeaderValue header = new MediaTypeHeaderValue(contentType); + content.Headers.ContentType = header; + } + + public override bool TryComputeLength(out long length) + { + if (_multipartContent.Headers.ContentLength is long contentLength) + { + length = contentLength; + return true; + } + length = 0; + return false; + } + + public override void WriteTo(Stream stream, CancellationToken cancellationToken = default) + { +#if NET6_0_OR_GREATER + _multipartContent.CopyTo(stream, default, cancellationToken); +#else +#pragma warning disable AZC0107 + _multipartContent.CopyToAsync(stream).EnsureCompleted(); +#pragma warning restore AZC0107 +#endif + } + + public override async Task WriteToAsync(Stream stream, CancellationToken cancellationToken = default) + { +#if NET6_0_OR_GREATER + await _multipartContent.CopyToAsync(stream, cancellationToken).ConfigureAwait(false); +#else + await _multipartContent.CopyToAsync(stream).ConfigureAwait(false); +#endif + } + + public override void Dispose() + { + _multipartContent.Dispose(); + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/Internal/Optional.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/Internal/Optional.cs new file mode 100644 index 000000000000..e8d1400241f5 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/Internal/Optional.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; + +namespace Azure.AI.Assistants +{ + internal static class Optional + { + public static bool IsCollectionDefined(IEnumerable collection) + { + return !(collection is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined); + } + + public static bool IsCollectionDefined(IDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsCollectionDefined(IReadOnlyDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsDefined(T? value) + where T : struct + { + return value.HasValue; + } + + public static bool IsDefined(object value) + { + return value != null; + } + + public static bool IsDefined(JsonElement value) + { + return value.ValueKind != JsonValueKind.Undefined; + } + + public static bool IsDefined(string value) + { + return value != null; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/Internal/Utf8JsonRequestContent.cs new file mode 100644 index 000000000000..eedbd02ae623 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/Internal/Utf8JsonRequestContent.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.IO; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal class Utf8JsonRequestContent : RequestContent + { + private readonly MemoryStream _stream; + private readonly RequestContent _content; + + public Utf8JsonRequestContent() + { + _stream = new MemoryStream(); + _content = Create(_stream); + JsonWriter = new Utf8JsonWriter(_stream); + } + + public Utf8JsonWriter JsonWriter { get; } + + public override async Task WriteToAsync(Stream stream, CancellationToken cancellationToken = default) + { + await JsonWriter.FlushAsync().ConfigureAwait(false); + await _content.WriteToAsync(stream, cancellationToken).ConfigureAwait(false); + } + + public override void WriteTo(Stream stream, CancellationToken cancellationToken = default) + { + JsonWriter.Flush(); + _content.WriteTo(stream, cancellationToken); + } + + public override bool TryComputeLength(out long length) + { + length = JsonWriter.BytesCommitted + JsonWriter.BytesPending; + return true; + } + + public override void Dispose() + { + JsonWriter.Dispose(); + _content.Dispose(); + _stream.Dispose(); + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/InternalAgentDeletionStatus.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalAgentDeletionStatus.Serialization.cs new file mode 100644 index 000000000000..5b51c5d20f04 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalAgentDeletionStatus.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class InternalAgentDeletionStatus : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InternalAgentDeletionStatus)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("deleted"u8); + writer.WriteBooleanValue(Deleted); + writer.WritePropertyName("object"u8); + writer.WriteStringValue(Object.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + InternalAgentDeletionStatus IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InternalAgentDeletionStatus)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInternalAgentDeletionStatus(document.RootElement, options); + } + + internal static InternalAgentDeletionStatus DeserializeInternalAgentDeletionStatus(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + bool deleted = default; + InternalAgentDeletionStatusObject @object = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("deleted"u8)) + { + deleted = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("object"u8)) + { + @object = new InternalAgentDeletionStatusObject(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InternalAgentDeletionStatus(id, deleted, @object, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(InternalAgentDeletionStatus)} does not support writing '{options.Format}' format."); + } + } + + InternalAgentDeletionStatus IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeInternalAgentDeletionStatus(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InternalAgentDeletionStatus)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static InternalAgentDeletionStatus FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeInternalAgentDeletionStatus(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/InternalAgentDeletionStatus.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalAgentDeletionStatus.cs new file mode 100644 index 000000000000..102e7108b8f2 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalAgentDeletionStatus.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The status of an agent deletion operation. + internal partial class InternalAgentDeletionStatus + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The ID of the resource specified for deletion. + /// A value indicating whether deletion was successful. + /// is null. + internal InternalAgentDeletionStatus(string id, bool deleted) + { + Argument.AssertNotNull(id, nameof(id)); + + Id = id; + Deleted = deleted; + } + + /// Initializes a new instance of . + /// The ID of the resource specified for deletion. + /// A value indicating whether deletion was successful. + /// The object type, which is always 'assistant.deleted'. + /// Keeps track of any properties unknown to the library. + internal InternalAgentDeletionStatus(string id, bool deleted, InternalAgentDeletionStatusObject @object, IDictionary serializedAdditionalRawData) + { + Id = id; + Deleted = deleted; + Object = @object; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InternalAgentDeletionStatus() + { + } + + /// The ID of the resource specified for deletion. + public string Id { get; } + /// A value indicating whether deletion was successful. + public bool Deleted { get; } + /// The object type, which is always 'assistant.deleted'. + public InternalAgentDeletionStatusObject Object { get; } = InternalAgentDeletionStatusObject.AssistantDeleted; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/InternalAgentDeletionStatusObject.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalAgentDeletionStatusObject.cs new file mode 100644 index 000000000000..9329c02c026c --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalAgentDeletionStatusObject.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// The InternalAgentDeletionStatus_object. + internal readonly partial struct InternalAgentDeletionStatusObject : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public InternalAgentDeletionStatusObject(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AssistantDeletedValue = "assistant.deleted"; + + /// assistant.deleted. + public static InternalAgentDeletionStatusObject AssistantDeleted { get; } = new InternalAgentDeletionStatusObject(AssistantDeletedValue); + /// Determines if two values are the same. + public static bool operator ==(InternalAgentDeletionStatusObject left, InternalAgentDeletionStatusObject right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(InternalAgentDeletionStatusObject left, InternalAgentDeletionStatusObject right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator InternalAgentDeletionStatusObject(string value) => new InternalAgentDeletionStatusObject(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is InternalAgentDeletionStatusObject other && Equals(other); + /// + public bool Equals(InternalAgentDeletionStatusObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/InternalAzureFunctionDefinition.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalAzureFunctionDefinition.Serialization.cs new file mode 100644 index 000000000000..1c01e9acb5bd --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalAzureFunctionDefinition.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class InternalAzureFunctionDefinition : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InternalAzureFunctionDefinition)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("function"u8); + writer.WriteObjectValue(Function, options); + writer.WritePropertyName("input_binding"u8); + writer.WriteObjectValue(InputBinding, options); + writer.WritePropertyName("output_binding"u8); + writer.WriteObjectValue(OutputBinding, options); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + InternalAzureFunctionDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InternalAzureFunctionDefinition)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInternalAzureFunctionDefinition(document.RootElement, options); + } + + internal static InternalAzureFunctionDefinition DeserializeInternalAzureFunctionDefinition(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + InternalFunctionDefinition function = default; + AzureFunctionBinding inputBinding = default; + AzureFunctionBinding outputBinding = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("function"u8)) + { + function = InternalFunctionDefinition.DeserializeInternalFunctionDefinition(property.Value, options); + continue; + } + if (property.NameEquals("input_binding"u8)) + { + inputBinding = AzureFunctionBinding.DeserializeAzureFunctionBinding(property.Value, options); + continue; + } + if (property.NameEquals("output_binding"u8)) + { + outputBinding = AzureFunctionBinding.DeserializeAzureFunctionBinding(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InternalAzureFunctionDefinition(function, inputBinding, outputBinding, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(InternalAzureFunctionDefinition)} does not support writing '{options.Format}' format."); + } + } + + InternalAzureFunctionDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeInternalAzureFunctionDefinition(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InternalAzureFunctionDefinition)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static InternalAzureFunctionDefinition FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeInternalAzureFunctionDefinition(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/InternalAzureFunctionDefinition.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalAzureFunctionDefinition.cs new file mode 100644 index 000000000000..6f112a201f52 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalAzureFunctionDefinition.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The definition of Azure function. + internal partial class InternalAzureFunctionDefinition + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The definition of azure function and its parameters. + /// Input storage queue. The queue storage trigger runs a function as messages are added to it. + /// Output storage queue. The function writes output to this queue when the input items are processed. + /// , or is null. + public InternalAzureFunctionDefinition(InternalFunctionDefinition function, AzureFunctionBinding inputBinding, AzureFunctionBinding outputBinding) + { + Argument.AssertNotNull(function, nameof(function)); + Argument.AssertNotNull(inputBinding, nameof(inputBinding)); + Argument.AssertNotNull(outputBinding, nameof(outputBinding)); + + Function = function; + InputBinding = inputBinding; + OutputBinding = outputBinding; + } + + /// Initializes a new instance of . + /// The definition of azure function and its parameters. + /// Input storage queue. The queue storage trigger runs a function as messages are added to it. + /// Output storage queue. The function writes output to this queue when the input items are processed. + /// Keeps track of any properties unknown to the library. + internal InternalAzureFunctionDefinition(InternalFunctionDefinition function, AzureFunctionBinding inputBinding, AzureFunctionBinding outputBinding, IDictionary serializedAdditionalRawData) + { + Function = function; + InputBinding = inputBinding; + OutputBinding = outputBinding; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InternalAzureFunctionDefinition() + { + } + + /// The definition of azure function and its parameters. + public InternalFunctionDefinition Function { get; set; } + /// Input storage queue. The queue storage trigger runs a function as messages are added to it. + public AzureFunctionBinding InputBinding { get; set; } + /// Output storage queue. The function writes output to this queue when the input items are processed. + public AzureFunctionBinding OutputBinding { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/InternalCodeInterpreterToolCallDetails.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalCodeInterpreterToolCallDetails.Serialization.cs new file mode 100644 index 000000000000..639eb59c5d99 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalCodeInterpreterToolCallDetails.Serialization.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class InternalCodeInterpreterToolCallDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InternalCodeInterpreterToolCallDetails)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("input"u8); + writer.WriteStringValue(Input); + writer.WritePropertyName("outputs"u8); + writer.WriteStartArray(); + foreach (var item in Outputs) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + InternalCodeInterpreterToolCallDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InternalCodeInterpreterToolCallDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInternalCodeInterpreterToolCallDetails(document.RootElement, options); + } + + internal static InternalCodeInterpreterToolCallDetails DeserializeInternalCodeInterpreterToolCallDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string input = default; + IReadOnlyList outputs = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("input"u8)) + { + input = property.Value.GetString(); + continue; + } + if (property.NameEquals("outputs"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(RunStepCodeInterpreterToolCallOutput.DeserializeRunStepCodeInterpreterToolCallOutput(item, options)); + } + outputs = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InternalCodeInterpreterToolCallDetails(input, outputs, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(InternalCodeInterpreterToolCallDetails)} does not support writing '{options.Format}' format."); + } + } + + InternalCodeInterpreterToolCallDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeInternalCodeInterpreterToolCallDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InternalCodeInterpreterToolCallDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static InternalCodeInterpreterToolCallDetails FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeInternalCodeInterpreterToolCallDetails(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/InternalCodeInterpreterToolCallDetails.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalCodeInterpreterToolCallDetails.cs new file mode 100644 index 000000000000..2b51d9f965fc --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalCodeInterpreterToolCallDetails.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Assistants +{ + /// The detailed information about a code interpreter invocation by the model. + internal partial class InternalCodeInterpreterToolCallDetails + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The input provided by the model to the code interpreter tool. + /// + /// The outputs produced by the code interpreter tool back to the model in response to the tool call. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// or is null. + internal InternalCodeInterpreterToolCallDetails(string input, IEnumerable outputs) + { + Argument.AssertNotNull(input, nameof(input)); + Argument.AssertNotNull(outputs, nameof(outputs)); + + Input = input; + Outputs = outputs.ToList(); + } + + /// Initializes a new instance of . + /// The input provided by the model to the code interpreter tool. + /// + /// The outputs produced by the code interpreter tool back to the model in response to the tool call. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// Keeps track of any properties unknown to the library. + internal InternalCodeInterpreterToolCallDetails(string input, IReadOnlyList outputs, IDictionary serializedAdditionalRawData) + { + Input = input; + Outputs = outputs; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InternalCodeInterpreterToolCallDetails() + { + } + + /// The input provided by the model to the code interpreter tool. + public string Input { get; } + /// + /// The outputs produced by the code interpreter tool back to the model in response to the tool call. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public IReadOnlyList Outputs { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/InternalFileDeletionStatus.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalFileDeletionStatus.Serialization.cs new file mode 100644 index 000000000000..08abc25062c2 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalFileDeletionStatus.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class InternalFileDeletionStatus : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InternalFileDeletionStatus)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("deleted"u8); + writer.WriteBooleanValue(Deleted); + writer.WritePropertyName("object"u8); + writer.WriteStringValue(Object.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + InternalFileDeletionStatus IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InternalFileDeletionStatus)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInternalFileDeletionStatus(document.RootElement, options); + } + + internal static InternalFileDeletionStatus DeserializeInternalFileDeletionStatus(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + bool deleted = default; + InternalFileDeletionStatusObject @object = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("deleted"u8)) + { + deleted = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("object"u8)) + { + @object = new InternalFileDeletionStatusObject(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InternalFileDeletionStatus(id, deleted, @object, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(InternalFileDeletionStatus)} does not support writing '{options.Format}' format."); + } + } + + InternalFileDeletionStatus IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeInternalFileDeletionStatus(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InternalFileDeletionStatus)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static InternalFileDeletionStatus FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeInternalFileDeletionStatus(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/InternalFileDeletionStatus.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalFileDeletionStatus.cs new file mode 100644 index 000000000000..fdaf5dbdc0f4 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalFileDeletionStatus.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// A status response from a file deletion operation. + internal partial class InternalFileDeletionStatus + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The ID of the resource specified for deletion. + /// A value indicating whether deletion was successful. + /// is null. + internal InternalFileDeletionStatus(string id, bool deleted) + { + Argument.AssertNotNull(id, nameof(id)); + + Id = id; + Deleted = deleted; + } + + /// Initializes a new instance of . + /// The ID of the resource specified for deletion. + /// A value indicating whether deletion was successful. + /// The object type, which is always 'file'. + /// Keeps track of any properties unknown to the library. + internal InternalFileDeletionStatus(string id, bool deleted, InternalFileDeletionStatusObject @object, IDictionary serializedAdditionalRawData) + { + Id = id; + Deleted = deleted; + Object = @object; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InternalFileDeletionStatus() + { + } + + /// The ID of the resource specified for deletion. + public string Id { get; } + /// A value indicating whether deletion was successful. + public bool Deleted { get; } + /// The object type, which is always 'file'. + public InternalFileDeletionStatusObject Object { get; } = InternalFileDeletionStatusObject.File; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/InternalFileDeletionStatusObject.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalFileDeletionStatusObject.cs new file mode 100644 index 000000000000..7287d542b408 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalFileDeletionStatusObject.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// The InternalFileDeletionStatus_object. + internal readonly partial struct InternalFileDeletionStatusObject : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public InternalFileDeletionStatusObject(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string FileValue = "file"; + + /// file. + public static InternalFileDeletionStatusObject File { get; } = new InternalFileDeletionStatusObject(FileValue); + /// Determines if two values are the same. + public static bool operator ==(InternalFileDeletionStatusObject left, InternalFileDeletionStatusObject right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(InternalFileDeletionStatusObject left, InternalFileDeletionStatusObject right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator InternalFileDeletionStatusObject(string value) => new InternalFileDeletionStatusObject(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is InternalFileDeletionStatusObject other && Equals(other); + /// + public bool Equals(InternalFileDeletionStatusObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/InternalFileListResponse.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalFileListResponse.Serialization.cs new file mode 100644 index 000000000000..fb987556a3a4 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalFileListResponse.Serialization.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class InternalFileListResponse : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InternalFileListResponse)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("object"u8); + writer.WriteStringValue(Object.ToString()); + writer.WritePropertyName("data"u8); + writer.WriteStartArray(); + foreach (var item in Data) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + InternalFileListResponse IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InternalFileListResponse)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInternalFileListResponse(document.RootElement, options); + } + + internal static InternalFileListResponse DeserializeInternalFileListResponse(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + InternalFileListResponseObject @object = default; + IReadOnlyList data = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("object"u8)) + { + @object = new InternalFileListResponseObject(property.Value.GetString()); + continue; + } + if (property.NameEquals("data"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(OpenAIFile.DeserializeOpenAIFile(item, options)); + } + data = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InternalFileListResponse(@object, data, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(InternalFileListResponse)} does not support writing '{options.Format}' format."); + } + } + + InternalFileListResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeInternalFileListResponse(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InternalFileListResponse)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static InternalFileListResponse FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeInternalFileListResponse(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/InternalFileListResponse.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalFileListResponse.cs new file mode 100644 index 000000000000..94acdff3850a --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalFileListResponse.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Assistants +{ + /// The response data from a file list operation. + internal partial class InternalFileListResponse + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The files returned for the request. + /// is null. + internal InternalFileListResponse(IEnumerable data) + { + Argument.AssertNotNull(data, nameof(data)); + + Data = data.ToList(); + } + + /// Initializes a new instance of . + /// The object type, which is always 'list'. + /// The files returned for the request. + /// Keeps track of any properties unknown to the library. + internal InternalFileListResponse(InternalFileListResponseObject @object, IReadOnlyList data, IDictionary serializedAdditionalRawData) + { + Object = @object; + Data = data; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InternalFileListResponse() + { + } + + /// The object type, which is always 'list'. + public InternalFileListResponseObject Object { get; } = InternalFileListResponseObject.List; + + /// The files returned for the request. + public IReadOnlyList Data { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/InternalFileListResponseObject.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalFileListResponseObject.cs new file mode 100644 index 000000000000..9e2a296401a3 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalFileListResponseObject.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// The InternalFileListResponse_object. + internal readonly partial struct InternalFileListResponseObject : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public InternalFileListResponseObject(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ListValue = "list"; + + /// list. + public static InternalFileListResponseObject List { get; } = new InternalFileListResponseObject(ListValue); + /// Determines if two values are the same. + public static bool operator ==(InternalFileListResponseObject left, InternalFileListResponseObject right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(InternalFileListResponseObject left, InternalFileListResponseObject right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator InternalFileListResponseObject(string value) => new InternalFileListResponseObject(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is InternalFileListResponseObject other && Equals(other); + /// + public bool Equals(InternalFileListResponseObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/InternalFunctionDefinition.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalFunctionDefinition.Serialization.cs new file mode 100644 index 000000000000..fbb2728dafca --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalFunctionDefinition.Serialization.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class InternalFunctionDefinition : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InternalFunctionDefinition)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WritePropertyName("parameters"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(Parameters); +#else + using (JsonDocument document = JsonDocument.Parse(Parameters, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + InternalFunctionDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InternalFunctionDefinition)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInternalFunctionDefinition(document.RootElement, options); + } + + internal static InternalFunctionDefinition DeserializeInternalFunctionDefinition(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string description = default; + BinaryData parameters = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("parameters"u8)) + { + parameters = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InternalFunctionDefinition(name, description, parameters, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(InternalFunctionDefinition)} does not support writing '{options.Format}' format."); + } + } + + InternalFunctionDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeInternalFunctionDefinition(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InternalFunctionDefinition)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static InternalFunctionDefinition FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeInternalFunctionDefinition(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/InternalFunctionDefinition.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalFunctionDefinition.cs new file mode 100644 index 000000000000..8e2b29ce26ae --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalFunctionDefinition.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The input definition information for a function. + internal partial class InternalFunctionDefinition + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The name of the function to be called. + /// The parameters the functions accepts, described as a JSON Schema object. + /// or is null. + public InternalFunctionDefinition(string name, BinaryData parameters) + { + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(parameters, nameof(parameters)); + + Name = name; + Parameters = parameters; + } + + /// Initializes a new instance of . + /// The name of the function to be called. + /// A description of what the function does, used by the model to choose when and how to call the function. + /// The parameters the functions accepts, described as a JSON Schema object. + /// Keeps track of any properties unknown to the library. + internal InternalFunctionDefinition(string name, string description, BinaryData parameters, IDictionary serializedAdditionalRawData) + { + Name = name; + Description = description; + Parameters = parameters; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InternalFunctionDefinition() + { + } + + /// The name of the function to be called. + public string Name { get; set; } + /// A description of what the function does, used by the model to choose when and how to call the function. + public string Description { get; set; } + /// + /// The parameters the functions accepts, described as a JSON Schema object. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + public BinaryData Parameters { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/InternalMessageImageFileDetails.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalMessageImageFileDetails.Serialization.cs new file mode 100644 index 000000000000..4e01735a23ef --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalMessageImageFileDetails.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class InternalMessageImageFileDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InternalMessageImageFileDetails)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("file_id"u8); + writer.WriteStringValue(InternalDetails); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + InternalMessageImageFileDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InternalMessageImageFileDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInternalMessageImageFileDetails(document.RootElement, options); + } + + internal static InternalMessageImageFileDetails DeserializeInternalMessageImageFileDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string fileId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("file_id"u8)) + { + fileId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InternalMessageImageFileDetails(fileId, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(InternalMessageImageFileDetails)} does not support writing '{options.Format}' format."); + } + } + + InternalMessageImageFileDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeInternalMessageImageFileDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InternalMessageImageFileDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static InternalMessageImageFileDetails FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeInternalMessageImageFileDetails(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/InternalMessageImageFileDetails.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalMessageImageFileDetails.cs new file mode 100644 index 000000000000..29a2c27894b6 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalMessageImageFileDetails.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// An image reference, as represented in thread message content. + internal partial class InternalMessageImageFileDetails + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The ID for the file associated with this image. + /// is null. + internal InternalMessageImageFileDetails(string internalDetails) + { + Argument.AssertNotNull(internalDetails, nameof(internalDetails)); + + InternalDetails = internalDetails; + } + + /// Initializes a new instance of . + /// The ID for the file associated with this image. + /// Keeps track of any properties unknown to the library. + internal InternalMessageImageFileDetails(string internalDetails, IDictionary serializedAdditionalRawData) + { + InternalDetails = internalDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InternalMessageImageFileDetails() + { + } + + /// The ID for the file associated with this image. + public string InternalDetails { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/InternalMessageTextDetails.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalMessageTextDetails.Serialization.cs new file mode 100644 index 000000000000..0f433ba9f62e --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalMessageTextDetails.Serialization.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class InternalMessageTextDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InternalMessageTextDetails)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Text); + writer.WritePropertyName("annotations"u8); + writer.WriteStartArray(); + foreach (var item in Annotations) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + InternalMessageTextDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InternalMessageTextDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInternalMessageTextDetails(document.RootElement, options); + } + + internal static InternalMessageTextDetails DeserializeInternalMessageTextDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string value = default; + IReadOnlyList annotations = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (property.NameEquals("annotations"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MessageTextAnnotation.DeserializeMessageTextAnnotation(item, options)); + } + annotations = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InternalMessageTextDetails(value, annotations, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(InternalMessageTextDetails)} does not support writing '{options.Format}' format."); + } + } + + InternalMessageTextDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeInternalMessageTextDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InternalMessageTextDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static InternalMessageTextDetails FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeInternalMessageTextDetails(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/InternalMessageTextDetails.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalMessageTextDetails.cs new file mode 100644 index 000000000000..4d2e48d0509b --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalMessageTextDetails.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Assistants +{ + /// The text and associated annotations for a single item of agent thread message content. + internal partial class InternalMessageTextDetails + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The text data. + /// + /// A list of annotations associated with this text. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// or is null. + internal InternalMessageTextDetails(string text, IEnumerable annotations) + { + Argument.AssertNotNull(text, nameof(text)); + Argument.AssertNotNull(annotations, nameof(annotations)); + + Text = text; + Annotations = annotations.ToList(); + } + + /// Initializes a new instance of . + /// The text data. + /// + /// A list of annotations associated with this text. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// Keeps track of any properties unknown to the library. + internal InternalMessageTextDetails(string text, IReadOnlyList annotations, IDictionary serializedAdditionalRawData) + { + Text = text; + Annotations = annotations; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InternalMessageTextDetails() + { + } + + /// The text data. + public string Text { get; } + /// + /// A list of annotations associated with this text. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + public IReadOnlyList Annotations { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/InternalMessageTextFileCitationDetails.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalMessageTextFileCitationDetails.Serialization.cs new file mode 100644 index 000000000000..3b1ffc2f242e --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalMessageTextFileCitationDetails.Serialization.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class InternalMessageTextFileCitationDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InternalMessageTextFileCitationDetails)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("file_id"u8); + writer.WriteStringValue(FileId); + writer.WritePropertyName("quote"u8); + writer.WriteStringValue(Quote); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + InternalMessageTextFileCitationDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InternalMessageTextFileCitationDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInternalMessageTextFileCitationDetails(document.RootElement, options); + } + + internal static InternalMessageTextFileCitationDetails DeserializeInternalMessageTextFileCitationDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string fileId = default; + string quote = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("file_id"u8)) + { + fileId = property.Value.GetString(); + continue; + } + if (property.NameEquals("quote"u8)) + { + quote = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InternalMessageTextFileCitationDetails(fileId, quote, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(InternalMessageTextFileCitationDetails)} does not support writing '{options.Format}' format."); + } + } + + InternalMessageTextFileCitationDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeInternalMessageTextFileCitationDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InternalMessageTextFileCitationDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static InternalMessageTextFileCitationDetails FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeInternalMessageTextFileCitationDetails(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/InternalMessageTextFileCitationDetails.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalMessageTextFileCitationDetails.cs new file mode 100644 index 000000000000..8171b38b1c28 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalMessageTextFileCitationDetails.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// A representation of a file-based text citation, as used in a file-based annotation of text thread message content. + internal partial class InternalMessageTextFileCitationDetails + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The ID of the file associated with this citation. + /// The specific quote cited in the associated file. + /// or is null. + internal InternalMessageTextFileCitationDetails(string fileId, string quote) + { + Argument.AssertNotNull(fileId, nameof(fileId)); + Argument.AssertNotNull(quote, nameof(quote)); + + FileId = fileId; + Quote = quote; + } + + /// Initializes a new instance of . + /// The ID of the file associated with this citation. + /// The specific quote cited in the associated file. + /// Keeps track of any properties unknown to the library. + internal InternalMessageTextFileCitationDetails(string fileId, string quote, IDictionary serializedAdditionalRawData) + { + FileId = fileId; + Quote = quote; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InternalMessageTextFileCitationDetails() + { + } + + /// The ID of the file associated with this citation. + public string FileId { get; } + /// The specific quote cited in the associated file. + public string Quote { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/InternalMessageTextFilePathDetails.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalMessageTextFilePathDetails.Serialization.cs new file mode 100644 index 000000000000..44f0a776bf9a --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalMessageTextFilePathDetails.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class InternalMessageTextFilePathDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InternalMessageTextFilePathDetails)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("file_id"u8); + writer.WriteStringValue(FileId); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + InternalMessageTextFilePathDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InternalMessageTextFilePathDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInternalMessageTextFilePathDetails(document.RootElement, options); + } + + internal static InternalMessageTextFilePathDetails DeserializeInternalMessageTextFilePathDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string fileId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("file_id"u8)) + { + fileId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InternalMessageTextFilePathDetails(fileId, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(InternalMessageTextFilePathDetails)} does not support writing '{options.Format}' format."); + } + } + + InternalMessageTextFilePathDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeInternalMessageTextFilePathDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InternalMessageTextFilePathDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static InternalMessageTextFilePathDetails FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeInternalMessageTextFilePathDetails(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/InternalMessageTextFilePathDetails.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalMessageTextFilePathDetails.cs new file mode 100644 index 000000000000..637a50aca3a2 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalMessageTextFilePathDetails.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// An encapsulation of an image file ID, as used by message image content. + internal partial class InternalMessageTextFilePathDetails + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The ID of the specific file that the citation is from. + /// is null. + internal InternalMessageTextFilePathDetails(string fileId) + { + Argument.AssertNotNull(fileId, nameof(fileId)); + + FileId = fileId; + } + + /// Initializes a new instance of . + /// The ID of the specific file that the citation is from. + /// Keeps track of any properties unknown to the library. + internal InternalMessageTextFilePathDetails(string fileId, IDictionary serializedAdditionalRawData) + { + FileId = fileId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InternalMessageTextFilePathDetails() + { + } + + /// The ID of the specific file that the citation is from. + public string FileId { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/InternalRequiredFunctionToolCallDetails.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalRequiredFunctionToolCallDetails.Serialization.cs new file mode 100644 index 000000000000..8c9a657036e0 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalRequiredFunctionToolCallDetails.Serialization.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class InternalRequiredFunctionToolCallDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InternalRequiredFunctionToolCallDetails)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WritePropertyName("arguments"u8); + writer.WriteStringValue(Arguments); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + InternalRequiredFunctionToolCallDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InternalRequiredFunctionToolCallDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInternalRequiredFunctionToolCallDetails(document.RootElement, options); + } + + internal static InternalRequiredFunctionToolCallDetails DeserializeInternalRequiredFunctionToolCallDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string arguments = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("arguments"u8)) + { + arguments = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InternalRequiredFunctionToolCallDetails(name, arguments, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(InternalRequiredFunctionToolCallDetails)} does not support writing '{options.Format}' format."); + } + } + + InternalRequiredFunctionToolCallDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeInternalRequiredFunctionToolCallDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InternalRequiredFunctionToolCallDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static InternalRequiredFunctionToolCallDetails FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeInternalRequiredFunctionToolCallDetails(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/InternalRequiredFunctionToolCallDetails.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalRequiredFunctionToolCallDetails.cs new file mode 100644 index 000000000000..2fbbc512d630 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalRequiredFunctionToolCallDetails.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The detailed information for a function invocation, as provided by a required action invoking a function tool, that includes the name of and arguments to the function. + internal partial class InternalRequiredFunctionToolCallDetails + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The name of the function. + /// The arguments to use when invoking the named function, as provided by the model. Arguments are presented as a JSON document that should be validated and parsed for evaluation. + /// or is null. + internal InternalRequiredFunctionToolCallDetails(string name, string arguments) + { + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(arguments, nameof(arguments)); + + Name = name; + Arguments = arguments; + } + + /// Initializes a new instance of . + /// The name of the function. + /// The arguments to use when invoking the named function, as provided by the model. Arguments are presented as a JSON document that should be validated and parsed for evaluation. + /// Keeps track of any properties unknown to the library. + internal InternalRequiredFunctionToolCallDetails(string name, string arguments, IDictionary serializedAdditionalRawData) + { + Name = name; + Arguments = arguments; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InternalRequiredFunctionToolCallDetails() + { + } + + /// The name of the function. + public string Name { get; } + /// The arguments to use when invoking the named function, as provided by the model. Arguments are presented as a JSON document that should be validated and parsed for evaluation. + public string Arguments { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/InternalRunStepFunctionToolCallDetails.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalRunStepFunctionToolCallDetails.Serialization.cs new file mode 100644 index 000000000000..040b56fa51cc --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalRunStepFunctionToolCallDetails.Serialization.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class InternalRunStepFunctionToolCallDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InternalRunStepFunctionToolCallDetails)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WritePropertyName("arguments"u8); + writer.WriteStringValue(Arguments); + if (Output != null) + { + writer.WritePropertyName("output"u8); + writer.WriteStringValue(Output); + } + else + { + writer.WriteNull("output"); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + InternalRunStepFunctionToolCallDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InternalRunStepFunctionToolCallDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInternalRunStepFunctionToolCallDetails(document.RootElement, options); + } + + internal static InternalRunStepFunctionToolCallDetails DeserializeInternalRunStepFunctionToolCallDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string arguments = default; + string output = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("arguments"u8)) + { + arguments = property.Value.GetString(); + continue; + } + if (property.NameEquals("output"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + output = null; + continue; + } + output = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InternalRunStepFunctionToolCallDetails(name, arguments, output, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(InternalRunStepFunctionToolCallDetails)} does not support writing '{options.Format}' format."); + } + } + + InternalRunStepFunctionToolCallDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeInternalRunStepFunctionToolCallDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InternalRunStepFunctionToolCallDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static InternalRunStepFunctionToolCallDetails FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeInternalRunStepFunctionToolCallDetails(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/InternalRunStepFunctionToolCallDetails.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalRunStepFunctionToolCallDetails.cs new file mode 100644 index 000000000000..1103e3603dc2 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalRunStepFunctionToolCallDetails.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The detailed information about the function called by the model. + internal partial class InternalRunStepFunctionToolCallDetails + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The name of the function. + /// The arguments that the model requires are provided to the named function. + /// The output of the function, only populated for function calls that have already have had their outputs submitted. + /// or is null. + internal InternalRunStepFunctionToolCallDetails(string name, string arguments, string output) + { + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(arguments, nameof(arguments)); + + Name = name; + Arguments = arguments; + Output = output; + } + + /// Initializes a new instance of . + /// The name of the function. + /// The arguments that the model requires are provided to the named function. + /// The output of the function, only populated for function calls that have already have had their outputs submitted. + /// Keeps track of any properties unknown to the library. + internal InternalRunStepFunctionToolCallDetails(string name, string arguments, string output, IDictionary serializedAdditionalRawData) + { + Name = name; + Arguments = arguments; + Output = output; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InternalRunStepFunctionToolCallDetails() + { + } + + /// The name of the function. + public string Name { get; } + /// The arguments that the model requires are provided to the named function. + public string Arguments { get; } + /// The output of the function, only populated for function calls that have already have had their outputs submitted. + public string Output { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/InternalSubmitToolOutputsDetails.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalSubmitToolOutputsDetails.Serialization.cs new file mode 100644 index 000000000000..2a2038b02a90 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalSubmitToolOutputsDetails.Serialization.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class InternalSubmitToolOutputsDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InternalSubmitToolOutputsDetails)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("tool_calls"u8); + writer.WriteStartArray(); + foreach (var item in ToolCalls) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + InternalSubmitToolOutputsDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InternalSubmitToolOutputsDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInternalSubmitToolOutputsDetails(document.RootElement, options); + } + + internal static InternalSubmitToolOutputsDetails DeserializeInternalSubmitToolOutputsDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList toolCalls = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tool_calls"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(RequiredToolCall.DeserializeRequiredToolCall(item, options)); + } + toolCalls = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InternalSubmitToolOutputsDetails(toolCalls, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(InternalSubmitToolOutputsDetails)} does not support writing '{options.Format}' format."); + } + } + + InternalSubmitToolOutputsDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeInternalSubmitToolOutputsDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InternalSubmitToolOutputsDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static InternalSubmitToolOutputsDetails FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeInternalSubmitToolOutputsDetails(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/InternalSubmitToolOutputsDetails.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalSubmitToolOutputsDetails.cs new file mode 100644 index 000000000000..752083f1945c --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/InternalSubmitToolOutputsDetails.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Assistants +{ + /// The details describing tools that should be called to submit tool outputs. + internal partial class InternalSubmitToolOutputsDetails + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// + /// The list of tool calls that must be resolved for the agent thread run to continue. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + /// is null. + internal InternalSubmitToolOutputsDetails(IEnumerable toolCalls) + { + Argument.AssertNotNull(toolCalls, nameof(toolCalls)); + + ToolCalls = toolCalls.ToList(); + } + + /// Initializes a new instance of . + /// + /// The list of tool calls that must be resolved for the agent thread run to continue. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + /// Keeps track of any properties unknown to the library. + internal InternalSubmitToolOutputsDetails(IReadOnlyList toolCalls, IDictionary serializedAdditionalRawData) + { + ToolCalls = toolCalls; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InternalSubmitToolOutputsDetails() + { + } + + /// + /// The list of tool calls that must be resolved for the agent thread run to continue. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + public IReadOnlyList ToolCalls { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/ListSortOrder.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/ListSortOrder.cs new file mode 100644 index 000000000000..5ab7b5f6ea80 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/ListSortOrder.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// The available sorting options when requesting a list of response objects. + public readonly partial struct ListSortOrder : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ListSortOrder(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AscendingValue = "asc"; + private const string DescendingValue = "desc"; + + /// Specifies an ascending sort order. + public static ListSortOrder Ascending { get; } = new ListSortOrder(AscendingValue); + /// Specifies a descending sort order. + public static ListSortOrder Descending { get; } = new ListSortOrder(DescendingValue); + /// Determines if two values are the same. + public static bool operator ==(ListSortOrder left, ListSortOrder right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ListSortOrder left, ListSortOrder right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ListSortOrder(string value) => new ListSortOrder(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ListSortOrder other && Equals(other); + /// + public bool Equals(ListSortOrder other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageAttachment.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageAttachment.Serialization.cs new file mode 100644 index 000000000000..2f53c04a8267 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageAttachment.Serialization.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class MessageAttachment : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageAttachment)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(FileId)) + { + writer.WritePropertyName("file_id"u8); + writer.WriteStringValue(FileId); + } + if (Optional.IsDefined(DataSource)) + { + writer.WritePropertyName("data_source"u8); + writer.WriteObjectValue(DataSource, options); + } + writer.WritePropertyName("tools"u8); + writer.WriteStartArray(); + foreach (var item in Tools) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } +#if NET6_0_OR_GREATER + writer.WriteRawValue(item); +#else + using (JsonDocument document = JsonDocument.Parse(item, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MessageAttachment IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageAttachment)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMessageAttachment(document.RootElement, options); + } + + internal static MessageAttachment DeserializeMessageAttachment(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string fileId = default; + VectorStoreDataSource dataSource = default; + IList tools = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("file_id"u8)) + { + fileId = property.Value.GetString(); + continue; + } + if (property.NameEquals("data_source"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dataSource = VectorStoreDataSource.DeserializeVectorStoreDataSource(property.Value, options); + continue; + } + if (property.NameEquals("tools"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(BinaryData.FromString(item.GetRawText())); + } + } + tools = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MessageAttachment(fileId, dataSource, tools, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MessageAttachment)} does not support writing '{options.Format}' format."); + } + } + + MessageAttachment IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageAttachment(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MessageAttachment)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static MessageAttachment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageAttachment(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageAttachment.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageAttachment.cs new file mode 100644 index 000000000000..359d2040e17b --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageAttachment.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Assistants +{ + /// This describes to which tools a file has been attached. + public partial class MessageAttachment + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The tools to add to this file. + /// is null. + public MessageAttachment(IEnumerable tools) + { + Argument.AssertNotNull(tools, nameof(tools)); + + Tools = tools.ToList(); + } + + /// Initializes a new instance of . + /// The ID of the file to attach to the message. + /// Azure asset ID. + /// The tools to add to this file. + /// Keeps track of any properties unknown to the library. + internal MessageAttachment(string fileId, VectorStoreDataSource dataSource, IList tools, IDictionary serializedAdditionalRawData) + { + FileId = fileId; + DataSource = dataSource; + Tools = tools; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MessageAttachment() + { + } + + /// The ID of the file to attach to the message. + public string FileId { get; set; } + /// Azure asset ID. + public VectorStoreDataSource DataSource { get; set; } + /// + /// The tools to add to this file. + /// + /// To assign an object to the element of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// + /// Supported types: + /// + /// + /// + /// + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + public IList Tools { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageContent.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageContent.Serialization.cs new file mode 100644 index 000000000000..4c3c7ec0b479 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageContent.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + [PersistableModelProxy(typeof(UnknownMessageContent))] + public partial class MessageContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageContent)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MessageContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMessageContent(document.RootElement, options); + } + + internal static MessageContent DeserializeMessageContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("type", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "image_file": return MessageImageFileContent.DeserializeMessageImageFileContent(element, options); + case "text": return MessageTextContent.DeserializeMessageTextContent(element, options); + } + } + return UnknownMessageContent.DeserializeUnknownMessageContent(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MessageContent)} does not support writing '{options.Format}' format."); + } + } + + MessageContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MessageContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static MessageContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageContent.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageContent.cs new file mode 100644 index 000000000000..89f0bb29d925 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageContent.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// + /// An abstract representation of a single item of thread message content. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public abstract partial class MessageContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + protected MessageContent() + { + } + + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + internal MessageContent(string type, IDictionary serializedAdditionalRawData) + { + Type = type; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The object type. + internal string Type { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDelta.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDelta.Serialization.cs new file mode 100644 index 000000000000..077343d91bb5 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDelta.Serialization.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class MessageDelta : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageDelta)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("role"u8); + writer.WriteStringValue(Role.ToString()); + writer.WritePropertyName("content"u8); + writer.WriteStartArray(); + foreach (var item in Content) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MessageDelta IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageDelta)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMessageDelta(document.RootElement, options); + } + + internal static MessageDelta DeserializeMessageDelta(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + MessageRole role = default; + IReadOnlyList content = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("role"u8)) + { + role = new MessageRole(property.Value.GetString()); + continue; + } + if (property.NameEquals("content"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MessageDeltaContent.DeserializeMessageDeltaContent(item, options)); + } + content = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MessageDelta(role, content, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MessageDelta)} does not support writing '{options.Format}' format."); + } + } + + MessageDelta IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageDelta(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MessageDelta)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static MessageDelta FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageDelta(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDelta.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDelta.cs new file mode 100644 index 000000000000..a7a45aa37332 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDelta.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Assistants +{ + /// Represents the typed 'delta' payload within a streaming message delta chunk. + public partial class MessageDelta + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The entity that produced the message. + /// + /// The content of the message as an array of text and/or images. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// is null. + internal MessageDelta(MessageRole role, IEnumerable content) + { + Argument.AssertNotNull(content, nameof(content)); + + Role = role; + Content = content.ToList(); + } + + /// Initializes a new instance of . + /// The entity that produced the message. + /// + /// The content of the message as an array of text and/or images. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// Keeps track of any properties unknown to the library. + internal MessageDelta(MessageRole role, IReadOnlyList content, IDictionary serializedAdditionalRawData) + { + Role = role; + Content = content; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MessageDelta() + { + } + + /// The entity that produced the message. + public MessageRole Role { get; } + /// + /// The content of the message as an array of text and/or images. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public IReadOnlyList Content { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaChunk.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaChunk.Serialization.cs new file mode 100644 index 000000000000..9f659dc69be1 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaChunk.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class MessageDeltaChunk : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageDeltaChunk)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("object"u8); + writer.WriteStringValue(Object.ToString()); + writer.WritePropertyName("delta"u8); + writer.WriteObjectValue(Delta, options); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MessageDeltaChunk IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageDeltaChunk)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMessageDeltaChunk(document.RootElement, options); + } + + internal static MessageDeltaChunk DeserializeMessageDeltaChunk(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + MessageDeltaChunkObject @object = default; + MessageDelta delta = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("object"u8)) + { + @object = new MessageDeltaChunkObject(property.Value.GetString()); + continue; + } + if (property.NameEquals("delta"u8)) + { + delta = MessageDelta.DeserializeMessageDelta(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MessageDeltaChunk(id, @object, delta, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MessageDeltaChunk)} does not support writing '{options.Format}' format."); + } + } + + MessageDeltaChunk IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageDeltaChunk(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MessageDeltaChunk)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static MessageDeltaChunk FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageDeltaChunk(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaChunk.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaChunk.cs new file mode 100644 index 000000000000..2c8a2f1fb5b1 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaChunk.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Represents a message delta i.e. any changed fields on a message during streaming. + public partial class MessageDeltaChunk + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The identifier of the message, which can be referenced in API endpoints. + /// The delta containing the fields that have changed on the Message. + /// or is null. + internal MessageDeltaChunk(string id, MessageDelta delta) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(delta, nameof(delta)); + + Id = id; + Delta = delta; + } + + /// Initializes a new instance of . + /// The identifier of the message, which can be referenced in API endpoints. + /// The object type, which is always `thread.message.delta`. + /// The delta containing the fields that have changed on the Message. + /// Keeps track of any properties unknown to the library. + internal MessageDeltaChunk(string id, MessageDeltaChunkObject @object, MessageDelta delta, IDictionary serializedAdditionalRawData) + { + Id = id; + Object = @object; + Delta = delta; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MessageDeltaChunk() + { + } + + /// The identifier of the message, which can be referenced in API endpoints. + public string Id { get; } + /// The object type, which is always `thread.message.delta`. + public MessageDeltaChunkObject Object { get; } = MessageDeltaChunkObject.ThreadMessageDelta; + + /// The delta containing the fields that have changed on the Message. + public MessageDelta Delta { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaChunkObject.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaChunkObject.cs new file mode 100644 index 000000000000..bebc39953bf6 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaChunkObject.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// The MessageDeltaChunk_object. + public readonly partial struct MessageDeltaChunkObject : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public MessageDeltaChunkObject(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ThreadMessageDeltaValue = "thread.message.delta"; + + /// thread.message.delta. + public static MessageDeltaChunkObject ThreadMessageDelta { get; } = new MessageDeltaChunkObject(ThreadMessageDeltaValue); + /// Determines if two values are the same. + public static bool operator ==(MessageDeltaChunkObject left, MessageDeltaChunkObject right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(MessageDeltaChunkObject left, MessageDeltaChunkObject right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator MessageDeltaChunkObject(string value) => new MessageDeltaChunkObject(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is MessageDeltaChunkObject other && Equals(other); + /// + public bool Equals(MessageDeltaChunkObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaContent.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaContent.Serialization.cs new file mode 100644 index 000000000000..ffbfc6cd4fe7 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaContent.Serialization.cs @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + [PersistableModelProxy(typeof(UnknownMessageDeltaContent))] + public partial class MessageDeltaContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageDeltaContent)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("index"u8); + writer.WriteNumberValue(Index); + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MessageDeltaContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageDeltaContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMessageDeltaContent(document.RootElement, options); + } + + internal static MessageDeltaContent DeserializeMessageDeltaContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("type", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "image_file": return MessageDeltaImageFileContent.DeserializeMessageDeltaImageFileContent(element, options); + case "text": return MessageDeltaTextContent.DeserializeMessageDeltaTextContent(element, options); + } + } + return UnknownMessageDeltaContent.DeserializeUnknownMessageDeltaContent(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MessageDeltaContent)} does not support writing '{options.Format}' format."); + } + } + + MessageDeltaContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageDeltaContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MessageDeltaContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static MessageDeltaContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageDeltaContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaContent.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaContent.cs new file mode 100644 index 000000000000..6e199c8d2702 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaContent.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// + /// The abstract base representation of a partial streamed message content payload. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public abstract partial class MessageDeltaContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The index of the content part of the message. + protected MessageDeltaContent(int index) + { + Index = index; + } + + /// Initializes a new instance of . + /// The index of the content part of the message. + /// The type of content for this content part. + /// Keeps track of any properties unknown to the library. + internal MessageDeltaContent(int index, string type, IDictionary serializedAdditionalRawData) + { + Index = index; + Type = type; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MessageDeltaContent() + { + } + + /// The index of the content part of the message. + public int Index { get; } + /// The type of content for this content part. + internal string Type { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaImageFileContent.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaImageFileContent.Serialization.cs new file mode 100644 index 000000000000..e17a0e7d3e09 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaImageFileContent.Serialization.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class MessageDeltaImageFileContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageDeltaImageFileContent)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(ImageFile)) + { + writer.WritePropertyName("image_file"u8); + writer.WriteObjectValue(ImageFile, options); + } + } + + MessageDeltaImageFileContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageDeltaImageFileContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMessageDeltaImageFileContent(document.RootElement, options); + } + + internal static MessageDeltaImageFileContent DeserializeMessageDeltaImageFileContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + MessageDeltaImageFileContentObject imageFile = default; + int index = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("image_file"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + imageFile = MessageDeltaImageFileContentObject.DeserializeMessageDeltaImageFileContentObject(property.Value, options); + continue; + } + if (property.NameEquals("index"u8)) + { + index = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MessageDeltaImageFileContent(index, type, serializedAdditionalRawData, imageFile); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MessageDeltaImageFileContent)} does not support writing '{options.Format}' format."); + } + } + + MessageDeltaImageFileContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageDeltaImageFileContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MessageDeltaImageFileContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new MessageDeltaImageFileContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageDeltaImageFileContent(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaImageFileContent.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaImageFileContent.cs new file mode 100644 index 000000000000..52463cef013a --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaImageFileContent.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Represents a streamed image file content part within a streaming message delta chunk. + public partial class MessageDeltaImageFileContent : MessageDeltaContent + { + /// Initializes a new instance of . + /// The index of the content part of the message. + internal MessageDeltaImageFileContent(int index) : base(index) + { + Type = "image_file"; + } + + /// Initializes a new instance of . + /// The index of the content part of the message. + /// The type of content for this content part. + /// Keeps track of any properties unknown to the library. + /// The image_file data. + internal MessageDeltaImageFileContent(int index, string type, IDictionary serializedAdditionalRawData, MessageDeltaImageFileContentObject imageFile) : base(index, type, serializedAdditionalRawData) + { + ImageFile = imageFile; + } + + /// Initializes a new instance of for deserialization. + internal MessageDeltaImageFileContent() + { + } + + /// The image_file data. + public MessageDeltaImageFileContentObject ImageFile { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaImageFileContentObject.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaImageFileContentObject.Serialization.cs new file mode 100644 index 000000000000..ea6025c02594 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaImageFileContentObject.Serialization.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class MessageDeltaImageFileContentObject : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageDeltaImageFileContentObject)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(FileId)) + { + writer.WritePropertyName("file_id"u8); + writer.WriteStringValue(FileId); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MessageDeltaImageFileContentObject IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageDeltaImageFileContentObject)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMessageDeltaImageFileContentObject(document.RootElement, options); + } + + internal static MessageDeltaImageFileContentObject DeserializeMessageDeltaImageFileContentObject(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string fileId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("file_id"u8)) + { + fileId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MessageDeltaImageFileContentObject(fileId, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MessageDeltaImageFileContentObject)} does not support writing '{options.Format}' format."); + } + } + + MessageDeltaImageFileContentObject IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageDeltaImageFileContentObject(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MessageDeltaImageFileContentObject)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static MessageDeltaImageFileContentObject FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageDeltaImageFileContentObject(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaImageFileContentObject.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaImageFileContentObject.cs new file mode 100644 index 000000000000..2ca47098e1b9 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaImageFileContentObject.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Represents the 'image_file' payload within streaming image file content. + public partial class MessageDeltaImageFileContentObject + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal MessageDeltaImageFileContentObject() + { + } + + /// Initializes a new instance of . + /// The file ID of the image in the message content. + /// Keeps track of any properties unknown to the library. + internal MessageDeltaImageFileContentObject(string fileId, IDictionary serializedAdditionalRawData) + { + FileId = fileId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The file ID of the image in the message content. + public string FileId { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextAnnotation.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextAnnotation.Serialization.cs new file mode 100644 index 000000000000..53960f06b978 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextAnnotation.Serialization.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + [PersistableModelProxy(typeof(UnknownMessageDeltaTextAnnotation))] + public partial class MessageDeltaTextAnnotation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageDeltaTextAnnotation)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("index"u8); + writer.WriteNumberValue(Index); + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MessageDeltaTextAnnotation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageDeltaTextAnnotation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMessageDeltaTextAnnotation(document.RootElement, options); + } + + internal static MessageDeltaTextAnnotation DeserializeMessageDeltaTextAnnotation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("type", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "file_citation": return MessageDeltaTextFileCitationAnnotation.DeserializeMessageDeltaTextFileCitationAnnotation(element, options); + case "file_path": return MessageDeltaTextFilePathAnnotation.DeserializeMessageDeltaTextFilePathAnnotation(element, options); + case "url_citation": return MessageDeltaTextUrlCitationAnnotation.DeserializeMessageDeltaTextUrlCitationAnnotation(element, options); + } + } + return UnknownMessageDeltaTextAnnotation.DeserializeUnknownMessageDeltaTextAnnotation(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MessageDeltaTextAnnotation)} does not support writing '{options.Format}' format."); + } + } + + MessageDeltaTextAnnotation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageDeltaTextAnnotation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MessageDeltaTextAnnotation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static MessageDeltaTextAnnotation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageDeltaTextAnnotation(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextAnnotation.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextAnnotation.cs new file mode 100644 index 000000000000..f0aa96c5b44c --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextAnnotation.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// + /// The abstract base representation of a streamed text content part's text annotation. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + public abstract partial class MessageDeltaTextAnnotation + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The index of the annotation within a text content part. + protected MessageDeltaTextAnnotation(int index) + { + Index = index; + } + + /// Initializes a new instance of . + /// The index of the annotation within a text content part. + /// The type of the text content annotation. + /// Keeps track of any properties unknown to the library. + internal MessageDeltaTextAnnotation(int index, string type, IDictionary serializedAdditionalRawData) + { + Index = index; + Type = type; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MessageDeltaTextAnnotation() + { + } + + /// The index of the annotation within a text content part. + public int Index { get; } + /// The type of the text content annotation. + internal string Type { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextContent.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextContent.Serialization.cs new file mode 100644 index 000000000000..2ccce4c5b31f --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextContent.Serialization.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class MessageDeltaTextContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageDeltaTextContent)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Text)) + { + writer.WritePropertyName("text"u8); + writer.WriteObjectValue(Text, options); + } + } + + MessageDeltaTextContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageDeltaTextContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMessageDeltaTextContent(document.RootElement, options); + } + + internal static MessageDeltaTextContent DeserializeMessageDeltaTextContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + MessageDeltaTextContentObject text = default; + int index = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("text"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + text = MessageDeltaTextContentObject.DeserializeMessageDeltaTextContentObject(property.Value, options); + continue; + } + if (property.NameEquals("index"u8)) + { + index = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MessageDeltaTextContent(index, type, serializedAdditionalRawData, text); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MessageDeltaTextContent)} does not support writing '{options.Format}' format."); + } + } + + MessageDeltaTextContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageDeltaTextContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MessageDeltaTextContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new MessageDeltaTextContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageDeltaTextContent(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextContent.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextContent.cs new file mode 100644 index 000000000000..f2d98f263f72 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextContent.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Represents a streamed text content part within a streaming message delta chunk. + public partial class MessageDeltaTextContent : MessageDeltaContent + { + /// Initializes a new instance of . + /// The index of the content part of the message. + internal MessageDeltaTextContent(int index) : base(index) + { + Type = "text"; + } + + /// Initializes a new instance of . + /// The index of the content part of the message. + /// The type of content for this content part. + /// Keeps track of any properties unknown to the library. + /// The text content details. + internal MessageDeltaTextContent(int index, string type, IDictionary serializedAdditionalRawData, MessageDeltaTextContentObject text) : base(index, type, serializedAdditionalRawData) + { + Text = text; + } + + /// Initializes a new instance of for deserialization. + internal MessageDeltaTextContent() + { + } + + /// The text content details. + public MessageDeltaTextContentObject Text { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextContentObject.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextContentObject.Serialization.cs new file mode 100644 index 000000000000..de969acfa787 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextContentObject.Serialization.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class MessageDeltaTextContentObject : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageDeltaTextContentObject)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (Optional.IsCollectionDefined(Annotations)) + { + writer.WritePropertyName("annotations"u8); + writer.WriteStartArray(); + foreach (var item in Annotations) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MessageDeltaTextContentObject IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageDeltaTextContentObject)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMessageDeltaTextContentObject(document.RootElement, options); + } + + internal static MessageDeltaTextContentObject DeserializeMessageDeltaTextContentObject(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string value = default; + IReadOnlyList annotations = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (property.NameEquals("annotations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MessageDeltaTextAnnotation.DeserializeMessageDeltaTextAnnotation(item, options)); + } + annotations = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MessageDeltaTextContentObject(value, annotations ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MessageDeltaTextContentObject)} does not support writing '{options.Format}' format."); + } + } + + MessageDeltaTextContentObject IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageDeltaTextContentObject(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MessageDeltaTextContentObject)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static MessageDeltaTextContentObject FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageDeltaTextContentObject(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextContentObject.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextContentObject.cs new file mode 100644 index 000000000000..c193c6665f61 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextContentObject.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Represents the data of a streamed text content part within a streaming message delta chunk. + public partial class MessageDeltaTextContentObject + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal MessageDeltaTextContentObject() + { + Annotations = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The data that makes up the text. + /// + /// Annotations for the text. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// Keeps track of any properties unknown to the library. + internal MessageDeltaTextContentObject(string value, IReadOnlyList annotations, IDictionary serializedAdditionalRawData) + { + Value = value; + Annotations = annotations; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The data that makes up the text. + public string Value { get; } + /// + /// Annotations for the text. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + public IReadOnlyList Annotations { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextFileCitationAnnotation.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextFileCitationAnnotation.Serialization.cs new file mode 100644 index 000000000000..08775d3798b1 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextFileCitationAnnotation.Serialization.cs @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class MessageDeltaTextFileCitationAnnotation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageDeltaTextFileCitationAnnotation)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(FileCitation)) + { + writer.WritePropertyName("file_citation"u8); + writer.WriteObjectValue(FileCitation, options); + } + if (Optional.IsDefined(Text)) + { + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + } + if (Optional.IsDefined(StartIndex)) + { + writer.WritePropertyName("start_index"u8); + writer.WriteNumberValue(StartIndex.Value); + } + if (Optional.IsDefined(EndIndex)) + { + writer.WritePropertyName("end_index"u8); + writer.WriteNumberValue(EndIndex.Value); + } + } + + MessageDeltaTextFileCitationAnnotation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageDeltaTextFileCitationAnnotation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMessageDeltaTextFileCitationAnnotation(document.RootElement, options); + } + + internal static MessageDeltaTextFileCitationAnnotation DeserializeMessageDeltaTextFileCitationAnnotation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + MessageDeltaTextFileCitationAnnotationObject fileCitation = default; + string text = default; + int? startIndex = default; + int? endIndex = default; + int index = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("file_citation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + fileCitation = MessageDeltaTextFileCitationAnnotationObject.DeserializeMessageDeltaTextFileCitationAnnotationObject(property.Value, options); + continue; + } + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("start_index"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + startIndex = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("end_index"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endIndex = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("index"u8)) + { + index = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MessageDeltaTextFileCitationAnnotation( + index, + type, + serializedAdditionalRawData, + fileCitation, + text, + startIndex, + endIndex); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MessageDeltaTextFileCitationAnnotation)} does not support writing '{options.Format}' format."); + } + } + + MessageDeltaTextFileCitationAnnotation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageDeltaTextFileCitationAnnotation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MessageDeltaTextFileCitationAnnotation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new MessageDeltaTextFileCitationAnnotation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageDeltaTextFileCitationAnnotation(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextFileCitationAnnotation.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextFileCitationAnnotation.cs new file mode 100644 index 000000000000..bc3974b3be4c --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextFileCitationAnnotation.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Represents a streamed file citation applied to a streaming text content part. + public partial class MessageDeltaTextFileCitationAnnotation : MessageDeltaTextAnnotation + { + /// Initializes a new instance of . + /// The index of the annotation within a text content part. + internal MessageDeltaTextFileCitationAnnotation(int index) : base(index) + { + Type = "file_citation"; + } + + /// Initializes a new instance of . + /// The index of the annotation within a text content part. + /// The type of the text content annotation. + /// Keeps track of any properties unknown to the library. + /// The file citation information. + /// The text in the message content that needs to be replaced. + /// The start index of this annotation in the content text. + /// The end index of this annotation in the content text. + internal MessageDeltaTextFileCitationAnnotation(int index, string type, IDictionary serializedAdditionalRawData, MessageDeltaTextFileCitationAnnotationObject fileCitation, string text, int? startIndex, int? endIndex) : base(index, type, serializedAdditionalRawData) + { + FileCitation = fileCitation; + Text = text; + StartIndex = startIndex; + EndIndex = endIndex; + } + + /// Initializes a new instance of for deserialization. + internal MessageDeltaTextFileCitationAnnotation() + { + } + + /// The file citation information. + public MessageDeltaTextFileCitationAnnotationObject FileCitation { get; } + /// The text in the message content that needs to be replaced. + public string Text { get; } + /// The start index of this annotation in the content text. + public int? StartIndex { get; } + /// The end index of this annotation in the content text. + public int? EndIndex { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextFileCitationAnnotationObject.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextFileCitationAnnotationObject.Serialization.cs new file mode 100644 index 000000000000..26fb6697ed38 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextFileCitationAnnotationObject.Serialization.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class MessageDeltaTextFileCitationAnnotationObject : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageDeltaTextFileCitationAnnotationObject)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(FileId)) + { + writer.WritePropertyName("file_id"u8); + writer.WriteStringValue(FileId); + } + if (Optional.IsDefined(Quote)) + { + writer.WritePropertyName("quote"u8); + writer.WriteStringValue(Quote); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MessageDeltaTextFileCitationAnnotationObject IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageDeltaTextFileCitationAnnotationObject)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMessageDeltaTextFileCitationAnnotationObject(document.RootElement, options); + } + + internal static MessageDeltaTextFileCitationAnnotationObject DeserializeMessageDeltaTextFileCitationAnnotationObject(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string fileId = default; + string quote = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("file_id"u8)) + { + fileId = property.Value.GetString(); + continue; + } + if (property.NameEquals("quote"u8)) + { + quote = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MessageDeltaTextFileCitationAnnotationObject(fileId, quote, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MessageDeltaTextFileCitationAnnotationObject)} does not support writing '{options.Format}' format."); + } + } + + MessageDeltaTextFileCitationAnnotationObject IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageDeltaTextFileCitationAnnotationObject(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MessageDeltaTextFileCitationAnnotationObject)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static MessageDeltaTextFileCitationAnnotationObject FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageDeltaTextFileCitationAnnotationObject(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextFileCitationAnnotationObject.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextFileCitationAnnotationObject.cs new file mode 100644 index 000000000000..186c2e4af118 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextFileCitationAnnotationObject.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Represents the data of a streamed file citation as applied to a streaming text content part. + public partial class MessageDeltaTextFileCitationAnnotationObject + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal MessageDeltaTextFileCitationAnnotationObject() + { + } + + /// Initializes a new instance of . + /// The ID of the specific file the citation is from. + /// The specific quote in the cited file. + /// Keeps track of any properties unknown to the library. + internal MessageDeltaTextFileCitationAnnotationObject(string fileId, string quote, IDictionary serializedAdditionalRawData) + { + FileId = fileId; + Quote = quote; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The ID of the specific file the citation is from. + public string FileId { get; } + /// The specific quote in the cited file. + public string Quote { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextFilePathAnnotation.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextFilePathAnnotation.Serialization.cs new file mode 100644 index 000000000000..9393d47e138c --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextFilePathAnnotation.Serialization.cs @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class MessageDeltaTextFilePathAnnotation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageDeltaTextFilePathAnnotation)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(FilePath)) + { + writer.WritePropertyName("file_path"u8); + writer.WriteObjectValue(FilePath, options); + } + if (Optional.IsDefined(StartIndex)) + { + writer.WritePropertyName("start_index"u8); + writer.WriteNumberValue(StartIndex.Value); + } + if (Optional.IsDefined(EndIndex)) + { + writer.WritePropertyName("end_index"u8); + writer.WriteNumberValue(EndIndex.Value); + } + if (Optional.IsDefined(Text)) + { + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + } + } + + MessageDeltaTextFilePathAnnotation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageDeltaTextFilePathAnnotation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMessageDeltaTextFilePathAnnotation(document.RootElement, options); + } + + internal static MessageDeltaTextFilePathAnnotation DeserializeMessageDeltaTextFilePathAnnotation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + MessageDeltaTextFilePathAnnotationObject filePath = default; + int? startIndex = default; + int? endIndex = default; + string text = default; + int index = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("file_path"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + filePath = MessageDeltaTextFilePathAnnotationObject.DeserializeMessageDeltaTextFilePathAnnotationObject(property.Value, options); + continue; + } + if (property.NameEquals("start_index"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + startIndex = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("end_index"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endIndex = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("index"u8)) + { + index = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MessageDeltaTextFilePathAnnotation( + index, + type, + serializedAdditionalRawData, + filePath, + startIndex, + endIndex, + text); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MessageDeltaTextFilePathAnnotation)} does not support writing '{options.Format}' format."); + } + } + + MessageDeltaTextFilePathAnnotation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageDeltaTextFilePathAnnotation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MessageDeltaTextFilePathAnnotation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new MessageDeltaTextFilePathAnnotation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageDeltaTextFilePathAnnotation(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextFilePathAnnotation.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextFilePathAnnotation.cs new file mode 100644 index 000000000000..63877c3a6f4c --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextFilePathAnnotation.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Represents a streamed file path annotation applied to a streaming text content part. + public partial class MessageDeltaTextFilePathAnnotation : MessageDeltaTextAnnotation + { + /// Initializes a new instance of . + /// The index of the annotation within a text content part. + internal MessageDeltaTextFilePathAnnotation(int index) : base(index) + { + Type = "file_path"; + } + + /// Initializes a new instance of . + /// The index of the annotation within a text content part. + /// The type of the text content annotation. + /// Keeps track of any properties unknown to the library. + /// The file path information. + /// The start index of this annotation in the content text. + /// The end index of this annotation in the content text. + /// The text in the message content that needs to be replaced. + internal MessageDeltaTextFilePathAnnotation(int index, string type, IDictionary serializedAdditionalRawData, MessageDeltaTextFilePathAnnotationObject filePath, int? startIndex, int? endIndex, string text) : base(index, type, serializedAdditionalRawData) + { + FilePath = filePath; + StartIndex = startIndex; + EndIndex = endIndex; + Text = text; + } + + /// Initializes a new instance of for deserialization. + internal MessageDeltaTextFilePathAnnotation() + { + } + + /// The file path information. + public MessageDeltaTextFilePathAnnotationObject FilePath { get; } + /// The start index of this annotation in the content text. + public int? StartIndex { get; } + /// The end index of this annotation in the content text. + public int? EndIndex { get; } + /// The text in the message content that needs to be replaced. + public string Text { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextFilePathAnnotationObject.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextFilePathAnnotationObject.Serialization.cs new file mode 100644 index 000000000000..4cd697849a6b --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextFilePathAnnotationObject.Serialization.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class MessageDeltaTextFilePathAnnotationObject : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageDeltaTextFilePathAnnotationObject)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(FileId)) + { + writer.WritePropertyName("file_id"u8); + writer.WriteStringValue(FileId); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MessageDeltaTextFilePathAnnotationObject IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageDeltaTextFilePathAnnotationObject)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMessageDeltaTextFilePathAnnotationObject(document.RootElement, options); + } + + internal static MessageDeltaTextFilePathAnnotationObject DeserializeMessageDeltaTextFilePathAnnotationObject(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string fileId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("file_id"u8)) + { + fileId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MessageDeltaTextFilePathAnnotationObject(fileId, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MessageDeltaTextFilePathAnnotationObject)} does not support writing '{options.Format}' format."); + } + } + + MessageDeltaTextFilePathAnnotationObject IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageDeltaTextFilePathAnnotationObject(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MessageDeltaTextFilePathAnnotationObject)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static MessageDeltaTextFilePathAnnotationObject FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageDeltaTextFilePathAnnotationObject(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextFilePathAnnotationObject.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextFilePathAnnotationObject.cs new file mode 100644 index 000000000000..5dd3980f6f82 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextFilePathAnnotationObject.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Represents the data of a streamed file path annotation as applied to a streaming text content part. + public partial class MessageDeltaTextFilePathAnnotationObject + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal MessageDeltaTextFilePathAnnotationObject() + { + } + + /// Initializes a new instance of . + /// The file ID for the annotation. + /// Keeps track of any properties unknown to the library. + internal MessageDeltaTextFilePathAnnotationObject(string fileId, IDictionary serializedAdditionalRawData) + { + FileId = fileId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The file ID for the annotation. + public string FileId { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextUrlCitationAnnotation.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextUrlCitationAnnotation.Serialization.cs new file mode 100644 index 000000000000..a1f5eef3a4f5 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextUrlCitationAnnotation.Serialization.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class MessageDeltaTextUrlCitationAnnotation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageDeltaTextUrlCitationAnnotation)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("url_citation"u8); + writer.WriteObjectValue(UrlCitation, options); + if (Optional.IsDefined(StartIndex)) + { + writer.WritePropertyName("start_index"u8); + writer.WriteNumberValue(StartIndex.Value); + } + if (Optional.IsDefined(EndIndex)) + { + writer.WritePropertyName("end_index"u8); + writer.WriteNumberValue(EndIndex.Value); + } + } + + MessageDeltaTextUrlCitationAnnotation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageDeltaTextUrlCitationAnnotation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMessageDeltaTextUrlCitationAnnotation(document.RootElement, options); + } + + internal static MessageDeltaTextUrlCitationAnnotation DeserializeMessageDeltaTextUrlCitationAnnotation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + MessageDeltaTextUrlCitationDetails urlCitation = default; + int? startIndex = default; + int? endIndex = default; + int index = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("url_citation"u8)) + { + urlCitation = MessageDeltaTextUrlCitationDetails.DeserializeMessageDeltaTextUrlCitationDetails(property.Value, options); + continue; + } + if (property.NameEquals("start_index"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + startIndex = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("end_index"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endIndex = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("index"u8)) + { + index = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MessageDeltaTextUrlCitationAnnotation( + index, + type, + serializedAdditionalRawData, + urlCitation, + startIndex, + endIndex); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MessageDeltaTextUrlCitationAnnotation)} does not support writing '{options.Format}' format."); + } + } + + MessageDeltaTextUrlCitationAnnotation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageDeltaTextUrlCitationAnnotation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MessageDeltaTextUrlCitationAnnotation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new MessageDeltaTextUrlCitationAnnotation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageDeltaTextUrlCitationAnnotation(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextUrlCitationAnnotation.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextUrlCitationAnnotation.cs new file mode 100644 index 000000000000..fcad2853d974 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextUrlCitationAnnotation.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// A citation within the message that points to a specific URL associated with the message. Generated when the agent uses tools such as 'bing_grounding' to search the Internet. + public partial class MessageDeltaTextUrlCitationAnnotation : MessageDeltaTextAnnotation + { + /// Initializes a new instance of . + /// The index of the annotation within a text content part. + /// The details of the URL citation. + /// is null. + internal MessageDeltaTextUrlCitationAnnotation(int index, MessageDeltaTextUrlCitationDetails urlCitation) : base(index) + { + Argument.AssertNotNull(urlCitation, nameof(urlCitation)); + + Type = "url_citation"; + UrlCitation = urlCitation; + } + + /// Initializes a new instance of . + /// The index of the annotation within a text content part. + /// The type of the text content annotation. + /// Keeps track of any properties unknown to the library. + /// The details of the URL citation. + /// The first text index associated with this text annotation. + /// The last text index associated with this text annotation. + internal MessageDeltaTextUrlCitationAnnotation(int index, string type, IDictionary serializedAdditionalRawData, MessageDeltaTextUrlCitationDetails urlCitation, int? startIndex, int? endIndex) : base(index, type, serializedAdditionalRawData) + { + UrlCitation = urlCitation; + StartIndex = startIndex; + EndIndex = endIndex; + } + + /// Initializes a new instance of for deserialization. + internal MessageDeltaTextUrlCitationAnnotation() + { + } + + /// The details of the URL citation. + public MessageDeltaTextUrlCitationDetails UrlCitation { get; } + /// The first text index associated with this text annotation. + public int? StartIndex { get; } + /// The last text index associated with this text annotation. + public int? EndIndex { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextUrlCitationDetails.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextUrlCitationDetails.Serialization.cs new file mode 100644 index 000000000000..112342d128c0 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextUrlCitationDetails.Serialization.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class MessageDeltaTextUrlCitationDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageDeltaTextUrlCitationDetails)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("url"u8); + writer.WriteStringValue(Url); + if (Optional.IsDefined(Title)) + { + writer.WritePropertyName("title"u8); + writer.WriteStringValue(Title); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MessageDeltaTextUrlCitationDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageDeltaTextUrlCitationDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMessageDeltaTextUrlCitationDetails(document.RootElement, options); + } + + internal static MessageDeltaTextUrlCitationDetails DeserializeMessageDeltaTextUrlCitationDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string url = default; + string title = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("url"u8)) + { + url = property.Value.GetString(); + continue; + } + if (property.NameEquals("title"u8)) + { + title = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MessageDeltaTextUrlCitationDetails(url, title, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MessageDeltaTextUrlCitationDetails)} does not support writing '{options.Format}' format."); + } + } + + MessageDeltaTextUrlCitationDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageDeltaTextUrlCitationDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MessageDeltaTextUrlCitationDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static MessageDeltaTextUrlCitationDetails FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageDeltaTextUrlCitationDetails(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextUrlCitationDetails.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextUrlCitationDetails.cs new file mode 100644 index 000000000000..660009f9dd7b --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageDeltaTextUrlCitationDetails.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// A representation of a URL citation, as used in text thread message content. + public partial class MessageDeltaTextUrlCitationDetails + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The URL associated with this citation. + /// is null. + internal MessageDeltaTextUrlCitationDetails(string url) + { + Argument.AssertNotNull(url, nameof(url)); + + Url = url; + } + + /// Initializes a new instance of . + /// The URL associated with this citation. + /// The title of the URL. + /// Keeps track of any properties unknown to the library. + internal MessageDeltaTextUrlCitationDetails(string url, string title, IDictionary serializedAdditionalRawData) + { + Url = url; + Title = title; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MessageDeltaTextUrlCitationDetails() + { + } + + /// The URL associated with this citation. + public string Url { get; } + /// The title of the URL. + public string Title { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageImageFileContent.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageImageFileContent.Serialization.cs new file mode 100644 index 000000000000..58813fda6bb0 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageImageFileContent.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class MessageImageFileContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageImageFileContent)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("image_file"u8); + writer.WriteObjectValue(InternalDetails, options); + } + + MessageImageFileContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageImageFileContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMessageImageFileContent(document.RootElement, options); + } + + internal static MessageImageFileContent DeserializeMessageImageFileContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + InternalMessageImageFileDetails imageFile = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("image_file"u8)) + { + imageFile = InternalMessageImageFileDetails.DeserializeInternalMessageImageFileDetails(property.Value, options); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MessageImageFileContent(type, serializedAdditionalRawData, imageFile); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MessageImageFileContent)} does not support writing '{options.Format}' format."); + } + } + + MessageImageFileContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageImageFileContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MessageImageFileContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new MessageImageFileContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageImageFileContent(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageImageFileContent.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageImageFileContent.cs new file mode 100644 index 000000000000..07fda0579530 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageImageFileContent.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// A representation of image file content in a thread message. + public partial class MessageImageFileContent : MessageContent + { + /// Initializes a new instance of . + /// The image file for this thread message content item. + /// is null. + internal MessageImageFileContent(InternalMessageImageFileDetails internalDetails) + { + Argument.AssertNotNull(internalDetails, nameof(internalDetails)); + + Type = "image_file"; + InternalDetails = internalDetails; + } + + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + /// The image file for this thread message content item. + internal MessageImageFileContent(string type, IDictionary serializedAdditionalRawData, InternalMessageImageFileDetails internalDetails) : base(type, serializedAdditionalRawData) + { + InternalDetails = internalDetails; + } + + /// Initializes a new instance of for deserialization. + internal MessageImageFileContent() + { + } + + /// The image file for this thread message content item. + public InternalMessageImageFileDetails InternalDetails { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageIncompleteDetails.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageIncompleteDetails.Serialization.cs new file mode 100644 index 000000000000..d3842ebee386 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageIncompleteDetails.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class MessageIncompleteDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageIncompleteDetails)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("reason"u8); + writer.WriteStringValue(Reason.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MessageIncompleteDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageIncompleteDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMessageIncompleteDetails(document.RootElement, options); + } + + internal static MessageIncompleteDetails DeserializeMessageIncompleteDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + MessageIncompleteDetailsReason reason = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("reason"u8)) + { + reason = new MessageIncompleteDetailsReason(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MessageIncompleteDetails(reason, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MessageIncompleteDetails)} does not support writing '{options.Format}' format."); + } + } + + MessageIncompleteDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageIncompleteDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MessageIncompleteDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static MessageIncompleteDetails FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageIncompleteDetails(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageIncompleteDetails.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageIncompleteDetails.cs new file mode 100644 index 000000000000..b27c9f9cad80 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageIncompleteDetails.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Information providing additional detail about a message entering an incomplete status. + public partial class MessageIncompleteDetails + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The provided reason describing why the message was marked as incomplete. + internal MessageIncompleteDetails(MessageIncompleteDetailsReason reason) + { + Reason = reason; + } + + /// Initializes a new instance of . + /// The provided reason describing why the message was marked as incomplete. + /// Keeps track of any properties unknown to the library. + internal MessageIncompleteDetails(MessageIncompleteDetailsReason reason, IDictionary serializedAdditionalRawData) + { + Reason = reason; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MessageIncompleteDetails() + { + } + + /// The provided reason describing why the message was marked as incomplete. + public MessageIncompleteDetailsReason Reason { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageIncompleteDetailsReason.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageIncompleteDetailsReason.cs new file mode 100644 index 000000000000..b264209fc9ec --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageIncompleteDetailsReason.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// A set of reasons describing why a message is marked as incomplete. + public readonly partial struct MessageIncompleteDetailsReason : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public MessageIncompleteDetailsReason(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ContentFilterValue = "content_filter"; + private const string MaxTokensValue = "max_tokens"; + private const string RunCancelledValue = "run_cancelled"; + private const string RunFailedValue = "run_failed"; + private const string RunExpiredValue = "run_expired"; + + /// The run generating the message was terminated due to content filter flagging. + public static MessageIncompleteDetailsReason ContentFilter { get; } = new MessageIncompleteDetailsReason(ContentFilterValue); + /// The run generating the message exhausted available tokens before completion. + public static MessageIncompleteDetailsReason MaxTokens { get; } = new MessageIncompleteDetailsReason(MaxTokensValue); + /// The run generating the message was cancelled before completion. + public static MessageIncompleteDetailsReason RunCancelled { get; } = new MessageIncompleteDetailsReason(RunCancelledValue); + /// The run generating the message failed. + public static MessageIncompleteDetailsReason RunFailed { get; } = new MessageIncompleteDetailsReason(RunFailedValue); + /// The run generating the message expired. + public static MessageIncompleteDetailsReason RunExpired { get; } = new MessageIncompleteDetailsReason(RunExpiredValue); + /// Determines if two values are the same. + public static bool operator ==(MessageIncompleteDetailsReason left, MessageIncompleteDetailsReason right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(MessageIncompleteDetailsReason left, MessageIncompleteDetailsReason right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator MessageIncompleteDetailsReason(string value) => new MessageIncompleteDetailsReason(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is MessageIncompleteDetailsReason other && Equals(other); + /// + public bool Equals(MessageIncompleteDetailsReason other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageRole.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageRole.cs new file mode 100644 index 000000000000..9ddc2e11f5dd --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageRole.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// The possible values for roles attributed to messages in a thread. + public readonly partial struct MessageRole : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public MessageRole(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UserValue = "user"; + private const string AgentValue = "assistant"; + + /// The role representing the end-user. + public static MessageRole User { get; } = new MessageRole(UserValue); + /// The role representing the agent. + public static MessageRole Agent { get; } = new MessageRole(AgentValue); + /// Determines if two values are the same. + public static bool operator ==(MessageRole left, MessageRole right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(MessageRole left, MessageRole right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator MessageRole(string value) => new MessageRole(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is MessageRole other && Equals(other); + /// + public bool Equals(MessageRole other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageStatus.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageStatus.cs new file mode 100644 index 000000000000..034ff4d2f0ec --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageStatus.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// The possible execution status values for a thread message. + public readonly partial struct MessageStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public MessageStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InProgressValue = "in_progress"; + private const string IncompleteValue = "incomplete"; + private const string CompletedValue = "completed"; + + /// A run is currently creating this message. + public static MessageStatus InProgress { get; } = new MessageStatus(InProgressValue); + /// This message is incomplete. See incomplete_details for more information. + public static MessageStatus Incomplete { get; } = new MessageStatus(IncompleteValue); + /// This message was successfully completed by a run. + public static MessageStatus Completed { get; } = new MessageStatus(CompletedValue); + /// Determines if two values are the same. + public static bool operator ==(MessageStatus left, MessageStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(MessageStatus left, MessageStatus right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator MessageStatus(string value) => new MessageStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is MessageStatus other && Equals(other); + /// + public bool Equals(MessageStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageStreamEvent.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageStreamEvent.cs new file mode 100644 index 000000000000..5409b4f0507d --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageStreamEvent.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// Message operation related streaming events. + public readonly partial struct MessageStreamEvent : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public MessageStreamEvent(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ThreadMessageCreatedValue = "thread.message.created"; + private const string ThreadMessageInProgressValue = "thread.message.in_progress"; + private const string ThreadMessageDeltaValue = "thread.message.delta"; + private const string ThreadMessageCompletedValue = "thread.message.completed"; + private const string ThreadMessageIncompleteValue = "thread.message.incomplete"; + + /// Event sent when a new message is created. The data of this event is of type ThreadMessage. + public static MessageStreamEvent ThreadMessageCreated { get; } = new MessageStreamEvent(ThreadMessageCreatedValue); + /// Event sent when a message moves to `in_progress` status. The data of this event is of type ThreadMessage. + public static MessageStreamEvent ThreadMessageInProgress { get; } = new MessageStreamEvent(ThreadMessageInProgressValue); + /// Event sent when a message is being streamed. The data of this event is of type MessageDeltaChunk. + public static MessageStreamEvent ThreadMessageDelta { get; } = new MessageStreamEvent(ThreadMessageDeltaValue); + /// Event sent when a message is completed. The data of this event is of type ThreadMessage. + public static MessageStreamEvent ThreadMessageCompleted { get; } = new MessageStreamEvent(ThreadMessageCompletedValue); + /// Event sent before a message is completed. The data of this event is of type ThreadMessage. + public static MessageStreamEvent ThreadMessageIncomplete { get; } = new MessageStreamEvent(ThreadMessageIncompleteValue); + /// Determines if two values are the same. + public static bool operator ==(MessageStreamEvent left, MessageStreamEvent right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(MessageStreamEvent left, MessageStreamEvent right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator MessageStreamEvent(string value) => new MessageStreamEvent(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is MessageStreamEvent other && Equals(other); + /// + public bool Equals(MessageStreamEvent other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextAnnotation.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextAnnotation.Serialization.cs new file mode 100644 index 000000000000..87a5275836bd --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextAnnotation.Serialization.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + [PersistableModelProxy(typeof(UnknownMessageTextAnnotation))] + public partial class MessageTextAnnotation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageTextAnnotation)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type); + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MessageTextAnnotation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageTextAnnotation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMessageTextAnnotation(document.RootElement, options); + } + + internal static MessageTextAnnotation DeserializeMessageTextAnnotation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("type", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "file_citation": return MessageTextFileCitationAnnotation.DeserializeMessageTextFileCitationAnnotation(element, options); + case "file_path": return MessageTextFilePathAnnotation.DeserializeMessageTextFilePathAnnotation(element, options); + case "url_citation": return MessageTextUrlCitationAnnotation.DeserializeMessageTextUrlCitationAnnotation(element, options); + } + } + return UnknownMessageTextAnnotation.DeserializeUnknownMessageTextAnnotation(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MessageTextAnnotation)} does not support writing '{options.Format}' format."); + } + } + + MessageTextAnnotation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageTextAnnotation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MessageTextAnnotation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static MessageTextAnnotation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageTextAnnotation(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextAnnotation.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextAnnotation.cs new file mode 100644 index 000000000000..823828b0fff0 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextAnnotation.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// + /// An abstract representation of an annotation to text thread message content. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + public abstract partial class MessageTextAnnotation + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The textual content associated with this text annotation item. + /// is null. + protected MessageTextAnnotation(string text) + { + Argument.AssertNotNull(text, nameof(text)); + + Text = text; + } + + /// Initializes a new instance of . + /// The object type. + /// The textual content associated with this text annotation item. + /// Keeps track of any properties unknown to the library. + internal MessageTextAnnotation(string type, string text, IDictionary serializedAdditionalRawData) + { + Type = type; + Text = text; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MessageTextAnnotation() + { + } + + /// The object type. + internal string Type { get; set; } + /// The textual content associated with this text annotation item. + public string Text { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextContent.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextContent.Serialization.cs new file mode 100644 index 000000000000..a6639e224182 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextContent.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class MessageTextContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageTextContent)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("text"u8); + writer.WriteObjectValue(InternalDetails, options); + } + + MessageTextContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageTextContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMessageTextContent(document.RootElement, options); + } + + internal static MessageTextContent DeserializeMessageTextContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + InternalMessageTextDetails text = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("text"u8)) + { + text = InternalMessageTextDetails.DeserializeInternalMessageTextDetails(property.Value, options); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MessageTextContent(type, serializedAdditionalRawData, text); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MessageTextContent)} does not support writing '{options.Format}' format."); + } + } + + MessageTextContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageTextContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MessageTextContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new MessageTextContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageTextContent(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextContent.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextContent.cs new file mode 100644 index 000000000000..e905be359f89 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextContent.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// A representation of a textual item of thread message content. + public partial class MessageTextContent : MessageContent + { + /// Initializes a new instance of . + /// The text and associated annotations for this thread message content item. + /// is null. + internal MessageTextContent(InternalMessageTextDetails internalDetails) + { + Argument.AssertNotNull(internalDetails, nameof(internalDetails)); + + Type = "text"; + InternalDetails = internalDetails; + } + + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + /// The text and associated annotations for this thread message content item. + internal MessageTextContent(string type, IDictionary serializedAdditionalRawData, InternalMessageTextDetails internalDetails) : base(type, serializedAdditionalRawData) + { + InternalDetails = internalDetails; + } + + /// Initializes a new instance of for deserialization. + internal MessageTextContent() + { + } + + /// The text and associated annotations for this thread message content item. + public InternalMessageTextDetails InternalDetails { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextFileCitationAnnotation.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextFileCitationAnnotation.Serialization.cs new file mode 100644 index 000000000000..4e8767d12069 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextFileCitationAnnotation.Serialization.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class MessageTextFileCitationAnnotation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageTextFileCitationAnnotation)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("file_citation"u8); + writer.WriteObjectValue(InternalDetails, options); + if (Optional.IsDefined(StartIndex)) + { + writer.WritePropertyName("start_index"u8); + writer.WriteNumberValue(StartIndex.Value); + } + if (Optional.IsDefined(EndIndex)) + { + writer.WritePropertyName("end_index"u8); + writer.WriteNumberValue(EndIndex.Value); + } + } + + MessageTextFileCitationAnnotation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageTextFileCitationAnnotation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMessageTextFileCitationAnnotation(document.RootElement, options); + } + + internal static MessageTextFileCitationAnnotation DeserializeMessageTextFileCitationAnnotation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + InternalMessageTextFileCitationDetails fileCitation = default; + int? startIndex = default; + int? endIndex = default; + string type = default; + string text = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("file_citation"u8)) + { + fileCitation = InternalMessageTextFileCitationDetails.DeserializeInternalMessageTextFileCitationDetails(property.Value, options); + continue; + } + if (property.NameEquals("start_index"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + startIndex = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("end_index"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endIndex = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MessageTextFileCitationAnnotation( + type, + text, + serializedAdditionalRawData, + fileCitation, + startIndex, + endIndex); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MessageTextFileCitationAnnotation)} does not support writing '{options.Format}' format."); + } + } + + MessageTextFileCitationAnnotation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageTextFileCitationAnnotation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MessageTextFileCitationAnnotation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new MessageTextFileCitationAnnotation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageTextFileCitationAnnotation(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextFileCitationAnnotation.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextFileCitationAnnotation.cs new file mode 100644 index 000000000000..064dc81ed8dd --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextFileCitationAnnotation.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// A citation within the message that points to a specific quote from a specific File associated with the agent or the message. Generated when the agent uses the 'file_search' tool to search files. + public partial class MessageTextFileCitationAnnotation : MessageTextAnnotation + { + /// Initializes a new instance of . + /// The textual content associated with this text annotation item. + /// + /// A citation within the message that points to a specific quote from a specific file. + /// Generated when the agent uses the "file_search" tool to search files. + /// + /// or is null. + internal MessageTextFileCitationAnnotation(string text, InternalMessageTextFileCitationDetails internalDetails) : base(text) + { + Argument.AssertNotNull(text, nameof(text)); + Argument.AssertNotNull(internalDetails, nameof(internalDetails)); + + Type = "file_citation"; + InternalDetails = internalDetails; + } + + /// Initializes a new instance of . + /// The object type. + /// The textual content associated with this text annotation item. + /// Keeps track of any properties unknown to the library. + /// + /// A citation within the message that points to a specific quote from a specific file. + /// Generated when the agent uses the "file_search" tool to search files. + /// + /// The first text index associated with this text annotation. + /// The last text index associated with this text annotation. + internal MessageTextFileCitationAnnotation(string type, string text, IDictionary serializedAdditionalRawData, InternalMessageTextFileCitationDetails internalDetails, int? startIndex, int? endIndex) : base(type, text, serializedAdditionalRawData) + { + InternalDetails = internalDetails; + StartIndex = startIndex; + EndIndex = endIndex; + } + + /// Initializes a new instance of for deserialization. + internal MessageTextFileCitationAnnotation() + { + } + + /// + /// A citation within the message that points to a specific quote from a specific file. + /// Generated when the agent uses the "file_search" tool to search files. + /// + public InternalMessageTextFileCitationDetails InternalDetails { get; } + /// The first text index associated with this text annotation. + public int? StartIndex { get; } + /// The last text index associated with this text annotation. + public int? EndIndex { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextFilePathAnnotation.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextFilePathAnnotation.Serialization.cs new file mode 100644 index 000000000000..43ae786b21b5 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextFilePathAnnotation.Serialization.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class MessageTextFilePathAnnotation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageTextFilePathAnnotation)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("file_path"u8); + writer.WriteObjectValue(InternalDetails, options); + if (Optional.IsDefined(StartIndex)) + { + writer.WritePropertyName("start_index"u8); + writer.WriteNumberValue(StartIndex.Value); + } + if (Optional.IsDefined(EndIndex)) + { + writer.WritePropertyName("end_index"u8); + writer.WriteNumberValue(EndIndex.Value); + } + } + + MessageTextFilePathAnnotation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageTextFilePathAnnotation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMessageTextFilePathAnnotation(document.RootElement, options); + } + + internal static MessageTextFilePathAnnotation DeserializeMessageTextFilePathAnnotation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + InternalMessageTextFilePathDetails filePath = default; + int? startIndex = default; + int? endIndex = default; + string type = default; + string text = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("file_path"u8)) + { + filePath = InternalMessageTextFilePathDetails.DeserializeInternalMessageTextFilePathDetails(property.Value, options); + continue; + } + if (property.NameEquals("start_index"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + startIndex = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("end_index"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endIndex = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MessageTextFilePathAnnotation( + type, + text, + serializedAdditionalRawData, + filePath, + startIndex, + endIndex); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MessageTextFilePathAnnotation)} does not support writing '{options.Format}' format."); + } + } + + MessageTextFilePathAnnotation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageTextFilePathAnnotation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MessageTextFilePathAnnotation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new MessageTextFilePathAnnotation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageTextFilePathAnnotation(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextFilePathAnnotation.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextFilePathAnnotation.cs new file mode 100644 index 000000000000..0dcf5182a79a --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextFilePathAnnotation.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// A citation within the message that points to a file located at a specific path. + public partial class MessageTextFilePathAnnotation : MessageTextAnnotation + { + /// Initializes a new instance of . + /// The textual content associated with this text annotation item. + /// A URL for the file that's generated when the agent used the code_interpreter tool to generate a file. + /// or is null. + internal MessageTextFilePathAnnotation(string text, InternalMessageTextFilePathDetails internalDetails) : base(text) + { + Argument.AssertNotNull(text, nameof(text)); + Argument.AssertNotNull(internalDetails, nameof(internalDetails)); + + Type = "file_path"; + InternalDetails = internalDetails; + } + + /// Initializes a new instance of . + /// The object type. + /// The textual content associated with this text annotation item. + /// Keeps track of any properties unknown to the library. + /// A URL for the file that's generated when the agent used the code_interpreter tool to generate a file. + /// The first text index associated with this text annotation. + /// The last text index associated with this text annotation. + internal MessageTextFilePathAnnotation(string type, string text, IDictionary serializedAdditionalRawData, InternalMessageTextFilePathDetails internalDetails, int? startIndex, int? endIndex) : base(type, text, serializedAdditionalRawData) + { + InternalDetails = internalDetails; + StartIndex = startIndex; + EndIndex = endIndex; + } + + /// Initializes a new instance of for deserialization. + internal MessageTextFilePathAnnotation() + { + } + + /// A URL for the file that's generated when the agent used the code_interpreter tool to generate a file. + public InternalMessageTextFilePathDetails InternalDetails { get; } + /// The first text index associated with this text annotation. + public int? StartIndex { get; } + /// The last text index associated with this text annotation. + public int? EndIndex { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextUrlCitationAnnotation.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextUrlCitationAnnotation.Serialization.cs new file mode 100644 index 000000000000..4b25adcf2dd8 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextUrlCitationAnnotation.Serialization.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class MessageTextUrlCitationAnnotation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageTextUrlCitationAnnotation)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("url_citation"u8); + writer.WriteObjectValue(UrlCitation, options); + if (Optional.IsDefined(StartIndex)) + { + writer.WritePropertyName("start_index"u8); + writer.WriteNumberValue(StartIndex.Value); + } + if (Optional.IsDefined(EndIndex)) + { + writer.WritePropertyName("end_index"u8); + writer.WriteNumberValue(EndIndex.Value); + } + } + + MessageTextUrlCitationAnnotation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageTextUrlCitationAnnotation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMessageTextUrlCitationAnnotation(document.RootElement, options); + } + + internal static MessageTextUrlCitationAnnotation DeserializeMessageTextUrlCitationAnnotation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + MessageTextUrlCitationDetails urlCitation = default; + int? startIndex = default; + int? endIndex = default; + string type = default; + string text = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("url_citation"u8)) + { + urlCitation = MessageTextUrlCitationDetails.DeserializeMessageTextUrlCitationDetails(property.Value, options); + continue; + } + if (property.NameEquals("start_index"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + startIndex = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("end_index"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endIndex = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MessageTextUrlCitationAnnotation( + type, + text, + serializedAdditionalRawData, + urlCitation, + startIndex, + endIndex); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MessageTextUrlCitationAnnotation)} does not support writing '{options.Format}' format."); + } + } + + MessageTextUrlCitationAnnotation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageTextUrlCitationAnnotation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MessageTextUrlCitationAnnotation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new MessageTextUrlCitationAnnotation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageTextUrlCitationAnnotation(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextUrlCitationAnnotation.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextUrlCitationAnnotation.cs new file mode 100644 index 000000000000..1d35b49a146d --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextUrlCitationAnnotation.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// A citation within the message that points to a specific URL associated with the message. Generated when the agent uses tools such as 'bing_grounding' to search the Internet. + public partial class MessageTextUrlCitationAnnotation : MessageTextAnnotation + { + /// Initializes a new instance of . + /// The textual content associated with this text annotation item. + /// The details of the URL citation. + /// or is null. + internal MessageTextUrlCitationAnnotation(string text, MessageTextUrlCitationDetails urlCitation) : base(text) + { + Argument.AssertNotNull(text, nameof(text)); + Argument.AssertNotNull(urlCitation, nameof(urlCitation)); + + Type = "url_citation"; + UrlCitation = urlCitation; + } + + /// Initializes a new instance of . + /// The object type. + /// The textual content associated with this text annotation item. + /// Keeps track of any properties unknown to the library. + /// The details of the URL citation. + /// The first text index associated with this text annotation. + /// The last text index associated with this text annotation. + internal MessageTextUrlCitationAnnotation(string type, string text, IDictionary serializedAdditionalRawData, MessageTextUrlCitationDetails urlCitation, int? startIndex, int? endIndex) : base(type, text, serializedAdditionalRawData) + { + UrlCitation = urlCitation; + StartIndex = startIndex; + EndIndex = endIndex; + } + + /// Initializes a new instance of for deserialization. + internal MessageTextUrlCitationAnnotation() + { + } + + /// The details of the URL citation. + public MessageTextUrlCitationDetails UrlCitation { get; } + /// The first text index associated with this text annotation. + public int? StartIndex { get; } + /// The last text index associated with this text annotation. + public int? EndIndex { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextUrlCitationDetails.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextUrlCitationDetails.Serialization.cs new file mode 100644 index 000000000000..caf605afa356 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextUrlCitationDetails.Serialization.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class MessageTextUrlCitationDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageTextUrlCitationDetails)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("url"u8); + writer.WriteStringValue(Url); + if (Optional.IsDefined(Title)) + { + writer.WritePropertyName("title"u8); + writer.WriteStringValue(Title); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MessageTextUrlCitationDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageTextUrlCitationDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMessageTextUrlCitationDetails(document.RootElement, options); + } + + internal static MessageTextUrlCitationDetails DeserializeMessageTextUrlCitationDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string url = default; + string title = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("url"u8)) + { + url = property.Value.GetString(); + continue; + } + if (property.NameEquals("title"u8)) + { + title = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MessageTextUrlCitationDetails(url, title, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MessageTextUrlCitationDetails)} does not support writing '{options.Format}' format."); + } + } + + MessageTextUrlCitationDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageTextUrlCitationDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MessageTextUrlCitationDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static MessageTextUrlCitationDetails FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageTextUrlCitationDetails(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextUrlCitationDetails.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextUrlCitationDetails.cs new file mode 100644 index 000000000000..9d2503a8a953 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MessageTextUrlCitationDetails.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// A representation of a URL citation, as used in text thread message content. + public partial class MessageTextUrlCitationDetails + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The URL associated with this citation. + /// is null. + internal MessageTextUrlCitationDetails(string url) + { + Argument.AssertNotNull(url, nameof(url)); + + Url = url; + } + + /// Initializes a new instance of . + /// The URL associated with this citation. + /// The title of the URL. + /// Keeps track of any properties unknown to the library. + internal MessageTextUrlCitationDetails(string url, string title, IDictionary serializedAdditionalRawData) + { + Url = url; + Title = title; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MessageTextUrlCitationDetails() + { + } + + /// The URL associated with this citation. + public string Url { get; } + /// The title of the URL. + public string Title { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MicrosoftFabricToolDefinition.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MicrosoftFabricToolDefinition.Serialization.cs new file mode 100644 index 000000000000..a9193fe20742 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MicrosoftFabricToolDefinition.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class MicrosoftFabricToolDefinition : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MicrosoftFabricToolDefinition)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("fabric_dataagent"u8); + writer.WriteObjectValue(FabricDataagent, options); + } + + MicrosoftFabricToolDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MicrosoftFabricToolDefinition)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMicrosoftFabricToolDefinition(document.RootElement, options); + } + + internal static MicrosoftFabricToolDefinition DeserializeMicrosoftFabricToolDefinition(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ToolConnectionList fabricDataagent = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("fabric_dataagent"u8)) + { + fabricDataagent = ToolConnectionList.DeserializeToolConnectionList(property.Value, options); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MicrosoftFabricToolDefinition(type, serializedAdditionalRawData, fabricDataagent); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MicrosoftFabricToolDefinition)} does not support writing '{options.Format}' format."); + } + } + + MicrosoftFabricToolDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMicrosoftFabricToolDefinition(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MicrosoftFabricToolDefinition)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new MicrosoftFabricToolDefinition FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMicrosoftFabricToolDefinition(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/MicrosoftFabricToolDefinition.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/MicrosoftFabricToolDefinition.cs new file mode 100644 index 000000000000..01830285996e --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/MicrosoftFabricToolDefinition.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The input definition information for a Microsoft Fabric tool as used to configure an agent. + public partial class MicrosoftFabricToolDefinition : ToolDefinition + { + /// Initializes a new instance of . + /// The list of connections used by the Microsoft Fabric tool. + /// is null. + public MicrosoftFabricToolDefinition(ToolConnectionList fabricDataagent) + { + Argument.AssertNotNull(fabricDataagent, nameof(fabricDataagent)); + + Type = "fabric_dataagent"; + FabricDataagent = fabricDataagent; + } + + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + /// The list of connections used by the Microsoft Fabric tool. + internal MicrosoftFabricToolDefinition(string type, IDictionary serializedAdditionalRawData, ToolConnectionList fabricDataagent) : base(type, serializedAdditionalRawData) + { + FabricDataagent = fabricDataagent; + } + + /// Initializes a new instance of for deserialization. + internal MicrosoftFabricToolDefinition() + { + } + + /// The list of connections used by the Microsoft Fabric tool. + public ToolConnectionList FabricDataagent { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/ModifyVectorStoreRequest.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/ModifyVectorStoreRequest.Serialization.cs new file mode 100644 index 000000000000..f1a269b12b38 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/ModifyVectorStoreRequest.Serialization.cs @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class ModifyVectorStoreRequest : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ModifyVectorStoreRequest)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Name)) + { + if (Name != null) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + else + { + writer.WriteNull("name"); + } + } + if (Optional.IsDefined(ExpiresAfter)) + { + if (ExpiresAfter != null) + { + writer.WritePropertyName("expires_after"u8); + writer.WriteObjectValue(ExpiresAfter, options); + } + else + { + writer.WriteNull("expires_after"); + } + } + if (Optional.IsCollectionDefined(Metadata)) + { + if (Metadata != null) + { + writer.WritePropertyName("metadata"u8); + writer.WriteStartObject(); + foreach (var item in Metadata) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + else + { + writer.WriteNull("metadata"); + } + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ModifyVectorStoreRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ModifyVectorStoreRequest)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeModifyVectorStoreRequest(document.RootElement, options); + } + + internal static ModifyVectorStoreRequest DeserializeModifyVectorStoreRequest(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + VectorStoreExpirationPolicy expiresAfter = default; + IReadOnlyDictionary metadata = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + name = null; + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("expires_after"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + expiresAfter = null; + continue; + } + expiresAfter = VectorStoreExpirationPolicy.DeserializeVectorStoreExpirationPolicy(property.Value, options); + continue; + } + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + metadata = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ModifyVectorStoreRequest(name, expiresAfter, metadata ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ModifyVectorStoreRequest)} does not support writing '{options.Format}' format."); + } + } + + ModifyVectorStoreRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeModifyVectorStoreRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ModifyVectorStoreRequest)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ModifyVectorStoreRequest FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeModifyVectorStoreRequest(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/ModifyVectorStoreRequest.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/ModifyVectorStoreRequest.cs new file mode 100644 index 000000000000..828fedf7dcd2 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/ModifyVectorStoreRequest.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The ModifyVectorStoreRequest. + internal partial class ModifyVectorStoreRequest + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal ModifyVectorStoreRequest() + { + Metadata = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The name of the vector store. + /// Details on when this vector store expires. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// Keeps track of any properties unknown to the library. + internal ModifyVectorStoreRequest(string name, VectorStoreExpirationPolicy expiresAfter, IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) + { + Name = name; + ExpiresAfter = expiresAfter; + Metadata = metadata; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The name of the vector store. + public string Name { get; } + /// Details on when this vector store expires. + public VectorStoreExpirationPolicy ExpiresAfter { get; } + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + public IReadOnlyDictionary Metadata { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIFile.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIFile.Serialization.cs new file mode 100644 index 000000000000..93c5b56ea61b --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIFile.Serialization.cs @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class OpenAIFile : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenAIFile)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("object"u8); + writer.WriteStringValue(Object.ToString()); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("bytes"u8); + writer.WriteNumberValue(Size); + writer.WritePropertyName("filename"u8); + writer.WriteStringValue(Filename); + writer.WritePropertyName("created_at"u8); + writer.WriteNumberValue(CreatedAt, "U"); + writer.WritePropertyName("purpose"u8); + writer.WriteStringValue(Purpose.ToString()); + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + if (Optional.IsDefined(StatusDetails)) + { + writer.WritePropertyName("status_details"u8); + writer.WriteStringValue(StatusDetails); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + OpenAIFile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenAIFile)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOpenAIFile(document.RootElement, options); + } + + internal static OpenAIFile DeserializeOpenAIFile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + OpenAIFileObject @object = default; + string id = default; + int bytes = default; + string filename = default; + DateTimeOffset createdAt = default; + OpenAIFilePurpose purpose = default; + FileState? status = default; + string statusDetails = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("object"u8)) + { + @object = new OpenAIFileObject(property.Value.GetString()); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("bytes"u8)) + { + bytes = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("filename"u8)) + { + filename = property.Value.GetString(); + continue; + } + if (property.NameEquals("created_at"u8)) + { + createdAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); + continue; + } + if (property.NameEquals("purpose"u8)) + { + purpose = new OpenAIFilePurpose(property.Value.GetString()); + continue; + } + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new FileState(property.Value.GetString()); + continue; + } + if (property.NameEquals("status_details"u8)) + { + statusDetails = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OpenAIFile( + @object, + id, + bytes, + filename, + createdAt, + purpose, + status, + statusDetails, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(OpenAIFile)} does not support writing '{options.Format}' format."); + } + } + + OpenAIFile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOpenAIFile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OpenAIFile)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static OpenAIFile FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOpenAIFile(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIFile.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIFile.cs new file mode 100644 index 000000000000..66305d847bb1 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIFile.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Represents an agent that can call the model and use tools. + public partial class OpenAIFile + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The identifier, which can be referenced in API endpoints. + /// The size of the file, in bytes. + /// The name of the file. + /// The Unix timestamp, in seconds, representing when this object was created. + /// The intended purpose of a file. + /// or is null. + internal OpenAIFile(string id, int size, string filename, DateTimeOffset createdAt, OpenAIFilePurpose purpose) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(filename, nameof(filename)); + + Id = id; + Size = size; + Filename = filename; + CreatedAt = createdAt; + Purpose = purpose; + } + + /// Initializes a new instance of . + /// The object type, which is always 'file'. + /// The identifier, which can be referenced in API endpoints. + /// The size of the file, in bytes. + /// The name of the file. + /// The Unix timestamp, in seconds, representing when this object was created. + /// The intended purpose of a file. + /// The state of the file. This field is available in Azure OpenAI only. + /// The error message with details in case processing of this file failed. This field is available in Azure OpenAI only. + /// Keeps track of any properties unknown to the library. + internal OpenAIFile(OpenAIFileObject @object, string id, int size, string filename, DateTimeOffset createdAt, OpenAIFilePurpose purpose, FileState? status, string statusDetails, IDictionary serializedAdditionalRawData) + { + Object = @object; + Id = id; + Size = size; + Filename = filename; + CreatedAt = createdAt; + Purpose = purpose; + Status = status; + StatusDetails = statusDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OpenAIFile() + { + } + + /// The object type, which is always 'file'. + public OpenAIFileObject Object { get; } = OpenAIFileObject.File; + + /// The identifier, which can be referenced in API endpoints. + public string Id { get; } + /// The size of the file, in bytes. + public int Size { get; } + /// The name of the file. + public string Filename { get; } + /// The Unix timestamp, in seconds, representing when this object was created. + public DateTimeOffset CreatedAt { get; } + /// The intended purpose of a file. + public OpenAIFilePurpose Purpose { get; } + /// The state of the file. This field is available in Azure OpenAI only. + public FileState? Status { get; } + /// The error message with details in case processing of this file failed. This field is available in Azure OpenAI only. + public string StatusDetails { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIFileObject.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIFileObject.cs new file mode 100644 index 000000000000..92c1381c63f9 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIFileObject.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// The OpenAIFile_object. + public readonly partial struct OpenAIFileObject : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public OpenAIFileObject(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string FileValue = "file"; + + /// file. + public static OpenAIFileObject File { get; } = new OpenAIFileObject(FileValue); + /// Determines if two values are the same. + public static bool operator ==(OpenAIFileObject left, OpenAIFileObject right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OpenAIFileObject left, OpenAIFileObject right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator OpenAIFileObject(string value) => new OpenAIFileObject(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OpenAIFileObject other && Equals(other); + /// + public bool Equals(OpenAIFileObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIFilePurpose.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIFilePurpose.cs new file mode 100644 index 000000000000..2a5120049496 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIFilePurpose.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// The possible values denoting the intended usage of a file. + public readonly partial struct OpenAIFilePurpose : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public OpenAIFilePurpose(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string FineTuneValue = "fine-tune"; + private const string FineTuneResultsValue = "fine-tune-results"; + private const string AgentsValue = "assistants"; + private const string AgentsOutputValue = "assistants_output"; + private const string BatchValue = "batch"; + private const string BatchOutputValue = "batch_output"; + private const string VisionValue = "vision"; + + /// Indicates a file is used for fine tuning input. + public static OpenAIFilePurpose FineTune { get; } = new OpenAIFilePurpose(FineTuneValue); + /// Indicates a file is used for fine tuning results. + public static OpenAIFilePurpose FineTuneResults { get; } = new OpenAIFilePurpose(FineTuneResultsValue); + /// Indicates a file is used as input to agents. + public static OpenAIFilePurpose Agents { get; } = new OpenAIFilePurpose(AgentsValue); + /// Indicates a file is used as output by agents. + public static OpenAIFilePurpose AgentsOutput { get; } = new OpenAIFilePurpose(AgentsOutputValue); + /// Indicates a file is used as input to . + public static OpenAIFilePurpose Batch { get; } = new OpenAIFilePurpose(BatchValue); + /// Indicates a file is used as output by a vector store batch operation. + public static OpenAIFilePurpose BatchOutput { get; } = new OpenAIFilePurpose(BatchOutputValue); + /// Indicates a file is used as input to a vision operation. + public static OpenAIFilePurpose Vision { get; } = new OpenAIFilePurpose(VisionValue); + /// Determines if two values are the same. + public static bool operator ==(OpenAIFilePurpose left, OpenAIFilePurpose right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OpenAIFilePurpose left, OpenAIFilePurpose right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator OpenAIFilePurpose(string value) => new OpenAIFilePurpose(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OpenAIFilePurpose other && Equals(other); + /// + public bool Equals(OpenAIFilePurpose other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfAgent.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfAgent.Serialization.cs new file mode 100644 index 000000000000..cc3f03dc4dab --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfAgent.Serialization.cs @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class OpenAIPageableListOfAgent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenAIPageableListOfAgent)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("object"u8); + writer.WriteStringValue(Object.ToString()); + writer.WritePropertyName("data"u8); + writer.WriteStartArray(); + foreach (var item in Data) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + writer.WritePropertyName("first_id"u8); + writer.WriteStringValue(FirstId); + writer.WritePropertyName("last_id"u8); + writer.WriteStringValue(LastId); + writer.WritePropertyName("has_more"u8); + writer.WriteBooleanValue(HasMore); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + OpenAIPageableListOfAgent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenAIPageableListOfAgent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOpenAIPageableListOfAgent(document.RootElement, options); + } + + internal static OpenAIPageableListOfAgent DeserializeOpenAIPageableListOfAgent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + OpenAIPageableListOfAgentObject @object = default; + IReadOnlyList data = default; + string firstId = default; + string lastId = default; + bool hasMore = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("object"u8)) + { + @object = new OpenAIPageableListOfAgentObject(property.Value.GetString()); + continue; + } + if (property.NameEquals("data"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Agent.DeserializeAgent(item, options)); + } + data = array; + continue; + } + if (property.NameEquals("first_id"u8)) + { + firstId = property.Value.GetString(); + continue; + } + if (property.NameEquals("last_id"u8)) + { + lastId = property.Value.GetString(); + continue; + } + if (property.NameEquals("has_more"u8)) + { + hasMore = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OpenAIPageableListOfAgent( + @object, + data, + firstId, + lastId, + hasMore, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(OpenAIPageableListOfAgent)} does not support writing '{options.Format}' format."); + } + } + + OpenAIPageableListOfAgent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOpenAIPageableListOfAgent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OpenAIPageableListOfAgent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static OpenAIPageableListOfAgent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOpenAIPageableListOfAgent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfAgent.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfAgent.cs new file mode 100644 index 000000000000..0498795ff2c5 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfAgent.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Assistants +{ + /// The response data for a requested list of items. + internal partial class OpenAIPageableListOfAgent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The requested list of items. + /// The first ID represented in this list. + /// The last ID represented in this list. + /// A value indicating whether there are additional values available not captured in this list. + /// , or is null. + internal OpenAIPageableListOfAgent(IEnumerable data, string firstId, string lastId, bool hasMore) + { + Argument.AssertNotNull(data, nameof(data)); + Argument.AssertNotNull(firstId, nameof(firstId)); + Argument.AssertNotNull(lastId, nameof(lastId)); + + Data = data.ToList(); + FirstId = firstId; + LastId = lastId; + HasMore = hasMore; + } + + /// Initializes a new instance of . + /// The object type, which is always list. + /// The requested list of items. + /// The first ID represented in this list. + /// The last ID represented in this list. + /// A value indicating whether there are additional values available not captured in this list. + /// Keeps track of any properties unknown to the library. + internal OpenAIPageableListOfAgent(OpenAIPageableListOfAgentObject @object, IReadOnlyList data, string firstId, string lastId, bool hasMore, IDictionary serializedAdditionalRawData) + { + Object = @object; + Data = data; + FirstId = firstId; + LastId = lastId; + HasMore = hasMore; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OpenAIPageableListOfAgent() + { + } + + /// The object type, which is always list. + public OpenAIPageableListOfAgentObject Object { get; } = OpenAIPageableListOfAgentObject.List; + + /// The requested list of items. + public IReadOnlyList Data { get; } + /// The first ID represented in this list. + public string FirstId { get; } + /// The last ID represented in this list. + public string LastId { get; } + /// A value indicating whether there are additional values available not captured in this list. + public bool HasMore { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfAgentObject.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfAgentObject.cs new file mode 100644 index 000000000000..9e7494ec56d1 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfAgentObject.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// The OpenAIPageableListOfAgent_object. + internal readonly partial struct OpenAIPageableListOfAgentObject : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public OpenAIPageableListOfAgentObject(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ListValue = "list"; + + /// list. + public static OpenAIPageableListOfAgentObject List { get; } = new OpenAIPageableListOfAgentObject(ListValue); + /// Determines if two values are the same. + public static bool operator ==(OpenAIPageableListOfAgentObject left, OpenAIPageableListOfAgentObject right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OpenAIPageableListOfAgentObject left, OpenAIPageableListOfAgentObject right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator OpenAIPageableListOfAgentObject(string value) => new OpenAIPageableListOfAgentObject(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OpenAIPageableListOfAgentObject other && Equals(other); + /// + public bool Equals(OpenAIPageableListOfAgentObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfRunStep.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfRunStep.Serialization.cs new file mode 100644 index 000000000000..dc239cfeda4a --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfRunStep.Serialization.cs @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class OpenAIPageableListOfRunStep : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenAIPageableListOfRunStep)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("object"u8); + writer.WriteStringValue(Object.ToString()); + writer.WritePropertyName("data"u8); + writer.WriteStartArray(); + foreach (var item in Data) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + writer.WritePropertyName("first_id"u8); + writer.WriteStringValue(FirstId); + writer.WritePropertyName("last_id"u8); + writer.WriteStringValue(LastId); + writer.WritePropertyName("has_more"u8); + writer.WriteBooleanValue(HasMore); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + OpenAIPageableListOfRunStep IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenAIPageableListOfRunStep)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOpenAIPageableListOfRunStep(document.RootElement, options); + } + + internal static OpenAIPageableListOfRunStep DeserializeOpenAIPageableListOfRunStep(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + OpenAIPageableListOfRunStepObject @object = default; + IReadOnlyList data = default; + string firstId = default; + string lastId = default; + bool hasMore = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("object"u8)) + { + @object = new OpenAIPageableListOfRunStepObject(property.Value.GetString()); + continue; + } + if (property.NameEquals("data"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(RunStep.DeserializeRunStep(item, options)); + } + data = array; + continue; + } + if (property.NameEquals("first_id"u8)) + { + firstId = property.Value.GetString(); + continue; + } + if (property.NameEquals("last_id"u8)) + { + lastId = property.Value.GetString(); + continue; + } + if (property.NameEquals("has_more"u8)) + { + hasMore = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OpenAIPageableListOfRunStep( + @object, + data, + firstId, + lastId, + hasMore, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(OpenAIPageableListOfRunStep)} does not support writing '{options.Format}' format."); + } + } + + OpenAIPageableListOfRunStep IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOpenAIPageableListOfRunStep(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OpenAIPageableListOfRunStep)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static OpenAIPageableListOfRunStep FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOpenAIPageableListOfRunStep(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfRunStep.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfRunStep.cs new file mode 100644 index 000000000000..036bf88c6d75 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfRunStep.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Assistants +{ + /// The response data for a requested list of items. + internal partial class OpenAIPageableListOfRunStep + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The requested list of items. + /// The first ID represented in this list. + /// The last ID represented in this list. + /// A value indicating whether there are additional values available not captured in this list. + /// , or is null. + internal OpenAIPageableListOfRunStep(IEnumerable data, string firstId, string lastId, bool hasMore) + { + Argument.AssertNotNull(data, nameof(data)); + Argument.AssertNotNull(firstId, nameof(firstId)); + Argument.AssertNotNull(lastId, nameof(lastId)); + + Data = data.ToList(); + FirstId = firstId; + LastId = lastId; + HasMore = hasMore; + } + + /// Initializes a new instance of . + /// The object type, which is always list. + /// The requested list of items. + /// The first ID represented in this list. + /// The last ID represented in this list. + /// A value indicating whether there are additional values available not captured in this list. + /// Keeps track of any properties unknown to the library. + internal OpenAIPageableListOfRunStep(OpenAIPageableListOfRunStepObject @object, IReadOnlyList data, string firstId, string lastId, bool hasMore, IDictionary serializedAdditionalRawData) + { + Object = @object; + Data = data; + FirstId = firstId; + LastId = lastId; + HasMore = hasMore; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OpenAIPageableListOfRunStep() + { + } + + /// The object type, which is always list. + public OpenAIPageableListOfRunStepObject Object { get; } = OpenAIPageableListOfRunStepObject.List; + + /// The requested list of items. + public IReadOnlyList Data { get; } + /// The first ID represented in this list. + public string FirstId { get; } + /// The last ID represented in this list. + public string LastId { get; } + /// A value indicating whether there are additional values available not captured in this list. + public bool HasMore { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfRunStepObject.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfRunStepObject.cs new file mode 100644 index 000000000000..acfd23652ff3 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfRunStepObject.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// The OpenAIPageableListOfRunStep_object. + internal readonly partial struct OpenAIPageableListOfRunStepObject : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public OpenAIPageableListOfRunStepObject(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ListValue = "list"; + + /// list. + public static OpenAIPageableListOfRunStepObject List { get; } = new OpenAIPageableListOfRunStepObject(ListValue); + /// Determines if two values are the same. + public static bool operator ==(OpenAIPageableListOfRunStepObject left, OpenAIPageableListOfRunStepObject right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OpenAIPageableListOfRunStepObject left, OpenAIPageableListOfRunStepObject right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator OpenAIPageableListOfRunStepObject(string value) => new OpenAIPageableListOfRunStepObject(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OpenAIPageableListOfRunStepObject other && Equals(other); + /// + public bool Equals(OpenAIPageableListOfRunStepObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfThreadMessage.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfThreadMessage.Serialization.cs new file mode 100644 index 000000000000..aa03e1b85f6c --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfThreadMessage.Serialization.cs @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class OpenAIPageableListOfThreadMessage : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenAIPageableListOfThreadMessage)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("object"u8); + writer.WriteStringValue(Object.ToString()); + writer.WritePropertyName("data"u8); + writer.WriteStartArray(); + foreach (var item in Data) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + writer.WritePropertyName("first_id"u8); + writer.WriteStringValue(FirstId); + writer.WritePropertyName("last_id"u8); + writer.WriteStringValue(LastId); + writer.WritePropertyName("has_more"u8); + writer.WriteBooleanValue(HasMore); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + OpenAIPageableListOfThreadMessage IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenAIPageableListOfThreadMessage)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOpenAIPageableListOfThreadMessage(document.RootElement, options); + } + + internal static OpenAIPageableListOfThreadMessage DeserializeOpenAIPageableListOfThreadMessage(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + OpenAIPageableListOfThreadMessageObject @object = default; + IReadOnlyList data = default; + string firstId = default; + string lastId = default; + bool hasMore = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("object"u8)) + { + @object = new OpenAIPageableListOfThreadMessageObject(property.Value.GetString()); + continue; + } + if (property.NameEquals("data"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ThreadMessage.DeserializeThreadMessage(item, options)); + } + data = array; + continue; + } + if (property.NameEquals("first_id"u8)) + { + firstId = property.Value.GetString(); + continue; + } + if (property.NameEquals("last_id"u8)) + { + lastId = property.Value.GetString(); + continue; + } + if (property.NameEquals("has_more"u8)) + { + hasMore = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OpenAIPageableListOfThreadMessage( + @object, + data, + firstId, + lastId, + hasMore, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(OpenAIPageableListOfThreadMessage)} does not support writing '{options.Format}' format."); + } + } + + OpenAIPageableListOfThreadMessage IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOpenAIPageableListOfThreadMessage(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OpenAIPageableListOfThreadMessage)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static OpenAIPageableListOfThreadMessage FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOpenAIPageableListOfThreadMessage(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfThreadMessage.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfThreadMessage.cs new file mode 100644 index 000000000000..dd6ca6903cf6 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfThreadMessage.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Assistants +{ + /// The response data for a requested list of items. + internal partial class OpenAIPageableListOfThreadMessage + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The requested list of items. + /// The first ID represented in this list. + /// The last ID represented in this list. + /// A value indicating whether there are additional values available not captured in this list. + /// , or is null. + internal OpenAIPageableListOfThreadMessage(IEnumerable data, string firstId, string lastId, bool hasMore) + { + Argument.AssertNotNull(data, nameof(data)); + Argument.AssertNotNull(firstId, nameof(firstId)); + Argument.AssertNotNull(lastId, nameof(lastId)); + + Data = data.ToList(); + FirstId = firstId; + LastId = lastId; + HasMore = hasMore; + } + + /// Initializes a new instance of . + /// The object type, which is always list. + /// The requested list of items. + /// The first ID represented in this list. + /// The last ID represented in this list. + /// A value indicating whether there are additional values available not captured in this list. + /// Keeps track of any properties unknown to the library. + internal OpenAIPageableListOfThreadMessage(OpenAIPageableListOfThreadMessageObject @object, IReadOnlyList data, string firstId, string lastId, bool hasMore, IDictionary serializedAdditionalRawData) + { + Object = @object; + Data = data; + FirstId = firstId; + LastId = lastId; + HasMore = hasMore; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OpenAIPageableListOfThreadMessage() + { + } + + /// The object type, which is always list. + public OpenAIPageableListOfThreadMessageObject Object { get; } = OpenAIPageableListOfThreadMessageObject.List; + + /// The requested list of items. + public IReadOnlyList Data { get; } + /// The first ID represented in this list. + public string FirstId { get; } + /// The last ID represented in this list. + public string LastId { get; } + /// A value indicating whether there are additional values available not captured in this list. + public bool HasMore { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfThreadMessageObject.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfThreadMessageObject.cs new file mode 100644 index 000000000000..059d0d6d53b4 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfThreadMessageObject.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// The OpenAIPageableListOfThreadMessage_object. + internal readonly partial struct OpenAIPageableListOfThreadMessageObject : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public OpenAIPageableListOfThreadMessageObject(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ListValue = "list"; + + /// list. + public static OpenAIPageableListOfThreadMessageObject List { get; } = new OpenAIPageableListOfThreadMessageObject(ListValue); + /// Determines if two values are the same. + public static bool operator ==(OpenAIPageableListOfThreadMessageObject left, OpenAIPageableListOfThreadMessageObject right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OpenAIPageableListOfThreadMessageObject left, OpenAIPageableListOfThreadMessageObject right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator OpenAIPageableListOfThreadMessageObject(string value) => new OpenAIPageableListOfThreadMessageObject(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OpenAIPageableListOfThreadMessageObject other && Equals(other); + /// + public bool Equals(OpenAIPageableListOfThreadMessageObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfThreadRun.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfThreadRun.Serialization.cs new file mode 100644 index 000000000000..46e0d92396f7 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfThreadRun.Serialization.cs @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class OpenAIPageableListOfThreadRun : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenAIPageableListOfThreadRun)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("object"u8); + writer.WriteStringValue(Object.ToString()); + writer.WritePropertyName("data"u8); + writer.WriteStartArray(); + foreach (var item in Data) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + writer.WritePropertyName("first_id"u8); + writer.WriteStringValue(FirstId); + writer.WritePropertyName("last_id"u8); + writer.WriteStringValue(LastId); + writer.WritePropertyName("has_more"u8); + writer.WriteBooleanValue(HasMore); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + OpenAIPageableListOfThreadRun IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenAIPageableListOfThreadRun)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOpenAIPageableListOfThreadRun(document.RootElement, options); + } + + internal static OpenAIPageableListOfThreadRun DeserializeOpenAIPageableListOfThreadRun(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + OpenAIPageableListOfThreadRunObject @object = default; + IReadOnlyList data = default; + string firstId = default; + string lastId = default; + bool hasMore = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("object"u8)) + { + @object = new OpenAIPageableListOfThreadRunObject(property.Value.GetString()); + continue; + } + if (property.NameEquals("data"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ThreadRun.DeserializeThreadRun(item, options)); + } + data = array; + continue; + } + if (property.NameEquals("first_id"u8)) + { + firstId = property.Value.GetString(); + continue; + } + if (property.NameEquals("last_id"u8)) + { + lastId = property.Value.GetString(); + continue; + } + if (property.NameEquals("has_more"u8)) + { + hasMore = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OpenAIPageableListOfThreadRun( + @object, + data, + firstId, + lastId, + hasMore, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(OpenAIPageableListOfThreadRun)} does not support writing '{options.Format}' format."); + } + } + + OpenAIPageableListOfThreadRun IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOpenAIPageableListOfThreadRun(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OpenAIPageableListOfThreadRun)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static OpenAIPageableListOfThreadRun FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOpenAIPageableListOfThreadRun(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfThreadRun.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfThreadRun.cs new file mode 100644 index 000000000000..c557ff0c7a30 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfThreadRun.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Assistants +{ + /// The response data for a requested list of items. + internal partial class OpenAIPageableListOfThreadRun + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The requested list of items. + /// The first ID represented in this list. + /// The last ID represented in this list. + /// A value indicating whether there are additional values available not captured in this list. + /// , or is null. + internal OpenAIPageableListOfThreadRun(IEnumerable data, string firstId, string lastId, bool hasMore) + { + Argument.AssertNotNull(data, nameof(data)); + Argument.AssertNotNull(firstId, nameof(firstId)); + Argument.AssertNotNull(lastId, nameof(lastId)); + + Data = data.ToList(); + FirstId = firstId; + LastId = lastId; + HasMore = hasMore; + } + + /// Initializes a new instance of . + /// The object type, which is always list. + /// The requested list of items. + /// The first ID represented in this list. + /// The last ID represented in this list. + /// A value indicating whether there are additional values available not captured in this list. + /// Keeps track of any properties unknown to the library. + internal OpenAIPageableListOfThreadRun(OpenAIPageableListOfThreadRunObject @object, IReadOnlyList data, string firstId, string lastId, bool hasMore, IDictionary serializedAdditionalRawData) + { + Object = @object; + Data = data; + FirstId = firstId; + LastId = lastId; + HasMore = hasMore; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OpenAIPageableListOfThreadRun() + { + } + + /// The object type, which is always list. + public OpenAIPageableListOfThreadRunObject Object { get; } = OpenAIPageableListOfThreadRunObject.List; + + /// The requested list of items. + public IReadOnlyList Data { get; } + /// The first ID represented in this list. + public string FirstId { get; } + /// The last ID represented in this list. + public string LastId { get; } + /// A value indicating whether there are additional values available not captured in this list. + public bool HasMore { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfThreadRunObject.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfThreadRunObject.cs new file mode 100644 index 000000000000..3659fa94efa4 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfThreadRunObject.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// The OpenAIPageableListOfThreadRun_object. + internal readonly partial struct OpenAIPageableListOfThreadRunObject : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public OpenAIPageableListOfThreadRunObject(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ListValue = "list"; + + /// list. + public static OpenAIPageableListOfThreadRunObject List { get; } = new OpenAIPageableListOfThreadRunObject(ListValue); + /// Determines if two values are the same. + public static bool operator ==(OpenAIPageableListOfThreadRunObject left, OpenAIPageableListOfThreadRunObject right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OpenAIPageableListOfThreadRunObject left, OpenAIPageableListOfThreadRunObject right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator OpenAIPageableListOfThreadRunObject(string value) => new OpenAIPageableListOfThreadRunObject(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OpenAIPageableListOfThreadRunObject other && Equals(other); + /// + public bool Equals(OpenAIPageableListOfThreadRunObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfVectorStore.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfVectorStore.Serialization.cs new file mode 100644 index 000000000000..5cdbd2ed6c48 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfVectorStore.Serialization.cs @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class OpenAIPageableListOfVectorStore : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenAIPageableListOfVectorStore)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("object"u8); + writer.WriteStringValue(Object.ToString()); + writer.WritePropertyName("data"u8); + writer.WriteStartArray(); + foreach (var item in Data) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + writer.WritePropertyName("first_id"u8); + writer.WriteStringValue(FirstId); + writer.WritePropertyName("last_id"u8); + writer.WriteStringValue(LastId); + writer.WritePropertyName("has_more"u8); + writer.WriteBooleanValue(HasMore); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + OpenAIPageableListOfVectorStore IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenAIPageableListOfVectorStore)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOpenAIPageableListOfVectorStore(document.RootElement, options); + } + + internal static OpenAIPageableListOfVectorStore DeserializeOpenAIPageableListOfVectorStore(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + OpenAIPageableListOfVectorStoreObject @object = default; + IReadOnlyList data = default; + string firstId = default; + string lastId = default; + bool hasMore = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("object"u8)) + { + @object = new OpenAIPageableListOfVectorStoreObject(property.Value.GetString()); + continue; + } + if (property.NameEquals("data"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(VectorStore.DeserializeVectorStore(item, options)); + } + data = array; + continue; + } + if (property.NameEquals("first_id"u8)) + { + firstId = property.Value.GetString(); + continue; + } + if (property.NameEquals("last_id"u8)) + { + lastId = property.Value.GetString(); + continue; + } + if (property.NameEquals("has_more"u8)) + { + hasMore = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OpenAIPageableListOfVectorStore( + @object, + data, + firstId, + lastId, + hasMore, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(OpenAIPageableListOfVectorStore)} does not support writing '{options.Format}' format."); + } + } + + OpenAIPageableListOfVectorStore IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOpenAIPageableListOfVectorStore(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OpenAIPageableListOfVectorStore)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static OpenAIPageableListOfVectorStore FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOpenAIPageableListOfVectorStore(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfVectorStore.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfVectorStore.cs new file mode 100644 index 000000000000..068997153147 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfVectorStore.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Assistants +{ + /// The response data for a requested list of items. + public partial class OpenAIPageableListOfVectorStore + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The requested list of items. + /// The first ID represented in this list. + /// The last ID represented in this list. + /// A value indicating whether there are additional values available not captured in this list. + /// , or is null. + internal OpenAIPageableListOfVectorStore(IEnumerable data, string firstId, string lastId, bool hasMore) + { + Argument.AssertNotNull(data, nameof(data)); + Argument.AssertNotNull(firstId, nameof(firstId)); + Argument.AssertNotNull(lastId, nameof(lastId)); + + Data = data.ToList(); + FirstId = firstId; + LastId = lastId; + HasMore = hasMore; + } + + /// Initializes a new instance of . + /// The object type, which is always list. + /// The requested list of items. + /// The first ID represented in this list. + /// The last ID represented in this list. + /// A value indicating whether there are additional values available not captured in this list. + /// Keeps track of any properties unknown to the library. + internal OpenAIPageableListOfVectorStore(OpenAIPageableListOfVectorStoreObject @object, IReadOnlyList data, string firstId, string lastId, bool hasMore, IDictionary serializedAdditionalRawData) + { + Object = @object; + Data = data; + FirstId = firstId; + LastId = lastId; + HasMore = hasMore; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OpenAIPageableListOfVectorStore() + { + } + + /// The object type, which is always list. + public OpenAIPageableListOfVectorStoreObject Object { get; } = OpenAIPageableListOfVectorStoreObject.List; + + /// The requested list of items. + public IReadOnlyList Data { get; } + /// The first ID represented in this list. + public string FirstId { get; } + /// The last ID represented in this list. + public string LastId { get; } + /// A value indicating whether there are additional values available not captured in this list. + public bool HasMore { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfVectorStoreFile.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfVectorStoreFile.Serialization.cs new file mode 100644 index 000000000000..6819094c37d7 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfVectorStoreFile.Serialization.cs @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class OpenAIPageableListOfVectorStoreFile : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenAIPageableListOfVectorStoreFile)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("object"u8); + writer.WriteStringValue(Object.ToString()); + writer.WritePropertyName("data"u8); + writer.WriteStartArray(); + foreach (var item in Data) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + writer.WritePropertyName("first_id"u8); + writer.WriteStringValue(FirstId); + writer.WritePropertyName("last_id"u8); + writer.WriteStringValue(LastId); + writer.WritePropertyName("has_more"u8); + writer.WriteBooleanValue(HasMore); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + OpenAIPageableListOfVectorStoreFile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenAIPageableListOfVectorStoreFile)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOpenAIPageableListOfVectorStoreFile(document.RootElement, options); + } + + internal static OpenAIPageableListOfVectorStoreFile DeserializeOpenAIPageableListOfVectorStoreFile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + OpenAIPageableListOfVectorStoreFileObject @object = default; + IReadOnlyList data = default; + string firstId = default; + string lastId = default; + bool hasMore = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("object"u8)) + { + @object = new OpenAIPageableListOfVectorStoreFileObject(property.Value.GetString()); + continue; + } + if (property.NameEquals("data"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(VectorStoreFile.DeserializeVectorStoreFile(item, options)); + } + data = array; + continue; + } + if (property.NameEquals("first_id"u8)) + { + firstId = property.Value.GetString(); + continue; + } + if (property.NameEquals("last_id"u8)) + { + lastId = property.Value.GetString(); + continue; + } + if (property.NameEquals("has_more"u8)) + { + hasMore = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OpenAIPageableListOfVectorStoreFile( + @object, + data, + firstId, + lastId, + hasMore, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(OpenAIPageableListOfVectorStoreFile)} does not support writing '{options.Format}' format."); + } + } + + OpenAIPageableListOfVectorStoreFile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOpenAIPageableListOfVectorStoreFile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OpenAIPageableListOfVectorStoreFile)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static OpenAIPageableListOfVectorStoreFile FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOpenAIPageableListOfVectorStoreFile(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfVectorStoreFile.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfVectorStoreFile.cs new file mode 100644 index 000000000000..67bd549d54cb --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfVectorStoreFile.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Assistants +{ + /// The response data for a requested list of items. + public partial class OpenAIPageableListOfVectorStoreFile + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The requested list of items. + /// The first ID represented in this list. + /// The last ID represented in this list. + /// A value indicating whether there are additional values available not captured in this list. + /// , or is null. + internal OpenAIPageableListOfVectorStoreFile(IEnumerable data, string firstId, string lastId, bool hasMore) + { + Argument.AssertNotNull(data, nameof(data)); + Argument.AssertNotNull(firstId, nameof(firstId)); + Argument.AssertNotNull(lastId, nameof(lastId)); + + Data = data.ToList(); + FirstId = firstId; + LastId = lastId; + HasMore = hasMore; + } + + /// Initializes a new instance of . + /// The object type, which is always list. + /// The requested list of items. + /// The first ID represented in this list. + /// The last ID represented in this list. + /// A value indicating whether there are additional values available not captured in this list. + /// Keeps track of any properties unknown to the library. + internal OpenAIPageableListOfVectorStoreFile(OpenAIPageableListOfVectorStoreFileObject @object, IReadOnlyList data, string firstId, string lastId, bool hasMore, IDictionary serializedAdditionalRawData) + { + Object = @object; + Data = data; + FirstId = firstId; + LastId = lastId; + HasMore = hasMore; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OpenAIPageableListOfVectorStoreFile() + { + } + + /// The object type, which is always list. + public OpenAIPageableListOfVectorStoreFileObject Object { get; } = OpenAIPageableListOfVectorStoreFileObject.List; + + /// The requested list of items. + public IReadOnlyList Data { get; } + /// The first ID represented in this list. + public string FirstId { get; } + /// The last ID represented in this list. + public string LastId { get; } + /// A value indicating whether there are additional values available not captured in this list. + public bool HasMore { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfVectorStoreFileObject.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfVectorStoreFileObject.cs new file mode 100644 index 000000000000..6bac06b3960e --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfVectorStoreFileObject.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// The OpenAIPageableListOfVectorStoreFile_object. + public readonly partial struct OpenAIPageableListOfVectorStoreFileObject : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public OpenAIPageableListOfVectorStoreFileObject(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ListValue = "list"; + + /// list. + public static OpenAIPageableListOfVectorStoreFileObject List { get; } = new OpenAIPageableListOfVectorStoreFileObject(ListValue); + /// Determines if two values are the same. + public static bool operator ==(OpenAIPageableListOfVectorStoreFileObject left, OpenAIPageableListOfVectorStoreFileObject right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OpenAIPageableListOfVectorStoreFileObject left, OpenAIPageableListOfVectorStoreFileObject right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator OpenAIPageableListOfVectorStoreFileObject(string value) => new OpenAIPageableListOfVectorStoreFileObject(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OpenAIPageableListOfVectorStoreFileObject other && Equals(other); + /// + public bool Equals(OpenAIPageableListOfVectorStoreFileObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfVectorStoreObject.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfVectorStoreObject.cs new file mode 100644 index 000000000000..6bb999154fc0 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenAIPageableListOfVectorStoreObject.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// The OpenAIPageableListOfVectorStore_object. + public readonly partial struct OpenAIPageableListOfVectorStoreObject : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public OpenAIPageableListOfVectorStoreObject(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ListValue = "list"; + + /// list. + public static OpenAIPageableListOfVectorStoreObject List { get; } = new OpenAIPageableListOfVectorStoreObject(ListValue); + /// Determines if two values are the same. + public static bool operator ==(OpenAIPageableListOfVectorStoreObject left, OpenAIPageableListOfVectorStoreObject right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OpenAIPageableListOfVectorStoreObject left, OpenAIPageableListOfVectorStoreObject right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator OpenAIPageableListOfVectorStoreObject(string value) => new OpenAIPageableListOfVectorStoreObject(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OpenAIPageableListOfVectorStoreObject other && Equals(other); + /// + public bool Equals(OpenAIPageableListOfVectorStoreObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiAnonymousAuthDetails.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiAnonymousAuthDetails.Serialization.cs new file mode 100644 index 000000000000..78f474b8d32f --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiAnonymousAuthDetails.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class OpenApiAnonymousAuthDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiAnonymousAuthDetails)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + OpenApiAnonymousAuthDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiAnonymousAuthDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOpenApiAnonymousAuthDetails(document.RootElement, options); + } + + internal static OpenApiAnonymousAuthDetails DeserializeOpenApiAnonymousAuthDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + OpenApiAuthType type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new OpenApiAuthType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OpenApiAnonymousAuthDetails(type, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(OpenApiAnonymousAuthDetails)} does not support writing '{options.Format}' format."); + } + } + + OpenApiAnonymousAuthDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOpenApiAnonymousAuthDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OpenApiAnonymousAuthDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new OpenApiAnonymousAuthDetails FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOpenApiAnonymousAuthDetails(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiAnonymousAuthDetails.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiAnonymousAuthDetails.cs new file mode 100644 index 000000000000..968c9b2a63c3 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiAnonymousAuthDetails.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Security details for OpenApi anonymous authentication. + public partial class OpenApiAnonymousAuthDetails : OpenApiAuthDetails + { + /// Initializes a new instance of . + public OpenApiAnonymousAuthDetails() + { + Type = OpenApiAuthType.Anonymous; + } + + /// Initializes a new instance of . + /// The type of authentication, must be anonymous/connection/managed_identity. + /// Keeps track of any properties unknown to the library. + internal OpenApiAnonymousAuthDetails(OpenApiAuthType type, IDictionary serializedAdditionalRawData) : base(type, serializedAdditionalRawData) + { + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiAuthDetails.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiAuthDetails.Serialization.cs new file mode 100644 index 000000000000..32ba1872a4cc --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiAuthDetails.Serialization.cs @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + [PersistableModelProxy(typeof(UnknownOpenApiAuthDetails))] + public partial class OpenApiAuthDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiAuthDetails)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + OpenApiAuthDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiAuthDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOpenApiAuthDetails(document.RootElement, options); + } + + internal static OpenApiAuthDetails DeserializeOpenApiAuthDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("type", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "anonymous": return OpenApiAnonymousAuthDetails.DeserializeOpenApiAnonymousAuthDetails(element, options); + case "connection": return OpenApiConnectionAuthDetails.DeserializeOpenApiConnectionAuthDetails(element, options); + case "managed_identity": return OpenApiManagedAuthDetails.DeserializeOpenApiManagedAuthDetails(element, options); + } + } + return UnknownOpenApiAuthDetails.DeserializeUnknownOpenApiAuthDetails(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(OpenApiAuthDetails)} does not support writing '{options.Format}' format."); + } + } + + OpenApiAuthDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOpenApiAuthDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OpenApiAuthDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static OpenApiAuthDetails FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOpenApiAuthDetails(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiAuthDetails.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiAuthDetails.cs new file mode 100644 index 000000000000..caea1532a2ae --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiAuthDetails.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// + /// authentication details for OpenApiFunctionDefinition + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + public abstract partial class OpenApiAuthDetails + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + protected OpenApiAuthDetails() + { + } + + /// Initializes a new instance of . + /// The type of authentication, must be anonymous/connection/managed_identity. + /// Keeps track of any properties unknown to the library. + internal OpenApiAuthDetails(OpenApiAuthType type, IDictionary serializedAdditionalRawData) + { + Type = type; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The type of authentication, must be anonymous/connection/managed_identity. + internal OpenApiAuthType Type { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiAuthType.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiAuthType.cs new file mode 100644 index 000000000000..d462a97d1733 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiAuthType.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// + /// Authentication type for OpenApi endpoint. Allowed types are: + /// - Anonymous (no authentication required) + /// - Connection (requires connection_id to endpoint, as setup in AI Foundry) + /// - Managed_Identity (requires audience for identity based auth) + /// + internal readonly partial struct OpenApiAuthType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public OpenApiAuthType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AnonymousValue = "anonymous"; + private const string ConnectionValue = "connection"; + private const string ManagedIdentityValue = "managed_identity"; + + /// anonymous. + public static OpenApiAuthType Anonymous { get; } = new OpenApiAuthType(AnonymousValue); + /// connection. + public static OpenApiAuthType Connection { get; } = new OpenApiAuthType(ConnectionValue); + /// managed_identity. + public static OpenApiAuthType ManagedIdentity { get; } = new OpenApiAuthType(ManagedIdentityValue); + /// Determines if two values are the same. + public static bool operator ==(OpenApiAuthType left, OpenApiAuthType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OpenApiAuthType left, OpenApiAuthType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator OpenApiAuthType(string value) => new OpenApiAuthType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OpenApiAuthType other && Equals(other); + /// + public bool Equals(OpenApiAuthType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiConnectionAuthDetails.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiConnectionAuthDetails.Serialization.cs new file mode 100644 index 000000000000..09789524e81b --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiConnectionAuthDetails.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class OpenApiConnectionAuthDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiConnectionAuthDetails)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("security_scheme"u8); + writer.WriteObjectValue(SecurityScheme, options); + } + + OpenApiConnectionAuthDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiConnectionAuthDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOpenApiConnectionAuthDetails(document.RootElement, options); + } + + internal static OpenApiConnectionAuthDetails DeserializeOpenApiConnectionAuthDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + OpenApiConnectionSecurityScheme securityScheme = default; + OpenApiAuthType type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("security_scheme"u8)) + { + securityScheme = OpenApiConnectionSecurityScheme.DeserializeOpenApiConnectionSecurityScheme(property.Value, options); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new OpenApiAuthType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OpenApiConnectionAuthDetails(type, serializedAdditionalRawData, securityScheme); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(OpenApiConnectionAuthDetails)} does not support writing '{options.Format}' format."); + } + } + + OpenApiConnectionAuthDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOpenApiConnectionAuthDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OpenApiConnectionAuthDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new OpenApiConnectionAuthDetails FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOpenApiConnectionAuthDetails(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiConnectionAuthDetails.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiConnectionAuthDetails.cs new file mode 100644 index 000000000000..c7f8b0ad1889 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiConnectionAuthDetails.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Security details for OpenApi connection authentication. + public partial class OpenApiConnectionAuthDetails : OpenApiAuthDetails + { + /// Initializes a new instance of . + /// Connection auth security details. + /// is null. + public OpenApiConnectionAuthDetails(OpenApiConnectionSecurityScheme securityScheme) + { + Argument.AssertNotNull(securityScheme, nameof(securityScheme)); + + Type = OpenApiAuthType.Connection; + SecurityScheme = securityScheme; + } + + /// Initializes a new instance of . + /// The type of authentication, must be anonymous/connection/managed_identity. + /// Keeps track of any properties unknown to the library. + /// Connection auth security details. + internal OpenApiConnectionAuthDetails(OpenApiAuthType type, IDictionary serializedAdditionalRawData, OpenApiConnectionSecurityScheme securityScheme) : base(type, serializedAdditionalRawData) + { + SecurityScheme = securityScheme; + } + + /// Initializes a new instance of for deserialization. + internal OpenApiConnectionAuthDetails() + { + } + + /// Connection auth security details. + public OpenApiConnectionSecurityScheme SecurityScheme { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiConnectionSecurityScheme.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiConnectionSecurityScheme.Serialization.cs new file mode 100644 index 000000000000..c410229c7f9e --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiConnectionSecurityScheme.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class OpenApiConnectionSecurityScheme : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiConnectionSecurityScheme)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("connection_id"u8); + writer.WriteStringValue(ConnectionId); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + OpenApiConnectionSecurityScheme IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiConnectionSecurityScheme)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOpenApiConnectionSecurityScheme(document.RootElement, options); + } + + internal static OpenApiConnectionSecurityScheme DeserializeOpenApiConnectionSecurityScheme(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string connectionId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("connection_id"u8)) + { + connectionId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OpenApiConnectionSecurityScheme(connectionId, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(OpenApiConnectionSecurityScheme)} does not support writing '{options.Format}' format."); + } + } + + OpenApiConnectionSecurityScheme IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOpenApiConnectionSecurityScheme(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OpenApiConnectionSecurityScheme)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static OpenApiConnectionSecurityScheme FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOpenApiConnectionSecurityScheme(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiConnectionSecurityScheme.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiConnectionSecurityScheme.cs new file mode 100644 index 000000000000..777e65adc916 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiConnectionSecurityScheme.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Security scheme for OpenApi managed_identity authentication. + public partial class OpenApiConnectionSecurityScheme + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Connection id for Connection auth type. + /// is null. + public OpenApiConnectionSecurityScheme(string connectionId) + { + Argument.AssertNotNull(connectionId, nameof(connectionId)); + + ConnectionId = connectionId; + } + + /// Initializes a new instance of . + /// Connection id for Connection auth type. + /// Keeps track of any properties unknown to the library. + internal OpenApiConnectionSecurityScheme(string connectionId, IDictionary serializedAdditionalRawData) + { + ConnectionId = connectionId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OpenApiConnectionSecurityScheme() + { + } + + /// Connection id for Connection auth type. + public string ConnectionId { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiFunctionDefinition.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiFunctionDefinition.Serialization.cs new file mode 100644 index 000000000000..62ae78e80190 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiFunctionDefinition.Serialization.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class OpenApiFunctionDefinition : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiFunctionDefinition)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WritePropertyName("spec"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(Spec); +#else + using (JsonDocument document = JsonDocument.Parse(Spec, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + writer.WritePropertyName("auth"u8); + writer.WriteObjectValue(Auth, options); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + OpenApiFunctionDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiFunctionDefinition)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOpenApiFunctionDefinition(document.RootElement, options); + } + + internal static OpenApiFunctionDefinition DeserializeOpenApiFunctionDefinition(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string description = default; + BinaryData spec = default; + OpenApiAuthDetails auth = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("spec"u8)) + { + spec = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("auth"u8)) + { + auth = OpenApiAuthDetails.DeserializeOpenApiAuthDetails(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OpenApiFunctionDefinition(name, description, spec, auth, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(OpenApiFunctionDefinition)} does not support writing '{options.Format}' format."); + } + } + + OpenApiFunctionDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOpenApiFunctionDefinition(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OpenApiFunctionDefinition)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static OpenApiFunctionDefinition FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOpenApiFunctionDefinition(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiFunctionDefinition.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiFunctionDefinition.cs new file mode 100644 index 000000000000..87280a704788 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiFunctionDefinition.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The input definition information for an openapi function. + public partial class OpenApiFunctionDefinition + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The name of the function to be called. + /// The openapi function shape, described as a JSON Schema object. + /// + /// Open API authentication details + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// , or is null. + public OpenApiFunctionDefinition(string name, BinaryData spec, OpenApiAuthDetails auth) + { + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(spec, nameof(spec)); + Argument.AssertNotNull(auth, nameof(auth)); + + Name = name; + Spec = spec; + Auth = auth; + } + + /// Initializes a new instance of . + /// The name of the function to be called. + /// A description of what the function does, used by the model to choose when and how to call the function. + /// The openapi function shape, described as a JSON Schema object. + /// + /// Open API authentication details + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// Keeps track of any properties unknown to the library. + internal OpenApiFunctionDefinition(string name, string description, BinaryData spec, OpenApiAuthDetails auth, IDictionary serializedAdditionalRawData) + { + Name = name; + Description = description; + Spec = spec; + Auth = auth; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OpenApiFunctionDefinition() + { + } + + /// The name of the function to be called. + public string Name { get; set; } + /// A description of what the function does, used by the model to choose when and how to call the function. + public string Description { get; set; } + /// + /// The openapi function shape, described as a JSON Schema object. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + public BinaryData Spec { get; set; } + /// + /// Open API authentication details + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + public OpenApiAuthDetails Auth { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiManagedAuthDetails.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiManagedAuthDetails.Serialization.cs new file mode 100644 index 000000000000..5515e10c26c1 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiManagedAuthDetails.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class OpenApiManagedAuthDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiManagedAuthDetails)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("security_scheme"u8); + writer.WriteObjectValue(SecurityScheme, options); + } + + OpenApiManagedAuthDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiManagedAuthDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOpenApiManagedAuthDetails(document.RootElement, options); + } + + internal static OpenApiManagedAuthDetails DeserializeOpenApiManagedAuthDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + OpenApiManagedSecurityScheme securityScheme = default; + OpenApiAuthType type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("security_scheme"u8)) + { + securityScheme = OpenApiManagedSecurityScheme.DeserializeOpenApiManagedSecurityScheme(property.Value, options); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new OpenApiAuthType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OpenApiManagedAuthDetails(type, serializedAdditionalRawData, securityScheme); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(OpenApiManagedAuthDetails)} does not support writing '{options.Format}' format."); + } + } + + OpenApiManagedAuthDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOpenApiManagedAuthDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OpenApiManagedAuthDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new OpenApiManagedAuthDetails FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOpenApiManagedAuthDetails(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiManagedAuthDetails.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiManagedAuthDetails.cs new file mode 100644 index 000000000000..e47189438cea --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiManagedAuthDetails.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Security details for OpenApi managed_identity authentication. + public partial class OpenApiManagedAuthDetails : OpenApiAuthDetails + { + /// Initializes a new instance of . + /// Connection auth security details. + /// is null. + public OpenApiManagedAuthDetails(OpenApiManagedSecurityScheme securityScheme) + { + Argument.AssertNotNull(securityScheme, nameof(securityScheme)); + + Type = OpenApiAuthType.ManagedIdentity; + SecurityScheme = securityScheme; + } + + /// Initializes a new instance of . + /// The type of authentication, must be anonymous/connection/managed_identity. + /// Keeps track of any properties unknown to the library. + /// Connection auth security details. + internal OpenApiManagedAuthDetails(OpenApiAuthType type, IDictionary serializedAdditionalRawData, OpenApiManagedSecurityScheme securityScheme) : base(type, serializedAdditionalRawData) + { + SecurityScheme = securityScheme; + } + + /// Initializes a new instance of for deserialization. + internal OpenApiManagedAuthDetails() + { + } + + /// Connection auth security details. + public OpenApiManagedSecurityScheme SecurityScheme { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiManagedSecurityScheme.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiManagedSecurityScheme.Serialization.cs new file mode 100644 index 000000000000..bde93478c8a1 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiManagedSecurityScheme.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class OpenApiManagedSecurityScheme : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiManagedSecurityScheme)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("audience"u8); + writer.WriteStringValue(Audience); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + OpenApiManagedSecurityScheme IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiManagedSecurityScheme)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOpenApiManagedSecurityScheme(document.RootElement, options); + } + + internal static OpenApiManagedSecurityScheme DeserializeOpenApiManagedSecurityScheme(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string audience = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("audience"u8)) + { + audience = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OpenApiManagedSecurityScheme(audience, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(OpenApiManagedSecurityScheme)} does not support writing '{options.Format}' format."); + } + } + + OpenApiManagedSecurityScheme IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOpenApiManagedSecurityScheme(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OpenApiManagedSecurityScheme)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static OpenApiManagedSecurityScheme FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOpenApiManagedSecurityScheme(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiManagedSecurityScheme.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiManagedSecurityScheme.cs new file mode 100644 index 000000000000..710744c7d014 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiManagedSecurityScheme.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Security scheme for OpenApi managed_identity authentication. + public partial class OpenApiManagedSecurityScheme + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Authentication scope for managed_identity auth type. + /// is null. + public OpenApiManagedSecurityScheme(string audience) + { + Argument.AssertNotNull(audience, nameof(audience)); + + Audience = audience; + } + + /// Initializes a new instance of . + /// Authentication scope for managed_identity auth type. + /// Keeps track of any properties unknown to the library. + internal OpenApiManagedSecurityScheme(string audience, IDictionary serializedAdditionalRawData) + { + Audience = audience; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OpenApiManagedSecurityScheme() + { + } + + /// Authentication scope for managed_identity auth type. + public string Audience { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiToolDefinition.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiToolDefinition.Serialization.cs new file mode 100644 index 000000000000..186867ee557e --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiToolDefinition.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class OpenApiToolDefinition : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiToolDefinition)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("openapi"u8); + writer.WriteObjectValue(Openapi, options); + } + + OpenApiToolDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiToolDefinition)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOpenApiToolDefinition(document.RootElement, options); + } + + internal static OpenApiToolDefinition DeserializeOpenApiToolDefinition(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + OpenApiFunctionDefinition openapi = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("openapi"u8)) + { + openapi = OpenApiFunctionDefinition.DeserializeOpenApiFunctionDefinition(property.Value, options); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OpenApiToolDefinition(type, serializedAdditionalRawData, openapi); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(OpenApiToolDefinition)} does not support writing '{options.Format}' format."); + } + } + + OpenApiToolDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOpenApiToolDefinition(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OpenApiToolDefinition)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new OpenApiToolDefinition FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOpenApiToolDefinition(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiToolDefinition.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiToolDefinition.cs new file mode 100644 index 000000000000..5b2758b26ffb --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/OpenApiToolDefinition.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The input definition information for an OpenAPI tool as used to configure an agent. + public partial class OpenApiToolDefinition : ToolDefinition + { + /// Initializes a new instance of . + /// The openapi function definition. + /// is null. + public OpenApiToolDefinition(OpenApiFunctionDefinition openapi) + { + Argument.AssertNotNull(openapi, nameof(openapi)); + + Type = "openapi"; + Openapi = openapi; + } + + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + /// The openapi function definition. + internal OpenApiToolDefinition(string type, IDictionary serializedAdditionalRawData, OpenApiFunctionDefinition openapi) : base(type, serializedAdditionalRawData) + { + Openapi = openapi; + } + + /// Initializes a new instance of for deserialization. + internal OpenApiToolDefinition() + { + } + + /// The openapi function definition. + public OpenApiFunctionDefinition Openapi { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RequiredAction.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RequiredAction.Serialization.cs new file mode 100644 index 000000000000..b89b36d4e97f --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RequiredAction.Serialization.cs @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + [PersistableModelProxy(typeof(UnknownRequiredAction))] + public partial class RequiredAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RequiredAction)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RequiredAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RequiredAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRequiredAction(document.RootElement, options); + } + + internal static RequiredAction DeserializeRequiredAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("type", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "submit_tool_outputs": return SubmitToolOutputsAction.DeserializeSubmitToolOutputsAction(element, options); + } + } + return UnknownRequiredAction.DeserializeUnknownRequiredAction(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RequiredAction)} does not support writing '{options.Format}' format."); + } + } + + RequiredAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRequiredAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RequiredAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RequiredAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRequiredAction(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RequiredAction.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RequiredAction.cs new file mode 100644 index 000000000000..5dcb84d31ec3 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RequiredAction.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// + /// An abstract representation of a required action for an agent thread run to continue. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + public abstract partial class RequiredAction + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + protected RequiredAction() + { + } + + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + internal RequiredAction(string type, IDictionary serializedAdditionalRawData) + { + Type = type; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The object type. + internal string Type { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RequiredFunctionToolCall.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RequiredFunctionToolCall.Serialization.cs new file mode 100644 index 000000000000..34cd0e9fe218 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RequiredFunctionToolCall.Serialization.cs @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class RequiredFunctionToolCall : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RequiredFunctionToolCall)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("function"u8); + writer.WriteObjectValue(InternalDetails, options); + } + + RequiredFunctionToolCall IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RequiredFunctionToolCall)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRequiredFunctionToolCall(document.RootElement, options); + } + + internal static RequiredFunctionToolCall DeserializeRequiredFunctionToolCall(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + InternalRequiredFunctionToolCallDetails function = default; + string type = default; + string id = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("function"u8)) + { + function = InternalRequiredFunctionToolCallDetails.DeserializeInternalRequiredFunctionToolCallDetails(property.Value, options); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RequiredFunctionToolCall(type, id, serializedAdditionalRawData, function); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RequiredFunctionToolCall)} does not support writing '{options.Format}' format."); + } + } + + RequiredFunctionToolCall IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRequiredFunctionToolCall(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RequiredFunctionToolCall)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new RequiredFunctionToolCall FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRequiredFunctionToolCall(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RequiredFunctionToolCall.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RequiredFunctionToolCall.cs new file mode 100644 index 000000000000..e337cc35b139 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RequiredFunctionToolCall.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// A representation of a requested call to a function tool, needed by the model to continue evaluation of a run. + public partial class RequiredFunctionToolCall : RequiredToolCall + { + /// Initializes a new instance of . + /// The ID of the tool call. This ID must be referenced when submitting tool outputs. + /// Detailed information about the function to be executed by the tool that includes name and arguments. + /// or is null. + internal RequiredFunctionToolCall(string id, InternalRequiredFunctionToolCallDetails internalDetails) : base(id) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(internalDetails, nameof(internalDetails)); + + Type = "function"; + InternalDetails = internalDetails; + } + + /// Initializes a new instance of . + /// The object type for the required tool call. + /// The ID of the tool call. This ID must be referenced when submitting tool outputs. + /// Keeps track of any properties unknown to the library. + /// Detailed information about the function to be executed by the tool that includes name and arguments. + internal RequiredFunctionToolCall(string type, string id, IDictionary serializedAdditionalRawData, InternalRequiredFunctionToolCallDetails internalDetails) : base(type, id, serializedAdditionalRawData) + { + InternalDetails = internalDetails; + } + + /// Initializes a new instance of for deserialization. + internal RequiredFunctionToolCall() + { + } + + /// Detailed information about the function to be executed by the tool that includes name and arguments. + public InternalRequiredFunctionToolCallDetails InternalDetails { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RequiredToolCall.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RequiredToolCall.Serialization.cs new file mode 100644 index 000000000000..fb0c490bf874 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RequiredToolCall.Serialization.cs @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + [PersistableModelProxy(typeof(UnknownRequiredToolCall))] + public partial class RequiredToolCall : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RequiredToolCall)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RequiredToolCall IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RequiredToolCall)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRequiredToolCall(document.RootElement, options); + } + + internal static RequiredToolCall DeserializeRequiredToolCall(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("type", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "function": return RequiredFunctionToolCall.DeserializeRequiredFunctionToolCall(element, options); + } + } + return UnknownRequiredToolCall.DeserializeUnknownRequiredToolCall(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RequiredToolCall)} does not support writing '{options.Format}' format."); + } + } + + RequiredToolCall IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRequiredToolCall(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RequiredToolCall)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RequiredToolCall FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRequiredToolCall(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RequiredToolCall.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RequiredToolCall.cs new file mode 100644 index 000000000000..42b0e3e91e43 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RequiredToolCall.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// + /// An abstract representation of a tool invocation needed by the model to continue a run. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + public abstract partial class RequiredToolCall + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The ID of the tool call. This ID must be referenced when submitting tool outputs. + /// is null. + protected RequiredToolCall(string id) + { + Argument.AssertNotNull(id, nameof(id)); + + Id = id; + } + + /// Initializes a new instance of . + /// The object type for the required tool call. + /// The ID of the tool call. This ID must be referenced when submitting tool outputs. + /// Keeps track of any properties unknown to the library. + internal RequiredToolCall(string type, string id, IDictionary serializedAdditionalRawData) + { + Type = type; + Id = id; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RequiredToolCall() + { + } + + /// The object type for the required tool call. + internal string Type { get; set; } + /// The ID of the tool call. This ID must be referenced when submitting tool outputs. + public string Id { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/ResponseFormat.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/ResponseFormat.cs new file mode 100644 index 000000000000..a789e84d616f --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/ResponseFormat.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// Possible API response formats. + public readonly partial struct ResponseFormat : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ResponseFormat(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string TextValue = "text"; + private const string JsonObjectValue = "json_object"; + + /// `text` format should be used for requests involving any sort of ToolCall. + public static ResponseFormat Text { get; } = new ResponseFormat(TextValue); + /// Using `json_object` format will limit the usage of ToolCall to only functions. + public static ResponseFormat JsonObject { get; } = new ResponseFormat(JsonObjectValue); + /// Determines if two values are the same. + public static bool operator ==(ResponseFormat left, ResponseFormat right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ResponseFormat left, ResponseFormat right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ResponseFormat(string value) => new ResponseFormat(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ResponseFormat other && Equals(other); + /// + public bool Equals(ResponseFormat other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/ResponseFormatJsonSchema.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/ResponseFormatJsonSchema.Serialization.cs new file mode 100644 index 000000000000..48b6126f676b --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/ResponseFormatJsonSchema.Serialization.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class ResponseFormatJsonSchema : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ResponseFormatJsonSchema)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WritePropertyName("schema"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(Schema); +#else + using (JsonDocument document = JsonDocument.Parse(Schema, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ResponseFormatJsonSchema IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ResponseFormatJsonSchema)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResponseFormatJsonSchema(document.RootElement, options); + } + + internal static ResponseFormatJsonSchema DeserializeResponseFormatJsonSchema(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string description = default; + string name = default; + BinaryData schema = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("schema"u8)) + { + schema = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ResponseFormatJsonSchema(description, name, schema, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ResponseFormatJsonSchema)} does not support writing '{options.Format}' format."); + } + } + + ResponseFormatJsonSchema IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeResponseFormatJsonSchema(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ResponseFormatJsonSchema)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ResponseFormatJsonSchema FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeResponseFormatJsonSchema(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/ResponseFormatJsonSchema.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/ResponseFormatJsonSchema.cs new file mode 100644 index 000000000000..89c4f0811b5f --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/ResponseFormatJsonSchema.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// A description of what the response format is for, used by the model to determine how to respond in the format. + public partial class ResponseFormatJsonSchema + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The name of a schema. + /// The JSON schema object, describing the response format. + /// or is null. + public ResponseFormatJsonSchema(string name, BinaryData schema) + { + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(schema, nameof(schema)); + + Name = name; + Schema = schema; + } + + /// Initializes a new instance of . + /// A description of what the response format is for, used by the model to determine how to respond in the format. + /// The name of a schema. + /// The JSON schema object, describing the response format. + /// Keeps track of any properties unknown to the library. + internal ResponseFormatJsonSchema(string description, string name, BinaryData schema, IDictionary serializedAdditionalRawData) + { + Description = description; + Name = name; + Schema = schema; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ResponseFormatJsonSchema() + { + } + + /// A description of what the response format is for, used by the model to determine how to respond in the format. + public string Description { get; set; } + /// The name of a schema. + public string Name { get; set; } + /// + /// The JSON schema object, describing the response format. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + public BinaryData Schema { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/ResponseFormatJsonSchemaType.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/ResponseFormatJsonSchemaType.Serialization.cs new file mode 100644 index 000000000000..9f9be396492b --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/ResponseFormatJsonSchemaType.Serialization.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class ResponseFormatJsonSchemaType : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ResponseFormatJsonSchemaType)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type.ToString()); + writer.WritePropertyName("json_schema"u8); + writer.WriteObjectValue(JsonSchema, options); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ResponseFormatJsonSchemaType IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ResponseFormatJsonSchemaType)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResponseFormatJsonSchemaType(document.RootElement, options); + } + + internal static ResponseFormatJsonSchemaType DeserializeResponseFormatJsonSchemaType(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResponseFormatJsonSchemaTypeType type = default; + ResponseFormatJsonSchema jsonSchema = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new ResponseFormatJsonSchemaTypeType(property.Value.GetString()); + continue; + } + if (property.NameEquals("json_schema"u8)) + { + jsonSchema = ResponseFormatJsonSchema.DeserializeResponseFormatJsonSchema(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ResponseFormatJsonSchemaType(type, jsonSchema, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ResponseFormatJsonSchemaType)} does not support writing '{options.Format}' format."); + } + } + + ResponseFormatJsonSchemaType IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeResponseFormatJsonSchemaType(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ResponseFormatJsonSchemaType)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ResponseFormatJsonSchemaType FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeResponseFormatJsonSchemaType(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/ResponseFormatJsonSchemaType.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/ResponseFormatJsonSchemaType.cs new file mode 100644 index 000000000000..6626762b9077 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/ResponseFormatJsonSchemaType.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The type of response format being defined: `json_schema`. + public partial class ResponseFormatJsonSchemaType + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The JSON schema, describing response format. + /// is null. + public ResponseFormatJsonSchemaType(ResponseFormatJsonSchema jsonSchema) + { + Argument.AssertNotNull(jsonSchema, nameof(jsonSchema)); + + JsonSchema = jsonSchema; + } + + /// Initializes a new instance of . + /// Type. + /// The JSON schema, describing response format. + /// Keeps track of any properties unknown to the library. + internal ResponseFormatJsonSchemaType(ResponseFormatJsonSchemaTypeType type, ResponseFormatJsonSchema jsonSchema, IDictionary serializedAdditionalRawData) + { + Type = type; + JsonSchema = jsonSchema; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ResponseFormatJsonSchemaType() + { + } + + /// Type. + public ResponseFormatJsonSchemaTypeType Type { get; } = ResponseFormatJsonSchemaTypeType.JsonSchema; + + /// The JSON schema, describing response format. + public ResponseFormatJsonSchema JsonSchema { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/ResponseFormatJsonSchemaTypeType.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/ResponseFormatJsonSchemaTypeType.cs new file mode 100644 index 000000000000..f1c6f353c10f --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/ResponseFormatJsonSchemaTypeType.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// The ResponseFormatJsonSchemaType_type. + public readonly partial struct ResponseFormatJsonSchemaTypeType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ResponseFormatJsonSchemaTypeType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string JsonSchemaValue = "json_schema"; + + /// json_schema. + public static ResponseFormatJsonSchemaTypeType JsonSchema { get; } = new ResponseFormatJsonSchemaTypeType(JsonSchemaValue); + /// Determines if two values are the same. + public static bool operator ==(ResponseFormatJsonSchemaTypeType left, ResponseFormatJsonSchemaTypeType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ResponseFormatJsonSchemaTypeType left, ResponseFormatJsonSchemaTypeType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ResponseFormatJsonSchemaTypeType(string value) => new ResponseFormatJsonSchemaTypeType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ResponseFormatJsonSchemaTypeType other && Equals(other); + /// + public bool Equals(ResponseFormatJsonSchemaTypeType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunAdditionalFieldList.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunAdditionalFieldList.cs new file mode 100644 index 000000000000..33f4a8b881a4 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunAdditionalFieldList.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// A list of additional fields to include in the response. + public readonly partial struct RunAdditionalFieldList : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RunAdditionalFieldList(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string FileSearchContentsValue = "step_details.tool_calls[*].file_search.results[*].content"; + + /// File search result content. + public static RunAdditionalFieldList FileSearchContents { get; } = new RunAdditionalFieldList(FileSearchContentsValue); + /// Determines if two values are the same. + public static bool operator ==(RunAdditionalFieldList left, RunAdditionalFieldList right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RunAdditionalFieldList left, RunAdditionalFieldList right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator RunAdditionalFieldList(string value) => new RunAdditionalFieldList(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RunAdditionalFieldList other && Equals(other); + /// + public bool Equals(RunAdditionalFieldList other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunCompletionUsage.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunCompletionUsage.Serialization.cs new file mode 100644 index 000000000000..e7c3b8c11951 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunCompletionUsage.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class RunCompletionUsage : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunCompletionUsage)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("completion_tokens"u8); + writer.WriteNumberValue(CompletionTokens); + writer.WritePropertyName("prompt_tokens"u8); + writer.WriteNumberValue(PromptTokens); + writer.WritePropertyName("total_tokens"u8); + writer.WriteNumberValue(TotalTokens); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RunCompletionUsage IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunCompletionUsage)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunCompletionUsage(document.RootElement, options); + } + + internal static RunCompletionUsage DeserializeRunCompletionUsage(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + long completionTokens = default; + long promptTokens = default; + long totalTokens = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("completion_tokens"u8)) + { + completionTokens = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("prompt_tokens"u8)) + { + promptTokens = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("total_tokens"u8)) + { + totalTokens = property.Value.GetInt64(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RunCompletionUsage(completionTokens, promptTokens, totalTokens, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunCompletionUsage)} does not support writing '{options.Format}' format."); + } + } + + RunCompletionUsage IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunCompletionUsage(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunCompletionUsage)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RunCompletionUsage FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunCompletionUsage(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunCompletionUsage.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunCompletionUsage.cs new file mode 100644 index 000000000000..2887bbf36705 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunCompletionUsage.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Usage statistics related to the run. This value will be `null` if the run is not in a terminal state (i.e. `in_progress`, `queued`, etc.). + public partial class RunCompletionUsage + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Number of completion tokens used over the course of the run. + /// Number of prompt tokens used over the course of the run. + /// Total number of tokens used (prompt + completion). + internal RunCompletionUsage(long completionTokens, long promptTokens, long totalTokens) + { + CompletionTokens = completionTokens; + PromptTokens = promptTokens; + TotalTokens = totalTokens; + } + + /// Initializes a new instance of . + /// Number of completion tokens used over the course of the run. + /// Number of prompt tokens used over the course of the run. + /// Total number of tokens used (prompt + completion). + /// Keeps track of any properties unknown to the library. + internal RunCompletionUsage(long completionTokens, long promptTokens, long totalTokens, IDictionary serializedAdditionalRawData) + { + CompletionTokens = completionTokens; + PromptTokens = promptTokens; + TotalTokens = totalTokens; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RunCompletionUsage() + { + } + + /// Number of completion tokens used over the course of the run. + public long CompletionTokens { get; } + /// Number of prompt tokens used over the course of the run. + public long PromptTokens { get; } + /// Total number of tokens used (prompt + completion). + public long TotalTokens { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunError.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunError.Serialization.cs new file mode 100644 index 000000000000..b04eda7d16de --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunError.Serialization.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class RunError : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunError)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code); + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RunError IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunError)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunError(document.RootElement, options); + } + + internal static RunError DeserializeRunError(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string code = default; + string message = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("code"u8)) + { + code = property.Value.GetString(); + continue; + } + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RunError(code, message, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunError)} does not support writing '{options.Format}' format."); + } + } + + RunError IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunError(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunError)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RunError FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunError(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunError.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunError.cs new file mode 100644 index 000000000000..6599e9f1d2e9 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunError.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The details of an error as encountered by an agent thread run. + public partial class RunError + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The status for the error. + /// The human-readable text associated with the error. + /// or is null. + internal RunError(string code, string message) + { + Argument.AssertNotNull(code, nameof(code)); + Argument.AssertNotNull(message, nameof(message)); + + Code = code; + Message = message; + } + + /// Initializes a new instance of . + /// The status for the error. + /// The human-readable text associated with the error. + /// Keeps track of any properties unknown to the library. + internal RunError(string code, string message, IDictionary serializedAdditionalRawData) + { + Code = code; + Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RunError() + { + } + + /// The status for the error. + public string Code { get; } + /// The human-readable text associated with the error. + public string Message { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStatus.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStatus.cs new file mode 100644 index 000000000000..1514f9409fab --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStatus.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// Possible values for the status of an agent thread run. + public readonly partial struct RunStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RunStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string QueuedValue = "queued"; + private const string InProgressValue = "in_progress"; + private const string RequiresActionValue = "requires_action"; + private const string CancellingValue = "cancelling"; + private const string CancelledValue = "cancelled"; + private const string FailedValue = "failed"; + private const string CompletedValue = "completed"; + private const string ExpiredValue = "expired"; + + /// Represents a run that is queued to start. + public static RunStatus Queued { get; } = new RunStatus(QueuedValue); + /// Represents a run that is in progress. + public static RunStatus InProgress { get; } = new RunStatus(InProgressValue); + /// Represents a run that needs another operation, such as tool output submission, to continue. + public static RunStatus RequiresAction { get; } = new RunStatus(RequiresActionValue); + /// Represents a run that is in the process of cancellation. + public static RunStatus Cancelling { get; } = new RunStatus(CancellingValue); + /// Represents a run that has been cancelled. + public static RunStatus Cancelled { get; } = new RunStatus(CancelledValue); + /// Represents a run that failed. + public static RunStatus Failed { get; } = new RunStatus(FailedValue); + /// Represents a run that successfully completed. + public static RunStatus Completed { get; } = new RunStatus(CompletedValue); + /// Represents a run that expired before it could otherwise finish. + public static RunStatus Expired { get; } = new RunStatus(ExpiredValue); + /// Determines if two values are the same. + public static bool operator ==(RunStatus left, RunStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RunStatus left, RunStatus right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator RunStatus(string value) => new RunStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RunStatus other && Equals(other); + /// + public bool Equals(RunStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStep.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStep.Serialization.cs new file mode 100644 index 000000000000..da90637d802c --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStep.Serialization.cs @@ -0,0 +1,377 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class RunStep : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStep)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("object"u8); + writer.WriteStringValue(Object.ToString()); + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type.ToString()); + writer.WritePropertyName("assistant_id"u8); + writer.WriteStringValue(AssistantId); + writer.WritePropertyName("thread_id"u8); + writer.WriteStringValue(ThreadId); + writer.WritePropertyName("run_id"u8); + writer.WriteStringValue(RunId); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + writer.WritePropertyName("step_details"u8); + writer.WriteObjectValue(StepDetails, options); + if (LastError != null) + { + writer.WritePropertyName("last_error"u8); + writer.WriteObjectValue(LastError, options); + } + else + { + writer.WriteNull("last_error"); + } + writer.WritePropertyName("created_at"u8); + writer.WriteNumberValue(CreatedAt, "U"); + if (ExpiredAt != null) + { + writer.WritePropertyName("expired_at"u8); + writer.WriteNumberValue(ExpiredAt.Value, "U"); + } + else + { + writer.WriteNull("expired_at"); + } + if (CompletedAt != null) + { + writer.WritePropertyName("completed_at"u8); + writer.WriteNumberValue(CompletedAt.Value, "U"); + } + else + { + writer.WriteNull("completed_at"); + } + if (CancelledAt != null) + { + writer.WritePropertyName("cancelled_at"u8); + writer.WriteNumberValue(CancelledAt.Value, "U"); + } + else + { + writer.WriteNull("cancelled_at"); + } + if (FailedAt != null) + { + writer.WritePropertyName("failed_at"u8); + writer.WriteNumberValue(FailedAt.Value, "U"); + } + else + { + writer.WriteNull("failed_at"); + } + if (Optional.IsDefined(Usage)) + { + if (Usage != null) + { + writer.WritePropertyName("usage"u8); + writer.WriteObjectValue(Usage, options); + } + else + { + writer.WriteNull("usage"); + } + } + if (Metadata != null && Optional.IsCollectionDefined(Metadata)) + { + writer.WritePropertyName("metadata"u8); + writer.WriteStartObject(); + foreach (var item in Metadata) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + else + { + writer.WriteNull("metadata"); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RunStep IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStep)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStep(document.RootElement, options); + } + + internal static RunStep DeserializeRunStep(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + RunStepObject @object = default; + RunStepType type = default; + string assistantId = default; + string threadId = default; + string runId = default; + RunStepStatus status = default; + RunStepDetails stepDetails = default; + RunStepError lastError = default; + DateTimeOffset createdAt = default; + DateTimeOffset? expiredAt = default; + DateTimeOffset? completedAt = default; + DateTimeOffset? cancelledAt = default; + DateTimeOffset? failedAt = default; + RunStepCompletionUsage usage = default; + IReadOnlyDictionary metadata = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("object"u8)) + { + @object = new RunStepObject(property.Value.GetString()); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new RunStepType(property.Value.GetString()); + continue; + } + if (property.NameEquals("assistant_id"u8)) + { + assistantId = property.Value.GetString(); + continue; + } + if (property.NameEquals("thread_id"u8)) + { + threadId = property.Value.GetString(); + continue; + } + if (property.NameEquals("run_id"u8)) + { + runId = property.Value.GetString(); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new RunStepStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("step_details"u8)) + { + stepDetails = RunStepDetails.DeserializeRunStepDetails(property.Value, options); + continue; + } + if (property.NameEquals("last_error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + lastError = null; + continue; + } + lastError = RunStepError.DeserializeRunStepError(property.Value, options); + continue; + } + if (property.NameEquals("created_at"u8)) + { + createdAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); + continue; + } + if (property.NameEquals("expired_at"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + expiredAt = null; + continue; + } + expiredAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); + continue; + } + if (property.NameEquals("completed_at"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + completedAt = null; + continue; + } + completedAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); + continue; + } + if (property.NameEquals("cancelled_at"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + cancelledAt = null; + continue; + } + cancelledAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); + continue; + } + if (property.NameEquals("failed_at"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + failedAt = null; + continue; + } + failedAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); + continue; + } + if (property.NameEquals("usage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + usage = null; + continue; + } + usage = RunStepCompletionUsage.DeserializeRunStepCompletionUsage(property.Value, options); + continue; + } + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + metadata = new ChangeTrackingDictionary(); + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + metadata = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RunStep( + id, + @object, + type, + assistantId, + threadId, + runId, + status, + stepDetails, + lastError, + createdAt, + expiredAt, + completedAt, + cancelledAt, + failedAt, + usage, + metadata, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStep)} does not support writing '{options.Format}' format."); + } + } + + RunStep IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStep(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStep)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RunStep FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStep(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStep.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStep.cs new file mode 100644 index 000000000000..d57598079c05 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStep.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Detailed information about a single step of an agent thread run. + public partial class RunStep + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The identifier, which can be referenced in API endpoints. + /// The type of run step, which can be either message_creation or tool_calls. + /// The ID of the agent associated with the run step. + /// The ID of the thread that was run. + /// The ID of the run that this run step is a part of. + /// The status of this run step. + /// + /// The details for this run step. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// If applicable, information about the last error encountered by this run step. + /// The Unix timestamp, in seconds, representing when this object was created. + /// The Unix timestamp, in seconds, representing when this item expired. + /// The Unix timestamp, in seconds, representing when this completed. + /// The Unix timestamp, in seconds, representing when this was cancelled. + /// The Unix timestamp, in seconds, representing when this failed. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// , , , or is null. + internal RunStep(string id, RunStepType type, string assistantId, string threadId, string runId, RunStepStatus status, RunStepDetails stepDetails, RunStepError lastError, DateTimeOffset createdAt, DateTimeOffset? expiredAt, DateTimeOffset? completedAt, DateTimeOffset? cancelledAt, DateTimeOffset? failedAt, IReadOnlyDictionary metadata) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(assistantId, nameof(assistantId)); + Argument.AssertNotNull(threadId, nameof(threadId)); + Argument.AssertNotNull(runId, nameof(runId)); + Argument.AssertNotNull(stepDetails, nameof(stepDetails)); + + Id = id; + Type = type; + AssistantId = assistantId; + ThreadId = threadId; + RunId = runId; + Status = status; + StepDetails = stepDetails; + LastError = lastError; + CreatedAt = createdAt; + ExpiredAt = expiredAt; + CompletedAt = completedAt; + CancelledAt = cancelledAt; + FailedAt = failedAt; + Metadata = metadata; + } + + /// Initializes a new instance of . + /// The identifier, which can be referenced in API endpoints. + /// The object type, which is always 'thread.run.step'. + /// The type of run step, which can be either message_creation or tool_calls. + /// The ID of the agent associated with the run step. + /// The ID of the thread that was run. + /// The ID of the run that this run step is a part of. + /// The status of this run step. + /// + /// The details for this run step. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// If applicable, information about the last error encountered by this run step. + /// The Unix timestamp, in seconds, representing when this object was created. + /// The Unix timestamp, in seconds, representing when this item expired. + /// The Unix timestamp, in seconds, representing when this completed. + /// The Unix timestamp, in seconds, representing when this was cancelled. + /// The Unix timestamp, in seconds, representing when this failed. + /// Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// Keeps track of any properties unknown to the library. + internal RunStep(string id, RunStepObject @object, RunStepType type, string assistantId, string threadId, string runId, RunStepStatus status, RunStepDetails stepDetails, RunStepError lastError, DateTimeOffset createdAt, DateTimeOffset? expiredAt, DateTimeOffset? completedAt, DateTimeOffset? cancelledAt, DateTimeOffset? failedAt, RunStepCompletionUsage usage, IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) + { + Id = id; + Object = @object; + Type = type; + AssistantId = assistantId; + ThreadId = threadId; + RunId = runId; + Status = status; + StepDetails = stepDetails; + LastError = lastError; + CreatedAt = createdAt; + ExpiredAt = expiredAt; + CompletedAt = completedAt; + CancelledAt = cancelledAt; + FailedAt = failedAt; + Usage = usage; + Metadata = metadata; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RunStep() + { + } + + /// The identifier, which can be referenced in API endpoints. + public string Id { get; } + /// The object type, which is always 'thread.run.step'. + public RunStepObject Object { get; } = RunStepObject.ThreadRunStep; + + /// The type of run step, which can be either message_creation or tool_calls. + public RunStepType Type { get; } + /// The ID of the agent associated with the run step. + public string AssistantId { get; } + /// The ID of the thread that was run. + public string ThreadId { get; } + /// The ID of the run that this run step is a part of. + public string RunId { get; } + /// The status of this run step. + public RunStepStatus Status { get; } + /// + /// The details for this run step. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public RunStepDetails StepDetails { get; } + /// If applicable, information about the last error encountered by this run step. + public RunStepError LastError { get; } + /// The Unix timestamp, in seconds, representing when this object was created. + public DateTimeOffset CreatedAt { get; } + /// The Unix timestamp, in seconds, representing when this item expired. + public DateTimeOffset? ExpiredAt { get; } + /// The Unix timestamp, in seconds, representing when this completed. + public DateTimeOffset? CompletedAt { get; } + /// The Unix timestamp, in seconds, representing when this was cancelled. + public DateTimeOffset? CancelledAt { get; } + /// The Unix timestamp, in seconds, representing when this failed. + public DateTimeOffset? FailedAt { get; } + /// Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`. + public RunStepCompletionUsage Usage { get; } + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + public IReadOnlyDictionary Metadata { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepAzureAISearchToolCall.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepAzureAISearchToolCall.Serialization.cs new file mode 100644 index 000000000000..8dea098428a4 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepAzureAISearchToolCall.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class RunStepAzureAISearchToolCall : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepAzureAISearchToolCall)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("azure_ai_search"u8); + writer.WriteStartObject(); + foreach (var item in AzureAISearch) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + + RunStepAzureAISearchToolCall IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepAzureAISearchToolCall)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepAzureAISearchToolCall(document.RootElement, options); + } + + internal static RunStepAzureAISearchToolCall DeserializeRunStepAzureAISearchToolCall(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyDictionary azureAiSearch = default; + string type = default; + string id = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("azure_ai_search"u8)) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + azureAiSearch = dictionary; + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RunStepAzureAISearchToolCall(type, id, serializedAdditionalRawData, azureAiSearch); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepAzureAISearchToolCall)} does not support writing '{options.Format}' format."); + } + } + + RunStepAzureAISearchToolCall IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepAzureAISearchToolCall(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepAzureAISearchToolCall)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new RunStepAzureAISearchToolCall FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepAzureAISearchToolCall(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepAzureAISearchToolCall.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepAzureAISearchToolCall.cs new file mode 100644 index 000000000000..fe6a062ead21 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepAzureAISearchToolCall.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// + /// A record of a call to an Azure AI Search tool, issued by the model in evaluation of a defined tool, that represents + /// executed Azure AI search. + /// + public partial class RunStepAzureAISearchToolCall : RunStepToolCall + { + /// Initializes a new instance of . + /// The ID of the tool call. This ID must be referenced when you submit tool outputs. + /// Reserved for future use. + /// or is null. + internal RunStepAzureAISearchToolCall(string id, IReadOnlyDictionary azureAISearch) : base(id) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(azureAISearch, nameof(azureAISearch)); + + Type = "azure_ai_search"; + AzureAISearch = azureAISearch; + } + + /// Initializes a new instance of . + /// The object type. + /// The ID of the tool call. This ID must be referenced when you submit tool outputs. + /// Keeps track of any properties unknown to the library. + /// Reserved for future use. + internal RunStepAzureAISearchToolCall(string type, string id, IDictionary serializedAdditionalRawData, IReadOnlyDictionary azureAISearch) : base(type, id, serializedAdditionalRawData) + { + AzureAISearch = azureAISearch; + } + + /// Initializes a new instance of for deserialization. + internal RunStepAzureAISearchToolCall() + { + } + + /// Reserved for future use. + public IReadOnlyDictionary AzureAISearch { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepBingGroundingToolCall.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepBingGroundingToolCall.Serialization.cs new file mode 100644 index 000000000000..5a6ed566afa0 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepBingGroundingToolCall.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class RunStepBingGroundingToolCall : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepBingGroundingToolCall)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("bing_grounding"u8); + writer.WriteStartObject(); + foreach (var item in BingGrounding) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + + RunStepBingGroundingToolCall IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepBingGroundingToolCall)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepBingGroundingToolCall(document.RootElement, options); + } + + internal static RunStepBingGroundingToolCall DeserializeRunStepBingGroundingToolCall(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyDictionary bingGrounding = default; + string type = default; + string id = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("bing_grounding"u8)) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + bingGrounding = dictionary; + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RunStepBingGroundingToolCall(type, id, serializedAdditionalRawData, bingGrounding); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepBingGroundingToolCall)} does not support writing '{options.Format}' format."); + } + } + + RunStepBingGroundingToolCall IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepBingGroundingToolCall(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepBingGroundingToolCall)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new RunStepBingGroundingToolCall FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepBingGroundingToolCall(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepBingGroundingToolCall.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepBingGroundingToolCall.cs new file mode 100644 index 000000000000..b23d430a932b --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepBingGroundingToolCall.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// + /// A record of a call to a bing grounding tool, issued by the model in evaluation of a defined tool, that represents + /// executed search with bing grounding. + /// + public partial class RunStepBingGroundingToolCall : RunStepToolCall + { + /// Initializes a new instance of . + /// The ID of the tool call. This ID must be referenced when you submit tool outputs. + /// Reserved for future use. + /// or is null. + internal RunStepBingGroundingToolCall(string id, IReadOnlyDictionary bingGrounding) : base(id) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(bingGrounding, nameof(bingGrounding)); + + Type = "bing_grounding"; + BingGrounding = bingGrounding; + } + + /// Initializes a new instance of . + /// The object type. + /// The ID of the tool call. This ID must be referenced when you submit tool outputs. + /// Keeps track of any properties unknown to the library. + /// Reserved for future use. + internal RunStepBingGroundingToolCall(string type, string id, IDictionary serializedAdditionalRawData, IReadOnlyDictionary bingGrounding) : base(type, id, serializedAdditionalRawData) + { + BingGrounding = bingGrounding; + } + + /// Initializes a new instance of for deserialization. + internal RunStepBingGroundingToolCall() + { + } + + /// Reserved for future use. + public IReadOnlyDictionary BingGrounding { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterImageOutput.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterImageOutput.Serialization.cs new file mode 100644 index 000000000000..5df1c09c7d9a --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterImageOutput.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class RunStepCodeInterpreterImageOutput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepCodeInterpreterImageOutput)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("image"u8); + writer.WriteObjectValue(Image, options); + } + + RunStepCodeInterpreterImageOutput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepCodeInterpreterImageOutput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepCodeInterpreterImageOutput(document.RootElement, options); + } + + internal static RunStepCodeInterpreterImageOutput DeserializeRunStepCodeInterpreterImageOutput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RunStepCodeInterpreterImageReference image = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("image"u8)) + { + image = RunStepCodeInterpreterImageReference.DeserializeRunStepCodeInterpreterImageReference(property.Value, options); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RunStepCodeInterpreterImageOutput(type, serializedAdditionalRawData, image); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepCodeInterpreterImageOutput)} does not support writing '{options.Format}' format."); + } + } + + RunStepCodeInterpreterImageOutput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepCodeInterpreterImageOutput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepCodeInterpreterImageOutput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new RunStepCodeInterpreterImageOutput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepCodeInterpreterImageOutput(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterImageOutput.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterImageOutput.cs new file mode 100644 index 000000000000..7cf468a44be0 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterImageOutput.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// A representation of an image output emitted by a code interpreter tool in response to a tool call by the model. + internal partial class RunStepCodeInterpreterImageOutput : RunStepCodeInterpreterToolCallOutput + { + /// Initializes a new instance of . + /// Referential information for the image associated with this output. + /// is null. + internal RunStepCodeInterpreterImageOutput(RunStepCodeInterpreterImageReference image) + { + Argument.AssertNotNull(image, nameof(image)); + + Type = "image"; + Image = image; + } + + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + /// Referential information for the image associated with this output. + internal RunStepCodeInterpreterImageOutput(string type, IDictionary serializedAdditionalRawData, RunStepCodeInterpreterImageReference image) : base(type, serializedAdditionalRawData) + { + Image = image; + } + + /// Initializes a new instance of for deserialization. + internal RunStepCodeInterpreterImageOutput() + { + } + + /// Referential information for the image associated with this output. + public RunStepCodeInterpreterImageReference Image { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterImageReference.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterImageReference.Serialization.cs new file mode 100644 index 000000000000..583a821d0c69 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterImageReference.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class RunStepCodeInterpreterImageReference : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepCodeInterpreterImageReference)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("file_id"u8); + writer.WriteStringValue(FileId); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RunStepCodeInterpreterImageReference IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepCodeInterpreterImageReference)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepCodeInterpreterImageReference(document.RootElement, options); + } + + internal static RunStepCodeInterpreterImageReference DeserializeRunStepCodeInterpreterImageReference(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string fileId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("file_id"u8)) + { + fileId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RunStepCodeInterpreterImageReference(fileId, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepCodeInterpreterImageReference)} does not support writing '{options.Format}' format."); + } + } + + RunStepCodeInterpreterImageReference IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepCodeInterpreterImageReference(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepCodeInterpreterImageReference)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RunStepCodeInterpreterImageReference FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepCodeInterpreterImageReference(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterImageReference.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterImageReference.cs new file mode 100644 index 000000000000..99fff3342d9f --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterImageReference.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// An image reference emitted by a code interpreter tool in response to a tool call by the model. + internal partial class RunStepCodeInterpreterImageReference + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The ID of the file associated with this image. + /// is null. + internal RunStepCodeInterpreterImageReference(string fileId) + { + Argument.AssertNotNull(fileId, nameof(fileId)); + + FileId = fileId; + } + + /// Initializes a new instance of . + /// The ID of the file associated with this image. + /// Keeps track of any properties unknown to the library. + internal RunStepCodeInterpreterImageReference(string fileId, IDictionary serializedAdditionalRawData) + { + FileId = fileId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RunStepCodeInterpreterImageReference() + { + } + + /// The ID of the file associated with this image. + public string FileId { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterLogOutput.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterLogOutput.Serialization.cs new file mode 100644 index 000000000000..86be08e2bdf6 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterLogOutput.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class RunStepCodeInterpreterLogOutput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepCodeInterpreterLogOutput)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("logs"u8); + writer.WriteStringValue(Logs); + } + + RunStepCodeInterpreterLogOutput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepCodeInterpreterLogOutput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepCodeInterpreterLogOutput(document.RootElement, options); + } + + internal static RunStepCodeInterpreterLogOutput DeserializeRunStepCodeInterpreterLogOutput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string logs = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("logs"u8)) + { + logs = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RunStepCodeInterpreterLogOutput(type, serializedAdditionalRawData, logs); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepCodeInterpreterLogOutput)} does not support writing '{options.Format}' format."); + } + } + + RunStepCodeInterpreterLogOutput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepCodeInterpreterLogOutput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepCodeInterpreterLogOutput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new RunStepCodeInterpreterLogOutput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepCodeInterpreterLogOutput(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterLogOutput.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterLogOutput.cs new file mode 100644 index 000000000000..bcfaca297cf1 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterLogOutput.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// A representation of a log output emitted by a code interpreter tool in response to a tool call by the model. + internal partial class RunStepCodeInterpreterLogOutput : RunStepCodeInterpreterToolCallOutput + { + /// Initializes a new instance of . + /// The serialized log output emitted by the code interpreter. + /// is null. + internal RunStepCodeInterpreterLogOutput(string logs) + { + Argument.AssertNotNull(logs, nameof(logs)); + + Type = "logs"; + Logs = logs; + } + + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + /// The serialized log output emitted by the code interpreter. + internal RunStepCodeInterpreterLogOutput(string type, IDictionary serializedAdditionalRawData, string logs) : base(type, serializedAdditionalRawData) + { + Logs = logs; + } + + /// Initializes a new instance of for deserialization. + internal RunStepCodeInterpreterLogOutput() + { + } + + /// The serialized log output emitted by the code interpreter. + public string Logs { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterToolCall.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterToolCall.Serialization.cs new file mode 100644 index 000000000000..79b85f2bef8c --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterToolCall.Serialization.cs @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class RunStepCodeInterpreterToolCall : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepCodeInterpreterToolCall)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("code_interpreter"u8); + writer.WriteObjectValue(InternalDetails, options); + } + + RunStepCodeInterpreterToolCall IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepCodeInterpreterToolCall)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepCodeInterpreterToolCall(document.RootElement, options); + } + + internal static RunStepCodeInterpreterToolCall DeserializeRunStepCodeInterpreterToolCall(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + InternalCodeInterpreterToolCallDetails codeInterpreter = default; + string type = default; + string id = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("code_interpreter"u8)) + { + codeInterpreter = InternalCodeInterpreterToolCallDetails.DeserializeInternalCodeInterpreterToolCallDetails(property.Value, options); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RunStepCodeInterpreterToolCall(type, id, serializedAdditionalRawData, codeInterpreter); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepCodeInterpreterToolCall)} does not support writing '{options.Format}' format."); + } + } + + RunStepCodeInterpreterToolCall IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepCodeInterpreterToolCall(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepCodeInterpreterToolCall)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new RunStepCodeInterpreterToolCall FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepCodeInterpreterToolCall(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterToolCall.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterToolCall.cs new file mode 100644 index 000000000000..c478a801017d --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterToolCall.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// + /// A record of a call to a code interpreter tool, issued by the model in evaluation of a defined tool, that + /// represents inputs and outputs consumed and emitted by the code interpreter. + /// + public partial class RunStepCodeInterpreterToolCall : RunStepToolCall + { + /// Initializes a new instance of . + /// The ID of the tool call. This ID must be referenced when you submit tool outputs. + /// The details of the tool call to the code interpreter tool. + /// or is null. + internal RunStepCodeInterpreterToolCall(string id, InternalCodeInterpreterToolCallDetails internalDetails) : base(id) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(internalDetails, nameof(internalDetails)); + + Type = "code_interpreter"; + InternalDetails = internalDetails; + } + + /// Initializes a new instance of . + /// The object type. + /// The ID of the tool call. This ID must be referenced when you submit tool outputs. + /// Keeps track of any properties unknown to the library. + /// The details of the tool call to the code interpreter tool. + internal RunStepCodeInterpreterToolCall(string type, string id, IDictionary serializedAdditionalRawData, InternalCodeInterpreterToolCallDetails internalDetails) : base(type, id, serializedAdditionalRawData) + { + InternalDetails = internalDetails; + } + + /// Initializes a new instance of for deserialization. + internal RunStepCodeInterpreterToolCall() + { + } + + /// The details of the tool call to the code interpreter tool. + public InternalCodeInterpreterToolCallDetails InternalDetails { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterToolCallOutput.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterToolCallOutput.Serialization.cs new file mode 100644 index 000000000000..bc66c44e4eb8 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterToolCallOutput.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + [PersistableModelProxy(typeof(UnknownRunStepCodeInterpreterToolCallOutput))] + internal partial class RunStepCodeInterpreterToolCallOutput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepCodeInterpreterToolCallOutput)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RunStepCodeInterpreterToolCallOutput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepCodeInterpreterToolCallOutput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepCodeInterpreterToolCallOutput(document.RootElement, options); + } + + internal static RunStepCodeInterpreterToolCallOutput DeserializeRunStepCodeInterpreterToolCallOutput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("type", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "image": return RunStepCodeInterpreterImageOutput.DeserializeRunStepCodeInterpreterImageOutput(element, options); + case "logs": return RunStepCodeInterpreterLogOutput.DeserializeRunStepCodeInterpreterLogOutput(element, options); + } + } + return UnknownRunStepCodeInterpreterToolCallOutput.DeserializeUnknownRunStepCodeInterpreterToolCallOutput(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepCodeInterpreterToolCallOutput)} does not support writing '{options.Format}' format."); + } + } + + RunStepCodeInterpreterToolCallOutput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepCodeInterpreterToolCallOutput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepCodeInterpreterToolCallOutput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RunStepCodeInterpreterToolCallOutput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepCodeInterpreterToolCallOutput(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterToolCallOutput.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterToolCallOutput.cs new file mode 100644 index 000000000000..7234469c204e --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCodeInterpreterToolCallOutput.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// + /// An abstract representation of an emitted output from a code interpreter tool. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + internal abstract partial class RunStepCodeInterpreterToolCallOutput + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + protected RunStepCodeInterpreterToolCallOutput() + { + } + + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + internal RunStepCodeInterpreterToolCallOutput(string type, IDictionary serializedAdditionalRawData) + { + Type = type; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The object type. + internal string Type { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCompletionUsage.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCompletionUsage.Serialization.cs new file mode 100644 index 000000000000..0f45ad1d9bc9 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCompletionUsage.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class RunStepCompletionUsage : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepCompletionUsage)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("completion_tokens"u8); + writer.WriteNumberValue(CompletionTokens); + writer.WritePropertyName("prompt_tokens"u8); + writer.WriteNumberValue(PromptTokens); + writer.WritePropertyName("total_tokens"u8); + writer.WriteNumberValue(TotalTokens); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RunStepCompletionUsage IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepCompletionUsage)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepCompletionUsage(document.RootElement, options); + } + + internal static RunStepCompletionUsage DeserializeRunStepCompletionUsage(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + long completionTokens = default; + long promptTokens = default; + long totalTokens = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("completion_tokens"u8)) + { + completionTokens = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("prompt_tokens"u8)) + { + promptTokens = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("total_tokens"u8)) + { + totalTokens = property.Value.GetInt64(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RunStepCompletionUsage(completionTokens, promptTokens, totalTokens, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepCompletionUsage)} does not support writing '{options.Format}' format."); + } + } + + RunStepCompletionUsage IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepCompletionUsage(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepCompletionUsage)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RunStepCompletionUsage FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepCompletionUsage(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCompletionUsage.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCompletionUsage.cs new file mode 100644 index 000000000000..5d36b203a4cd --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepCompletionUsage.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Usage statistics related to the run step. + public partial class RunStepCompletionUsage + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Number of completion tokens used over the course of the run step. + /// Number of prompt tokens used over the course of the run step. + /// Total number of tokens used (prompt + completion). + internal RunStepCompletionUsage(long completionTokens, long promptTokens, long totalTokens) + { + CompletionTokens = completionTokens; + PromptTokens = promptTokens; + TotalTokens = totalTokens; + } + + /// Initializes a new instance of . + /// Number of completion tokens used over the course of the run step. + /// Number of prompt tokens used over the course of the run step. + /// Total number of tokens used (prompt + completion). + /// Keeps track of any properties unknown to the library. + internal RunStepCompletionUsage(long completionTokens, long promptTokens, long totalTokens, IDictionary serializedAdditionalRawData) + { + CompletionTokens = completionTokens; + PromptTokens = promptTokens; + TotalTokens = totalTokens; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RunStepCompletionUsage() + { + } + + /// Number of completion tokens used over the course of the run step. + public long CompletionTokens { get; } + /// Number of prompt tokens used over the course of the run step. + public long PromptTokens { get; } + /// Total number of tokens used (prompt + completion). + public long TotalTokens { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDelta.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDelta.Serialization.cs new file mode 100644 index 000000000000..1cd543d03a73 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDelta.Serialization.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class RunStepDelta : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDelta)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(StepDetails)) + { + writer.WritePropertyName("step_details"u8); + writer.WriteObjectValue(StepDetails, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RunStepDelta IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDelta)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepDelta(document.RootElement, options); + } + + internal static RunStepDelta DeserializeRunStepDelta(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RunStepDeltaDetail stepDetails = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("step_details"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + stepDetails = RunStepDeltaDetail.DeserializeRunStepDeltaDetail(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RunStepDelta(stepDetails, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepDelta)} does not support writing '{options.Format}' format."); + } + } + + RunStepDelta IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDelta(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepDelta)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RunStepDelta FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDelta(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDelta.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDelta.cs new file mode 100644 index 000000000000..d8df6223cf1b --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDelta.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Represents the delta payload in a streaming run step delta chunk. + public partial class RunStepDelta + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal RunStepDelta() + { + } + + /// Initializes a new instance of . + /// + /// The details of the run step. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// Keeps track of any properties unknown to the library. + internal RunStepDelta(RunStepDeltaDetail stepDetails, IDictionary serializedAdditionalRawData) + { + StepDetails = stepDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// + /// The details of the run step. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public RunStepDeltaDetail StepDetails { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaChunk.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaChunk.Serialization.cs new file mode 100644 index 000000000000..67872f372efb --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaChunk.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class RunStepDeltaChunk : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaChunk)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("object"u8); + writer.WriteStringValue(Object.ToString()); + writer.WritePropertyName("delta"u8); + writer.WriteObjectValue(Delta, options); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RunStepDeltaChunk IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaChunk)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepDeltaChunk(document.RootElement, options); + } + + internal static RunStepDeltaChunk DeserializeRunStepDeltaChunk(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + RunStepDeltaChunkObject @object = default; + RunStepDelta delta = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("object"u8)) + { + @object = new RunStepDeltaChunkObject(property.Value.GetString()); + continue; + } + if (property.NameEquals("delta"u8)) + { + delta = RunStepDelta.DeserializeRunStepDelta(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RunStepDeltaChunk(id, @object, delta, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepDeltaChunk)} does not support writing '{options.Format}' format."); + } + } + + RunStepDeltaChunk IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDeltaChunk(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepDeltaChunk)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RunStepDeltaChunk FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDeltaChunk(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaChunk.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaChunk.cs new file mode 100644 index 000000000000..428b5f8e0900 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaChunk.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Represents a run step delta i.e. any changed fields on a run step during streaming. + public partial class RunStepDeltaChunk + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The identifier of the run step, which can be referenced in API endpoints. + /// The delta containing the fields that have changed on the run step. + /// or is null. + internal RunStepDeltaChunk(string id, RunStepDelta delta) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(delta, nameof(delta)); + + Id = id; + Delta = delta; + } + + /// Initializes a new instance of . + /// The identifier of the run step, which can be referenced in API endpoints. + /// The object type, which is always `thread.run.step.delta`. + /// The delta containing the fields that have changed on the run step. + /// Keeps track of any properties unknown to the library. + internal RunStepDeltaChunk(string id, RunStepDeltaChunkObject @object, RunStepDelta delta, IDictionary serializedAdditionalRawData) + { + Id = id; + Object = @object; + Delta = delta; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RunStepDeltaChunk() + { + } + + /// The identifier of the run step, which can be referenced in API endpoints. + public string Id { get; } + /// The object type, which is always `thread.run.step.delta`. + public RunStepDeltaChunkObject Object { get; } = RunStepDeltaChunkObject.ThreadRunStepDelta; + + /// The delta containing the fields that have changed on the run step. + public RunStepDelta Delta { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaChunkObject.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaChunkObject.cs new file mode 100644 index 000000000000..59e65002024e --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaChunkObject.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// The RunStepDeltaChunk_object. + public readonly partial struct RunStepDeltaChunkObject : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RunStepDeltaChunkObject(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ThreadRunStepDeltaValue = "thread.run.step.delta"; + + /// thread.run.step.delta. + public static RunStepDeltaChunkObject ThreadRunStepDelta { get; } = new RunStepDeltaChunkObject(ThreadRunStepDeltaValue); + /// Determines if two values are the same. + public static bool operator ==(RunStepDeltaChunkObject left, RunStepDeltaChunkObject right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RunStepDeltaChunkObject left, RunStepDeltaChunkObject right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator RunStepDeltaChunkObject(string value) => new RunStepDeltaChunkObject(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RunStepDeltaChunkObject other && Equals(other); + /// + public bool Equals(RunStepDeltaChunkObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterDetailItemObject.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterDetailItemObject.Serialization.cs new file mode 100644 index 000000000000..82e0d8babb5e --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterDetailItemObject.Serialization.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class RunStepDeltaCodeInterpreterDetailItemObject : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterDetailItemObject)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Input)) + { + writer.WritePropertyName("input"u8); + writer.WriteStringValue(Input); + } + if (Optional.IsCollectionDefined(Outputs)) + { + writer.WritePropertyName("outputs"u8); + writer.WriteStartArray(); + foreach (var item in Outputs) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RunStepDeltaCodeInterpreterDetailItemObject IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterDetailItemObject)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepDeltaCodeInterpreterDetailItemObject(document.RootElement, options); + } + + internal static RunStepDeltaCodeInterpreterDetailItemObject DeserializeRunStepDeltaCodeInterpreterDetailItemObject(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string input = default; + IReadOnlyList outputs = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("input"u8)) + { + input = property.Value.GetString(); + continue; + } + if (property.NameEquals("outputs"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(RunStepDeltaCodeInterpreterOutput.DeserializeRunStepDeltaCodeInterpreterOutput(item, options)); + } + outputs = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RunStepDeltaCodeInterpreterDetailItemObject(input, outputs ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterDetailItemObject)} does not support writing '{options.Format}' format."); + } + } + + RunStepDeltaCodeInterpreterDetailItemObject IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDeltaCodeInterpreterDetailItemObject(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterDetailItemObject)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RunStepDeltaCodeInterpreterDetailItemObject FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDeltaCodeInterpreterDetailItemObject(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterDetailItemObject.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterDetailItemObject.cs new file mode 100644 index 000000000000..ac7da135e34b --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterDetailItemObject.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Represents the Code Interpreter tool call data in a streaming run step's tool calls. + public partial class RunStepDeltaCodeInterpreterDetailItemObject + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal RunStepDeltaCodeInterpreterDetailItemObject() + { + Outputs = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The input into the Code Interpreter tool call. + /// + /// The outputs from the Code Interpreter tool call. Code Interpreter can output one or more + /// items, including text (`logs`) or images (`image`). Each of these are represented by a + /// different object type. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// Keeps track of any properties unknown to the library. + internal RunStepDeltaCodeInterpreterDetailItemObject(string input, IReadOnlyList outputs, IDictionary serializedAdditionalRawData) + { + Input = input; + Outputs = outputs; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The input into the Code Interpreter tool call. + public string Input { get; } + /// + /// The outputs from the Code Interpreter tool call. Code Interpreter can output one or more + /// items, including text (`logs`) or images (`image`). Each of these are represented by a + /// different object type. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public IReadOnlyList Outputs { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterImageOutput.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterImageOutput.Serialization.cs new file mode 100644 index 000000000000..43de6418cf59 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterImageOutput.Serialization.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class RunStepDeltaCodeInterpreterImageOutput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterImageOutput)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Image)) + { + writer.WritePropertyName("image"u8); + writer.WriteObjectValue(Image, options); + } + } + + RunStepDeltaCodeInterpreterImageOutput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterImageOutput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepDeltaCodeInterpreterImageOutput(document.RootElement, options); + } + + internal static RunStepDeltaCodeInterpreterImageOutput DeserializeRunStepDeltaCodeInterpreterImageOutput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RunStepDeltaCodeInterpreterImageOutputObject image = default; + int index = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("image"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + image = RunStepDeltaCodeInterpreterImageOutputObject.DeserializeRunStepDeltaCodeInterpreterImageOutputObject(property.Value, options); + continue; + } + if (property.NameEquals("index"u8)) + { + index = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RunStepDeltaCodeInterpreterImageOutput(index, type, serializedAdditionalRawData, image); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterImageOutput)} does not support writing '{options.Format}' format."); + } + } + + RunStepDeltaCodeInterpreterImageOutput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDeltaCodeInterpreterImageOutput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterImageOutput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new RunStepDeltaCodeInterpreterImageOutput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDeltaCodeInterpreterImageOutput(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterImageOutput.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterImageOutput.cs new file mode 100644 index 000000000000..6e5d79285bf3 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterImageOutput.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Represents an image output as produced the Code interpreter tool and as represented in a streaming run step's delta tool calls collection. + public partial class RunStepDeltaCodeInterpreterImageOutput : RunStepDeltaCodeInterpreterOutput + { + /// Initializes a new instance of . + /// The index of the output in the streaming run step tool call's Code Interpreter outputs array. + internal RunStepDeltaCodeInterpreterImageOutput(int index) : base(index) + { + Type = "image"; + } + + /// Initializes a new instance of . + /// The index of the output in the streaming run step tool call's Code Interpreter outputs array. + /// The type of the streaming run step tool call's Code Interpreter output. + /// Keeps track of any properties unknown to the library. + /// The image data for the Code Interpreter tool call output. + internal RunStepDeltaCodeInterpreterImageOutput(int index, string type, IDictionary serializedAdditionalRawData, RunStepDeltaCodeInterpreterImageOutputObject image) : base(index, type, serializedAdditionalRawData) + { + Image = image; + } + + /// Initializes a new instance of for deserialization. + internal RunStepDeltaCodeInterpreterImageOutput() + { + } + + /// The image data for the Code Interpreter tool call output. + public RunStepDeltaCodeInterpreterImageOutputObject Image { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterImageOutputObject.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterImageOutputObject.Serialization.cs new file mode 100644 index 000000000000..86d0956dd47f --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterImageOutputObject.Serialization.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class RunStepDeltaCodeInterpreterImageOutputObject : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterImageOutputObject)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(FileId)) + { + writer.WritePropertyName("file_id"u8); + writer.WriteStringValue(FileId); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RunStepDeltaCodeInterpreterImageOutputObject IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterImageOutputObject)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepDeltaCodeInterpreterImageOutputObject(document.RootElement, options); + } + + internal static RunStepDeltaCodeInterpreterImageOutputObject DeserializeRunStepDeltaCodeInterpreterImageOutputObject(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string fileId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("file_id"u8)) + { + fileId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RunStepDeltaCodeInterpreterImageOutputObject(fileId, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterImageOutputObject)} does not support writing '{options.Format}' format."); + } + } + + RunStepDeltaCodeInterpreterImageOutputObject IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDeltaCodeInterpreterImageOutputObject(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterImageOutputObject)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RunStepDeltaCodeInterpreterImageOutputObject FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDeltaCodeInterpreterImageOutputObject(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterImageOutputObject.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterImageOutputObject.cs new file mode 100644 index 000000000000..64cd498d4240 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterImageOutputObject.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Represents the data for a streaming run step's Code Interpreter tool call image output. + public partial class RunStepDeltaCodeInterpreterImageOutputObject + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal RunStepDeltaCodeInterpreterImageOutputObject() + { + } + + /// Initializes a new instance of . + /// The file ID for the image. + /// Keeps track of any properties unknown to the library. + internal RunStepDeltaCodeInterpreterImageOutputObject(string fileId, IDictionary serializedAdditionalRawData) + { + FileId = fileId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The file ID for the image. + public string FileId { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterLogOutput.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterLogOutput.Serialization.cs new file mode 100644 index 000000000000..71c7423aa07c --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterLogOutput.Serialization.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class RunStepDeltaCodeInterpreterLogOutput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterLogOutput)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Logs)) + { + writer.WritePropertyName("logs"u8); + writer.WriteStringValue(Logs); + } + } + + RunStepDeltaCodeInterpreterLogOutput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterLogOutput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepDeltaCodeInterpreterLogOutput(document.RootElement, options); + } + + internal static RunStepDeltaCodeInterpreterLogOutput DeserializeRunStepDeltaCodeInterpreterLogOutput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string logs = default; + int index = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("logs"u8)) + { + logs = property.Value.GetString(); + continue; + } + if (property.NameEquals("index"u8)) + { + index = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RunStepDeltaCodeInterpreterLogOutput(index, type, serializedAdditionalRawData, logs); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterLogOutput)} does not support writing '{options.Format}' format."); + } + } + + RunStepDeltaCodeInterpreterLogOutput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDeltaCodeInterpreterLogOutput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterLogOutput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new RunStepDeltaCodeInterpreterLogOutput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDeltaCodeInterpreterLogOutput(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterLogOutput.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterLogOutput.cs new file mode 100644 index 000000000000..d830226153cc --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterLogOutput.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Represents a log output as produced by the Code Interpreter tool and as represented in a streaming run step's delta tool calls collection. + public partial class RunStepDeltaCodeInterpreterLogOutput : RunStepDeltaCodeInterpreterOutput + { + /// Initializes a new instance of . + /// The index of the output in the streaming run step tool call's Code Interpreter outputs array. + internal RunStepDeltaCodeInterpreterLogOutput(int index) : base(index) + { + Type = "logs"; + } + + /// Initializes a new instance of . + /// The index of the output in the streaming run step tool call's Code Interpreter outputs array. + /// The type of the streaming run step tool call's Code Interpreter output. + /// Keeps track of any properties unknown to the library. + /// The text output from the Code Interpreter tool call. + internal RunStepDeltaCodeInterpreterLogOutput(int index, string type, IDictionary serializedAdditionalRawData, string logs) : base(index, type, serializedAdditionalRawData) + { + Logs = logs; + } + + /// Initializes a new instance of for deserialization. + internal RunStepDeltaCodeInterpreterLogOutput() + { + } + + /// The text output from the Code Interpreter tool call. + public string Logs { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterOutput.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterOutput.Serialization.cs new file mode 100644 index 000000000000..9a0628fc5379 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterOutput.Serialization.cs @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + [PersistableModelProxy(typeof(UnknownRunStepDeltaCodeInterpreterOutput))] + public partial class RunStepDeltaCodeInterpreterOutput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterOutput)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("index"u8); + writer.WriteNumberValue(Index); + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RunStepDeltaCodeInterpreterOutput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterOutput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepDeltaCodeInterpreterOutput(document.RootElement, options); + } + + internal static RunStepDeltaCodeInterpreterOutput DeserializeRunStepDeltaCodeInterpreterOutput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("type", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "image": return RunStepDeltaCodeInterpreterImageOutput.DeserializeRunStepDeltaCodeInterpreterImageOutput(element, options); + case "logs": return RunStepDeltaCodeInterpreterLogOutput.DeserializeRunStepDeltaCodeInterpreterLogOutput(element, options); + } + } + return UnknownRunStepDeltaCodeInterpreterOutput.DeserializeUnknownRunStepDeltaCodeInterpreterOutput(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterOutput)} does not support writing '{options.Format}' format."); + } + } + + RunStepDeltaCodeInterpreterOutput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDeltaCodeInterpreterOutput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterOutput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RunStepDeltaCodeInterpreterOutput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDeltaCodeInterpreterOutput(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterOutput.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterOutput.cs new file mode 100644 index 000000000000..a5b51f7a0d16 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterOutput.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// + /// The abstract base representation of a streaming run step tool call's Code Interpreter tool output. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public abstract partial class RunStepDeltaCodeInterpreterOutput + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The index of the output in the streaming run step tool call's Code Interpreter outputs array. + protected RunStepDeltaCodeInterpreterOutput(int index) + { + Index = index; + } + + /// Initializes a new instance of . + /// The index of the output in the streaming run step tool call's Code Interpreter outputs array. + /// The type of the streaming run step tool call's Code Interpreter output. + /// Keeps track of any properties unknown to the library. + internal RunStepDeltaCodeInterpreterOutput(int index, string type, IDictionary serializedAdditionalRawData) + { + Index = index; + Type = type; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RunStepDeltaCodeInterpreterOutput() + { + } + + /// The index of the output in the streaming run step tool call's Code Interpreter outputs array. + public int Index { get; } + /// The type of the streaming run step tool call's Code Interpreter output. + internal string Type { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterToolCall.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterToolCall.Serialization.cs new file mode 100644 index 000000000000..1630a05538ba --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterToolCall.Serialization.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class RunStepDeltaCodeInterpreterToolCall : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterToolCall)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(CodeInterpreter)) + { + writer.WritePropertyName("code_interpreter"u8); + writer.WriteObjectValue(CodeInterpreter, options); + } + } + + RunStepDeltaCodeInterpreterToolCall IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterToolCall)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepDeltaCodeInterpreterToolCall(document.RootElement, options); + } + + internal static RunStepDeltaCodeInterpreterToolCall DeserializeRunStepDeltaCodeInterpreterToolCall(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RunStepDeltaCodeInterpreterDetailItemObject codeInterpreter = default; + int index = default; + string id = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("code_interpreter"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + codeInterpreter = RunStepDeltaCodeInterpreterDetailItemObject.DeserializeRunStepDeltaCodeInterpreterDetailItemObject(property.Value, options); + continue; + } + if (property.NameEquals("index"u8)) + { + index = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RunStepDeltaCodeInterpreterToolCall(index, id, type, serializedAdditionalRawData, codeInterpreter); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterToolCall)} does not support writing '{options.Format}' format."); + } + } + + RunStepDeltaCodeInterpreterToolCall IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDeltaCodeInterpreterToolCall(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterToolCall)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new RunStepDeltaCodeInterpreterToolCall FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDeltaCodeInterpreterToolCall(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterToolCall.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterToolCall.cs new file mode 100644 index 000000000000..4fcdb5335f8d --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaCodeInterpreterToolCall.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Represents a Code Interpreter tool call within a streaming run step's tool call details. + public partial class RunStepDeltaCodeInterpreterToolCall : RunStepDeltaToolCall + { + /// Initializes a new instance of . + /// The index of the tool call detail in the run step's tool_calls array. + /// The ID of the tool call, used when submitting outputs to the run. + /// is null. + internal RunStepDeltaCodeInterpreterToolCall(int index, string id) : base(index, id) + { + Argument.AssertNotNull(id, nameof(id)); + + Type = "code_interpreter"; + } + + /// Initializes a new instance of . + /// The index of the tool call detail in the run step's tool_calls array. + /// The ID of the tool call, used when submitting outputs to the run. + /// The type of the tool call detail item in a streaming run step's details. + /// Keeps track of any properties unknown to the library. + /// The Code Interpreter data for the tool call. + internal RunStepDeltaCodeInterpreterToolCall(int index, string id, string type, IDictionary serializedAdditionalRawData, RunStepDeltaCodeInterpreterDetailItemObject codeInterpreter) : base(index, id, type, serializedAdditionalRawData) + { + CodeInterpreter = codeInterpreter; + } + + /// Initializes a new instance of for deserialization. + internal RunStepDeltaCodeInterpreterToolCall() + { + } + + /// The Code Interpreter data for the tool call. + public RunStepDeltaCodeInterpreterDetailItemObject CodeInterpreter { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaDetail.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaDetail.Serialization.cs new file mode 100644 index 000000000000..89b8cce705bc --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaDetail.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + [PersistableModelProxy(typeof(UnknownRunStepDeltaDetail))] + public partial class RunStepDeltaDetail : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaDetail)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RunStepDeltaDetail IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaDetail)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepDeltaDetail(document.RootElement, options); + } + + internal static RunStepDeltaDetail DeserializeRunStepDeltaDetail(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("type", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "message_creation": return RunStepDeltaMessageCreation.DeserializeRunStepDeltaMessageCreation(element, options); + case "tool_calls": return RunStepDeltaToolCallObject.DeserializeRunStepDeltaToolCallObject(element, options); + } + } + return UnknownRunStepDeltaDetail.DeserializeUnknownRunStepDeltaDetail(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepDeltaDetail)} does not support writing '{options.Format}' format."); + } + } + + RunStepDeltaDetail IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDeltaDetail(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepDeltaDetail)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RunStepDeltaDetail FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDeltaDetail(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaDetail.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaDetail.cs new file mode 100644 index 000000000000..835120fd9e7a --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaDetail.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// + /// Represents a single run step detail item in a streaming run step's delta payload. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public abstract partial class RunStepDeltaDetail + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + protected RunStepDeltaDetail() + { + } + + /// Initializes a new instance of . + /// The object type for the run step detail object. + /// Keeps track of any properties unknown to the library. + internal RunStepDeltaDetail(string type, IDictionary serializedAdditionalRawData) + { + Type = type; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The object type for the run step detail object. + internal string Type { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaFileSearchToolCall.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaFileSearchToolCall.Serialization.cs new file mode 100644 index 000000000000..e7e746030839 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaFileSearchToolCall.Serialization.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class RunStepDeltaFileSearchToolCall : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaFileSearchToolCall)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(FileSearch)) + { + writer.WritePropertyName("file_search"u8); + writer.WriteObjectValue(FileSearch, options); + } + } + + RunStepDeltaFileSearchToolCall IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaFileSearchToolCall)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepDeltaFileSearchToolCall(document.RootElement, options); + } + + internal static RunStepDeltaFileSearchToolCall DeserializeRunStepDeltaFileSearchToolCall(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RunStepFileSearchToolCallResults fileSearch = default; + int index = default; + string id = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("file_search"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + fileSearch = RunStepFileSearchToolCallResults.DeserializeRunStepFileSearchToolCallResults(property.Value, options); + continue; + } + if (property.NameEquals("index"u8)) + { + index = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RunStepDeltaFileSearchToolCall(index, id, type, serializedAdditionalRawData, fileSearch); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepDeltaFileSearchToolCall)} does not support writing '{options.Format}' format."); + } + } + + RunStepDeltaFileSearchToolCall IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDeltaFileSearchToolCall(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepDeltaFileSearchToolCall)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new RunStepDeltaFileSearchToolCall FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDeltaFileSearchToolCall(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaFileSearchToolCall.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaFileSearchToolCall.cs new file mode 100644 index 000000000000..779124492b74 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaFileSearchToolCall.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Represents a file search tool call within a streaming run step's tool call details. + public partial class RunStepDeltaFileSearchToolCall : RunStepDeltaToolCall + { + /// Initializes a new instance of . + /// The index of the tool call detail in the run step's tool_calls array. + /// The ID of the tool call, used when submitting outputs to the run. + /// is null. + internal RunStepDeltaFileSearchToolCall(int index, string id) : base(index, id) + { + Argument.AssertNotNull(id, nameof(id)); + + Type = "file_search"; + } + + /// Initializes a new instance of . + /// The index of the tool call detail in the run step's tool_calls array. + /// The ID of the tool call, used when submitting outputs to the run. + /// The type of the tool call detail item in a streaming run step's details. + /// Keeps track of any properties unknown to the library. + /// Reserved for future use. + internal RunStepDeltaFileSearchToolCall(int index, string id, string type, IDictionary serializedAdditionalRawData, RunStepFileSearchToolCallResults fileSearch) : base(index, id, type, serializedAdditionalRawData) + { + FileSearch = fileSearch; + } + + /// Initializes a new instance of for deserialization. + internal RunStepDeltaFileSearchToolCall() + { + } + + /// Reserved for future use. + public RunStepFileSearchToolCallResults FileSearch { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaFunction.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaFunction.Serialization.cs new file mode 100644 index 000000000000..a3215edb18c2 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaFunction.Serialization.cs @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class RunStepDeltaFunction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaFunction)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Arguments)) + { + writer.WritePropertyName("arguments"u8); + writer.WriteStringValue(Arguments); + } + if (Optional.IsDefined(Output)) + { + if (Output != null) + { + writer.WritePropertyName("output"u8); + writer.WriteStringValue(Output); + } + else + { + writer.WriteNull("output"); + } + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RunStepDeltaFunction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaFunction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepDeltaFunction(document.RootElement, options); + } + + internal static RunStepDeltaFunction DeserializeRunStepDeltaFunction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string arguments = default; + string output = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("arguments"u8)) + { + arguments = property.Value.GetString(); + continue; + } + if (property.NameEquals("output"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + output = null; + continue; + } + output = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RunStepDeltaFunction(name, arguments, output, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepDeltaFunction)} does not support writing '{options.Format}' format."); + } + } + + RunStepDeltaFunction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDeltaFunction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepDeltaFunction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RunStepDeltaFunction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDeltaFunction(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaFunction.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaFunction.cs new file mode 100644 index 000000000000..423474b74d36 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaFunction.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Represents the function data in a streaming run step delta's function tool call. + public partial class RunStepDeltaFunction + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal RunStepDeltaFunction() + { + } + + /// Initializes a new instance of . + /// The name of the function. + /// The arguments passed to the function as input. + /// The output of the function, null if outputs have not yet been submitted. + /// Keeps track of any properties unknown to the library. + internal RunStepDeltaFunction(string name, string arguments, string output, IDictionary serializedAdditionalRawData) + { + Name = name; + Arguments = arguments; + Output = output; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The name of the function. + public string Name { get; } + /// The arguments passed to the function as input. + public string Arguments { get; } + /// The output of the function, null if outputs have not yet been submitted. + public string Output { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaFunctionToolCall.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaFunctionToolCall.Serialization.cs new file mode 100644 index 000000000000..5968c400bdd6 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaFunctionToolCall.Serialization.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class RunStepDeltaFunctionToolCall : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaFunctionToolCall)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Function)) + { + writer.WritePropertyName("function"u8); + writer.WriteObjectValue(Function, options); + } + } + + RunStepDeltaFunctionToolCall IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaFunctionToolCall)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepDeltaFunctionToolCall(document.RootElement, options); + } + + internal static RunStepDeltaFunctionToolCall DeserializeRunStepDeltaFunctionToolCall(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RunStepDeltaFunction function = default; + int index = default; + string id = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("function"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + function = RunStepDeltaFunction.DeserializeRunStepDeltaFunction(property.Value, options); + continue; + } + if (property.NameEquals("index"u8)) + { + index = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RunStepDeltaFunctionToolCall(index, id, type, serializedAdditionalRawData, function); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepDeltaFunctionToolCall)} does not support writing '{options.Format}' format."); + } + } + + RunStepDeltaFunctionToolCall IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDeltaFunctionToolCall(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepDeltaFunctionToolCall)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new RunStepDeltaFunctionToolCall FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDeltaFunctionToolCall(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaFunctionToolCall.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaFunctionToolCall.cs new file mode 100644 index 000000000000..322907b885a9 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaFunctionToolCall.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Represents a function tool call within a streaming run step's tool call details. + public partial class RunStepDeltaFunctionToolCall : RunStepDeltaToolCall + { + /// Initializes a new instance of . + /// The index of the tool call detail in the run step's tool_calls array. + /// The ID of the tool call, used when submitting outputs to the run. + /// is null. + internal RunStepDeltaFunctionToolCall(int index, string id) : base(index, id) + { + Argument.AssertNotNull(id, nameof(id)); + + Type = "function"; + } + + /// Initializes a new instance of . + /// The index of the tool call detail in the run step's tool_calls array. + /// The ID of the tool call, used when submitting outputs to the run. + /// The type of the tool call detail item in a streaming run step's details. + /// Keeps track of any properties unknown to the library. + /// The function data for the tool call. + internal RunStepDeltaFunctionToolCall(int index, string id, string type, IDictionary serializedAdditionalRawData, RunStepDeltaFunction function) : base(index, id, type, serializedAdditionalRawData) + { + Function = function; + } + + /// Initializes a new instance of for deserialization. + internal RunStepDeltaFunctionToolCall() + { + } + + /// The function data for the tool call. + public RunStepDeltaFunction Function { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaMessageCreation.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaMessageCreation.Serialization.cs new file mode 100644 index 000000000000..5d39943d3c88 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaMessageCreation.Serialization.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class RunStepDeltaMessageCreation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaMessageCreation)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(MessageCreation)) + { + writer.WritePropertyName("message_creation"u8); + writer.WriteObjectValue(MessageCreation, options); + } + } + + RunStepDeltaMessageCreation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaMessageCreation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepDeltaMessageCreation(document.RootElement, options); + } + + internal static RunStepDeltaMessageCreation DeserializeRunStepDeltaMessageCreation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RunStepDeltaMessageCreationObject messageCreation = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("message_creation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + messageCreation = RunStepDeltaMessageCreationObject.DeserializeRunStepDeltaMessageCreationObject(property.Value, options); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RunStepDeltaMessageCreation(type, serializedAdditionalRawData, messageCreation); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepDeltaMessageCreation)} does not support writing '{options.Format}' format."); + } + } + + RunStepDeltaMessageCreation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDeltaMessageCreation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepDeltaMessageCreation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new RunStepDeltaMessageCreation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDeltaMessageCreation(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaMessageCreation.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaMessageCreation.cs new file mode 100644 index 000000000000..f2a699d42170 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaMessageCreation.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Represents a message creation within a streaming run step delta. + public partial class RunStepDeltaMessageCreation : RunStepDeltaDetail + { + /// Initializes a new instance of . + internal RunStepDeltaMessageCreation() + { + Type = "message_creation"; + } + + /// Initializes a new instance of . + /// The object type for the run step detail object. + /// Keeps track of any properties unknown to the library. + /// The message creation data. + internal RunStepDeltaMessageCreation(string type, IDictionary serializedAdditionalRawData, RunStepDeltaMessageCreationObject messageCreation) : base(type, serializedAdditionalRawData) + { + MessageCreation = messageCreation; + } + + /// The message creation data. + public RunStepDeltaMessageCreationObject MessageCreation { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaMessageCreationObject.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaMessageCreationObject.Serialization.cs new file mode 100644 index 000000000000..0c731cf60aae --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaMessageCreationObject.Serialization.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class RunStepDeltaMessageCreationObject : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaMessageCreationObject)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(MessageId)) + { + writer.WritePropertyName("message_id"u8); + writer.WriteStringValue(MessageId); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RunStepDeltaMessageCreationObject IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaMessageCreationObject)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepDeltaMessageCreationObject(document.RootElement, options); + } + + internal static RunStepDeltaMessageCreationObject DeserializeRunStepDeltaMessageCreationObject(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string messageId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("message_id"u8)) + { + messageId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RunStepDeltaMessageCreationObject(messageId, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepDeltaMessageCreationObject)} does not support writing '{options.Format}' format."); + } + } + + RunStepDeltaMessageCreationObject IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDeltaMessageCreationObject(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepDeltaMessageCreationObject)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RunStepDeltaMessageCreationObject FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDeltaMessageCreationObject(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaMessageCreationObject.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaMessageCreationObject.cs new file mode 100644 index 000000000000..e5ede8778d31 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaMessageCreationObject.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Represents the data within a streaming run step message creation response object. + public partial class RunStepDeltaMessageCreationObject + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal RunStepDeltaMessageCreationObject() + { + } + + /// Initializes a new instance of . + /// The ID of the newly-created message. + /// Keeps track of any properties unknown to the library. + internal RunStepDeltaMessageCreationObject(string messageId, IDictionary serializedAdditionalRawData) + { + MessageId = messageId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The ID of the newly-created message. + public string MessageId { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaToolCall.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaToolCall.Serialization.cs new file mode 100644 index 000000000000..2a7f7f281498 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaToolCall.Serialization.cs @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + [PersistableModelProxy(typeof(UnknownRunStepDeltaToolCall))] + public partial class RunStepDeltaToolCall : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaToolCall)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("index"u8); + writer.WriteNumberValue(Index); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RunStepDeltaToolCall IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaToolCall)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepDeltaToolCall(document.RootElement, options); + } + + internal static RunStepDeltaToolCall DeserializeRunStepDeltaToolCall(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("type", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "code_interpreter": return RunStepDeltaCodeInterpreterToolCall.DeserializeRunStepDeltaCodeInterpreterToolCall(element, options); + case "file_search": return RunStepDeltaFileSearchToolCall.DeserializeRunStepDeltaFileSearchToolCall(element, options); + case "function": return RunStepDeltaFunctionToolCall.DeserializeRunStepDeltaFunctionToolCall(element, options); + } + } + return UnknownRunStepDeltaToolCall.DeserializeUnknownRunStepDeltaToolCall(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepDeltaToolCall)} does not support writing '{options.Format}' format."); + } + } + + RunStepDeltaToolCall IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDeltaToolCall(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepDeltaToolCall)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RunStepDeltaToolCall FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDeltaToolCall(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaToolCall.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaToolCall.cs new file mode 100644 index 000000000000..7c9615c9cec4 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaToolCall.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// + /// The abstract base representation of a single tool call within a streaming run step's delta tool call details. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + public abstract partial class RunStepDeltaToolCall + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The index of the tool call detail in the run step's tool_calls array. + /// The ID of the tool call, used when submitting outputs to the run. + /// is null. + protected RunStepDeltaToolCall(int index, string id) + { + Argument.AssertNotNull(id, nameof(id)); + + Index = index; + Id = id; + } + + /// Initializes a new instance of . + /// The index of the tool call detail in the run step's tool_calls array. + /// The ID of the tool call, used when submitting outputs to the run. + /// The type of the tool call detail item in a streaming run step's details. + /// Keeps track of any properties unknown to the library. + internal RunStepDeltaToolCall(int index, string id, string type, IDictionary serializedAdditionalRawData) + { + Index = index; + Id = id; + Type = type; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RunStepDeltaToolCall() + { + } + + /// The index of the tool call detail in the run step's tool_calls array. + public int Index { get; } + /// The ID of the tool call, used when submitting outputs to the run. + public string Id { get; } + /// The type of the tool call detail item in a streaming run step's details. + internal string Type { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaToolCallObject.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaToolCallObject.Serialization.cs new file mode 100644 index 000000000000..1f10dad1a1aa --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaToolCallObject.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class RunStepDeltaToolCallObject : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaToolCallObject)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsCollectionDefined(ToolCalls)) + { + writer.WritePropertyName("tool_calls"u8); + writer.WriteStartArray(); + foreach (var item in ToolCalls) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + } + + RunStepDeltaToolCallObject IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaToolCallObject)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepDeltaToolCallObject(document.RootElement, options); + } + + internal static RunStepDeltaToolCallObject DeserializeRunStepDeltaToolCallObject(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList toolCalls = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tool_calls"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(RunStepDeltaToolCall.DeserializeRunStepDeltaToolCall(item, options)); + } + toolCalls = array; + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RunStepDeltaToolCallObject(type, serializedAdditionalRawData, toolCalls ?? new ChangeTrackingList()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepDeltaToolCallObject)} does not support writing '{options.Format}' format."); + } + } + + RunStepDeltaToolCallObject IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDeltaToolCallObject(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepDeltaToolCallObject)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new RunStepDeltaToolCallObject FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDeltaToolCallObject(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaToolCallObject.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaToolCallObject.cs new file mode 100644 index 000000000000..483464bfaa85 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDeltaToolCallObject.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Represents an invocation of tool calls as part of a streaming run step. + public partial class RunStepDeltaToolCallObject : RunStepDeltaDetail + { + /// Initializes a new instance of . + internal RunStepDeltaToolCallObject() + { + Type = "tool_calls"; + ToolCalls = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The object type for the run step detail object. + /// Keeps track of any properties unknown to the library. + /// + /// The collection of tool calls for the tool call detail item. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + internal RunStepDeltaToolCallObject(string type, IDictionary serializedAdditionalRawData, IReadOnlyList toolCalls) : base(type, serializedAdditionalRawData) + { + ToolCalls = toolCalls; + } + + /// + /// The collection of tool calls for the tool call detail item. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + public IReadOnlyList ToolCalls { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDetails.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDetails.Serialization.cs new file mode 100644 index 000000000000..15157ebc8caf --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDetails.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + [PersistableModelProxy(typeof(UnknownRunStepDetails))] + public partial class RunStepDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDetails)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RunStepDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepDetails(document.RootElement, options); + } + + internal static RunStepDetails DeserializeRunStepDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("type", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "message_creation": return RunStepMessageCreationDetails.DeserializeRunStepMessageCreationDetails(element, options); + case "tool_calls": return RunStepToolCallDetails.DeserializeRunStepToolCallDetails(element, options); + } + } + return UnknownRunStepDetails.DeserializeUnknownRunStepDetails(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepDetails)} does not support writing '{options.Format}' format."); + } + } + + RunStepDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RunStepDetails FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDetails(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDetails.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDetails.cs new file mode 100644 index 000000000000..777302ff932a --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepDetails.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// + /// An abstract representation of the details for a run step. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public abstract partial class RunStepDetails + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + protected RunStepDetails() + { + } + + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + internal RunStepDetails(RunStepType type, IDictionary serializedAdditionalRawData) + { + Type = type; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The object type. + internal RunStepType Type { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepError.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepError.Serialization.cs new file mode 100644 index 000000000000..9f466f2ac467 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepError.Serialization.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class RunStepError : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepError)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code.ToString()); + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RunStepError IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepError)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepError(document.RootElement, options); + } + + internal static RunStepError DeserializeRunStepError(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RunStepErrorCode code = default; + string message = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("code"u8)) + { + code = new RunStepErrorCode(property.Value.GetString()); + continue; + } + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RunStepError(code, message, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepError)} does not support writing '{options.Format}' format."); + } + } + + RunStepError IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepError(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepError)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RunStepError FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepError(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepError.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepError.cs new file mode 100644 index 000000000000..e2ba030e455b --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepError.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The error information associated with a failed run step. + public partial class RunStepError + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The error code for this error. + /// The human-readable text associated with this error. + /// is null. + internal RunStepError(RunStepErrorCode code, string message) + { + Argument.AssertNotNull(message, nameof(message)); + + Code = code; + Message = message; + } + + /// Initializes a new instance of . + /// The error code for this error. + /// The human-readable text associated with this error. + /// Keeps track of any properties unknown to the library. + internal RunStepError(RunStepErrorCode code, string message, IDictionary serializedAdditionalRawData) + { + Code = code; + Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RunStepError() + { + } + + /// The error code for this error. + public RunStepErrorCode Code { get; } + /// The human-readable text associated with this error. + public string Message { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepErrorCode.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepErrorCode.cs new file mode 100644 index 000000000000..8100c814d85c --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepErrorCode.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// Possible error code values attributable to a failed run step. + public readonly partial struct RunStepErrorCode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RunStepErrorCode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ServerErrorValue = "server_error"; + private const string RateLimitExceededValue = "rate_limit_exceeded"; + + /// Represents a server error. + public static RunStepErrorCode ServerError { get; } = new RunStepErrorCode(ServerErrorValue); + /// Represents an error indicating configured rate limits were exceeded. + public static RunStepErrorCode RateLimitExceeded { get; } = new RunStepErrorCode(RateLimitExceededValue); + /// Determines if two values are the same. + public static bool operator ==(RunStepErrorCode left, RunStepErrorCode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RunStepErrorCode left, RunStepErrorCode right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator RunStepErrorCode(string value) => new RunStepErrorCode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RunStepErrorCode other && Equals(other); + /// + public bool Equals(RunStepErrorCode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepFileSearchToolCall.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepFileSearchToolCall.Serialization.cs new file mode 100644 index 000000000000..d12773bbd72e --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepFileSearchToolCall.Serialization.cs @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class RunStepFileSearchToolCall : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepFileSearchToolCall)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("file_search"u8); + writer.WriteObjectValue(FileSearch, options); + } + + RunStepFileSearchToolCall IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepFileSearchToolCall)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepFileSearchToolCall(document.RootElement, options); + } + + internal static RunStepFileSearchToolCall DeserializeRunStepFileSearchToolCall(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RunStepFileSearchToolCallResults fileSearch = default; + string type = default; + string id = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("file_search"u8)) + { + fileSearch = RunStepFileSearchToolCallResults.DeserializeRunStepFileSearchToolCallResults(property.Value, options); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RunStepFileSearchToolCall(type, id, serializedAdditionalRawData, fileSearch); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepFileSearchToolCall)} does not support writing '{options.Format}' format."); + } + } + + RunStepFileSearchToolCall IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepFileSearchToolCall(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepFileSearchToolCall)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new RunStepFileSearchToolCall FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepFileSearchToolCall(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepFileSearchToolCall.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepFileSearchToolCall.cs new file mode 100644 index 000000000000..cfeb94a91fab --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepFileSearchToolCall.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// + /// A record of a call to a file search tool, issued by the model in evaluation of a defined tool, that represents + /// executed file search. + /// + public partial class RunStepFileSearchToolCall : RunStepToolCall + { + /// Initializes a new instance of . + /// The ID of the tool call. This ID must be referenced when you submit tool outputs. + /// For now, this is always going to be an empty object. + /// or is null. + internal RunStepFileSearchToolCall(string id, RunStepFileSearchToolCallResults fileSearch) : base(id) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(fileSearch, nameof(fileSearch)); + + Type = "file_search"; + FileSearch = fileSearch; + } + + /// Initializes a new instance of . + /// The object type. + /// The ID of the tool call. This ID must be referenced when you submit tool outputs. + /// Keeps track of any properties unknown to the library. + /// For now, this is always going to be an empty object. + internal RunStepFileSearchToolCall(string type, string id, IDictionary serializedAdditionalRawData, RunStepFileSearchToolCallResults fileSearch) : base(type, id, serializedAdditionalRawData) + { + FileSearch = fileSearch; + } + + /// Initializes a new instance of for deserialization. + internal RunStepFileSearchToolCall() + { + } + + /// For now, this is always going to be an empty object. + public RunStepFileSearchToolCallResults FileSearch { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepFileSearchToolCallResult.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepFileSearchToolCallResult.Serialization.cs new file mode 100644 index 000000000000..7599e3298a7b --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepFileSearchToolCallResult.Serialization.cs @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class RunStepFileSearchToolCallResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepFileSearchToolCallResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("file_id"u8); + writer.WriteStringValue(FileId); + writer.WritePropertyName("file_name"u8); + writer.WriteStringValue(FileName); + writer.WritePropertyName("score"u8); + writer.WriteNumberValue(Score); + if (Optional.IsCollectionDefined(Content)) + { + writer.WritePropertyName("content"u8); + writer.WriteStartArray(); + foreach (var item in Content) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RunStepFileSearchToolCallResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepFileSearchToolCallResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepFileSearchToolCallResult(document.RootElement, options); + } + + internal static RunStepFileSearchToolCallResult DeserializeRunStepFileSearchToolCallResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string fileId = default; + string fileName = default; + float score = default; + IReadOnlyList content = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("file_id"u8)) + { + fileId = property.Value.GetString(); + continue; + } + if (property.NameEquals("file_name"u8)) + { + fileName = property.Value.GetString(); + continue; + } + if (property.NameEquals("score"u8)) + { + score = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("content"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(FileSearchToolCallContent.DeserializeFileSearchToolCallContent(item, options)); + } + content = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RunStepFileSearchToolCallResult(fileId, fileName, score, content ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepFileSearchToolCallResult)} does not support writing '{options.Format}' format."); + } + } + + RunStepFileSearchToolCallResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepFileSearchToolCallResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepFileSearchToolCallResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RunStepFileSearchToolCallResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepFileSearchToolCallResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepFileSearchToolCallResult.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepFileSearchToolCallResult.cs new file mode 100644 index 000000000000..6b271661c73c --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepFileSearchToolCallResult.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// File search tool call result. + public partial class RunStepFileSearchToolCallResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The ID of the file that result was found in. + /// The name of the file that result was found in. + /// The score of the result. All values must be a floating point number between 0 and 1. + /// or is null. + internal RunStepFileSearchToolCallResult(string fileId, string fileName, float score) + { + Argument.AssertNotNull(fileId, nameof(fileId)); + Argument.AssertNotNull(fileName, nameof(fileName)); + + FileId = fileId; + FileName = fileName; + Score = score; + Content = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The ID of the file that result was found in. + /// The name of the file that result was found in. + /// The score of the result. All values must be a floating point number between 0 and 1. + /// The content of the result that was found. The content is only included if requested via the include query parameter. + /// Keeps track of any properties unknown to the library. + internal RunStepFileSearchToolCallResult(string fileId, string fileName, float score, IReadOnlyList content, IDictionary serializedAdditionalRawData) + { + FileId = fileId; + FileName = fileName; + Score = score; + Content = content; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RunStepFileSearchToolCallResult() + { + } + + /// The ID of the file that result was found in. + public string FileId { get; } + /// The name of the file that result was found in. + public string FileName { get; } + /// The score of the result. All values must be a floating point number between 0 and 1. + public float Score { get; } + /// The content of the result that was found. The content is only included if requested via the include query parameter. + public IReadOnlyList Content { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepFileSearchToolCallResults.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepFileSearchToolCallResults.Serialization.cs new file mode 100644 index 000000000000..728d6e8dbd4e --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepFileSearchToolCallResults.Serialization.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class RunStepFileSearchToolCallResults : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepFileSearchToolCallResults)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(RankingOptions)) + { + writer.WritePropertyName("ranking_options"u8); + writer.WriteObjectValue(RankingOptions, options); + } + writer.WritePropertyName("results"u8); + writer.WriteStartArray(); + foreach (var item in Results) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RunStepFileSearchToolCallResults IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepFileSearchToolCallResults)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepFileSearchToolCallResults(document.RootElement, options); + } + + internal static RunStepFileSearchToolCallResults DeserializeRunStepFileSearchToolCallResults(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + FileSearchRankingOptions rankingOptions = default; + IReadOnlyList results = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("ranking_options"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rankingOptions = FileSearchRankingOptions.DeserializeFileSearchRankingOptions(property.Value, options); + continue; + } + if (property.NameEquals("results"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(RunStepFileSearchToolCallResult.DeserializeRunStepFileSearchToolCallResult(item, options)); + } + results = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RunStepFileSearchToolCallResults(rankingOptions, results, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepFileSearchToolCallResults)} does not support writing '{options.Format}' format."); + } + } + + RunStepFileSearchToolCallResults IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepFileSearchToolCallResults(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepFileSearchToolCallResults)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RunStepFileSearchToolCallResults FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepFileSearchToolCallResults(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepFileSearchToolCallResults.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepFileSearchToolCallResults.cs new file mode 100644 index 000000000000..2754d53c91b4 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepFileSearchToolCallResults.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Assistants +{ + /// The results of the file search. + public partial class RunStepFileSearchToolCallResults + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The array of a file search results. + /// is null. + internal RunStepFileSearchToolCallResults(IEnumerable results) + { + Argument.AssertNotNull(results, nameof(results)); + + Results = results.ToList(); + } + + /// Initializes a new instance of . + /// Ranking options for file search. + /// The array of a file search results. + /// Keeps track of any properties unknown to the library. + internal RunStepFileSearchToolCallResults(FileSearchRankingOptions rankingOptions, IReadOnlyList results, IDictionary serializedAdditionalRawData) + { + RankingOptions = rankingOptions; + Results = results; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RunStepFileSearchToolCallResults() + { + } + + /// Ranking options for file search. + public FileSearchRankingOptions RankingOptions { get; } + /// The array of a file search results. + public IReadOnlyList Results { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepFunctionToolCall.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepFunctionToolCall.Serialization.cs new file mode 100644 index 000000000000..bfb909f30e10 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepFunctionToolCall.Serialization.cs @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class RunStepFunctionToolCall : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepFunctionToolCall)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("function"u8); + writer.WriteObjectValue(InternalDetails, options); + } + + RunStepFunctionToolCall IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepFunctionToolCall)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepFunctionToolCall(document.RootElement, options); + } + + internal static RunStepFunctionToolCall DeserializeRunStepFunctionToolCall(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + InternalRunStepFunctionToolCallDetails function = default; + string type = default; + string id = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("function"u8)) + { + function = InternalRunStepFunctionToolCallDetails.DeserializeInternalRunStepFunctionToolCallDetails(property.Value, options); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RunStepFunctionToolCall(type, id, serializedAdditionalRawData, function); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepFunctionToolCall)} does not support writing '{options.Format}' format."); + } + } + + RunStepFunctionToolCall IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepFunctionToolCall(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepFunctionToolCall)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new RunStepFunctionToolCall FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepFunctionToolCall(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepFunctionToolCall.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepFunctionToolCall.cs new file mode 100644 index 000000000000..b3349091b490 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepFunctionToolCall.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// + /// A record of a call to a function tool, issued by the model in evaluation of a defined tool, that represents the inputs + /// and output consumed and emitted by the specified function. + /// + public partial class RunStepFunctionToolCall : RunStepToolCall + { + /// Initializes a new instance of . + /// The ID of the tool call. This ID must be referenced when you submit tool outputs. + /// The detailed information about the function called by the model. + /// or is null. + internal RunStepFunctionToolCall(string id, InternalRunStepFunctionToolCallDetails internalDetails) : base(id) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(internalDetails, nameof(internalDetails)); + + Type = "function"; + InternalDetails = internalDetails; + } + + /// Initializes a new instance of . + /// The object type. + /// The ID of the tool call. This ID must be referenced when you submit tool outputs. + /// Keeps track of any properties unknown to the library. + /// The detailed information about the function called by the model. + internal RunStepFunctionToolCall(string type, string id, IDictionary serializedAdditionalRawData, InternalRunStepFunctionToolCallDetails internalDetails) : base(type, id, serializedAdditionalRawData) + { + InternalDetails = internalDetails; + } + + /// Initializes a new instance of for deserialization. + internal RunStepFunctionToolCall() + { + } + + /// The detailed information about the function called by the model. + public InternalRunStepFunctionToolCallDetails InternalDetails { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepMessageCreationDetails.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepMessageCreationDetails.Serialization.cs new file mode 100644 index 000000000000..0a2a17d68422 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepMessageCreationDetails.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class RunStepMessageCreationDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepMessageCreationDetails)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("message_creation"u8); + writer.WriteObjectValue(MessageCreation, options); + } + + RunStepMessageCreationDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepMessageCreationDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepMessageCreationDetails(document.RootElement, options); + } + + internal static RunStepMessageCreationDetails DeserializeRunStepMessageCreationDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RunStepMessageCreationReference messageCreation = default; + RunStepType type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("message_creation"u8)) + { + messageCreation = RunStepMessageCreationReference.DeserializeRunStepMessageCreationReference(property.Value, options); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new RunStepType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RunStepMessageCreationDetails(type, serializedAdditionalRawData, messageCreation); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepMessageCreationDetails)} does not support writing '{options.Format}' format."); + } + } + + RunStepMessageCreationDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepMessageCreationDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepMessageCreationDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new RunStepMessageCreationDetails FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepMessageCreationDetails(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepMessageCreationDetails.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepMessageCreationDetails.cs new file mode 100644 index 000000000000..474ff1c2c02d --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepMessageCreationDetails.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The detailed information associated with a message creation run step. + public partial class RunStepMessageCreationDetails : RunStepDetails + { + /// Initializes a new instance of . + /// Information about the message creation associated with this run step. + /// is null. + internal RunStepMessageCreationDetails(RunStepMessageCreationReference messageCreation) + { + Argument.AssertNotNull(messageCreation, nameof(messageCreation)); + + Type = RunStepType.MessageCreation; + MessageCreation = messageCreation; + } + + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + /// Information about the message creation associated with this run step. + internal RunStepMessageCreationDetails(RunStepType type, IDictionary serializedAdditionalRawData, RunStepMessageCreationReference messageCreation) : base(type, serializedAdditionalRawData) + { + MessageCreation = messageCreation; + } + + /// Initializes a new instance of for deserialization. + internal RunStepMessageCreationDetails() + { + } + + /// Information about the message creation associated with this run step. + public RunStepMessageCreationReference MessageCreation { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepMessageCreationReference.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepMessageCreationReference.Serialization.cs new file mode 100644 index 000000000000..c25362d3f83b --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepMessageCreationReference.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class RunStepMessageCreationReference : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepMessageCreationReference)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("message_id"u8); + writer.WriteStringValue(MessageId); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RunStepMessageCreationReference IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepMessageCreationReference)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepMessageCreationReference(document.RootElement, options); + } + + internal static RunStepMessageCreationReference DeserializeRunStepMessageCreationReference(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string messageId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("message_id"u8)) + { + messageId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RunStepMessageCreationReference(messageId, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepMessageCreationReference)} does not support writing '{options.Format}' format."); + } + } + + RunStepMessageCreationReference IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepMessageCreationReference(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepMessageCreationReference)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RunStepMessageCreationReference FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepMessageCreationReference(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepMessageCreationReference.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepMessageCreationReference.cs new file mode 100644 index 000000000000..6e2fa8e6c03e --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepMessageCreationReference.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The details of a message created as a part of a run step. + public partial class RunStepMessageCreationReference + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The ID of the message created by this run step. + /// is null. + internal RunStepMessageCreationReference(string messageId) + { + Argument.AssertNotNull(messageId, nameof(messageId)); + + MessageId = messageId; + } + + /// Initializes a new instance of . + /// The ID of the message created by this run step. + /// Keeps track of any properties unknown to the library. + internal RunStepMessageCreationReference(string messageId, IDictionary serializedAdditionalRawData) + { + MessageId = messageId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RunStepMessageCreationReference() + { + } + + /// The ID of the message created by this run step. + public string MessageId { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepMicrosoftFabricToolCall.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepMicrosoftFabricToolCall.Serialization.cs new file mode 100644 index 000000000000..5925813b8905 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepMicrosoftFabricToolCall.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class RunStepMicrosoftFabricToolCall : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepMicrosoftFabricToolCall)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("fabric_dataagent"u8); + writer.WriteStartObject(); + foreach (var item in MicrosoftFabric) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + + RunStepMicrosoftFabricToolCall IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepMicrosoftFabricToolCall)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepMicrosoftFabricToolCall(document.RootElement, options); + } + + internal static RunStepMicrosoftFabricToolCall DeserializeRunStepMicrosoftFabricToolCall(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyDictionary fabricDataagent = default; + string type = default; + string id = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("fabric_dataagent"u8)) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + fabricDataagent = dictionary; + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RunStepMicrosoftFabricToolCall(type, id, serializedAdditionalRawData, fabricDataagent); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepMicrosoftFabricToolCall)} does not support writing '{options.Format}' format."); + } + } + + RunStepMicrosoftFabricToolCall IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepMicrosoftFabricToolCall(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepMicrosoftFabricToolCall)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new RunStepMicrosoftFabricToolCall FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepMicrosoftFabricToolCall(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepMicrosoftFabricToolCall.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepMicrosoftFabricToolCall.cs new file mode 100644 index 000000000000..95f84029b1f2 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepMicrosoftFabricToolCall.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// + /// A record of a call to a Microsoft Fabric tool, issued by the model in evaluation of a defined tool, that represents + /// executed Microsoft Fabric operations. + /// + public partial class RunStepMicrosoftFabricToolCall : RunStepToolCall + { + /// Initializes a new instance of . + /// The ID of the tool call. This ID must be referenced when you submit tool outputs. + /// Reserved for future use. + /// or is null. + internal RunStepMicrosoftFabricToolCall(string id, IReadOnlyDictionary microsoftFabric) : base(id) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(microsoftFabric, nameof(microsoftFabric)); + + Type = "fabric_dataagent"; + MicrosoftFabric = microsoftFabric; + } + + /// Initializes a new instance of . + /// The object type. + /// The ID of the tool call. This ID must be referenced when you submit tool outputs. + /// Keeps track of any properties unknown to the library. + /// Reserved for future use. + internal RunStepMicrosoftFabricToolCall(string type, string id, IDictionary serializedAdditionalRawData, IReadOnlyDictionary microsoftFabric) : base(type, id, serializedAdditionalRawData) + { + MicrosoftFabric = microsoftFabric; + } + + /// Initializes a new instance of for deserialization. + internal RunStepMicrosoftFabricToolCall() + { + } + + /// Reserved for future use. + public IReadOnlyDictionary MicrosoftFabric { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepObject.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepObject.cs new file mode 100644 index 000000000000..c52c45d32a13 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepObject.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// The RunStep_object. + public readonly partial struct RunStepObject : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RunStepObject(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ThreadRunStepValue = "thread.run.step"; + + /// thread.run.step. + public static RunStepObject ThreadRunStep { get; } = new RunStepObject(ThreadRunStepValue); + /// Determines if two values are the same. + public static bool operator ==(RunStepObject left, RunStepObject right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RunStepObject left, RunStepObject right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator RunStepObject(string value) => new RunStepObject(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RunStepObject other && Equals(other); + /// + public bool Equals(RunStepObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepSharepointToolCall.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepSharepointToolCall.Serialization.cs new file mode 100644 index 000000000000..c22dc5b8b2ba --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepSharepointToolCall.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class RunStepSharepointToolCall : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepSharepointToolCall)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("sharepoint_grounding"u8); + writer.WriteStartObject(); + foreach (var item in SharePoint) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + + RunStepSharepointToolCall IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepSharepointToolCall)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepSharepointToolCall(document.RootElement, options); + } + + internal static RunStepSharepointToolCall DeserializeRunStepSharepointToolCall(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyDictionary sharepointGrounding = default; + string type = default; + string id = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sharepoint_grounding"u8)) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + sharepointGrounding = dictionary; + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RunStepSharepointToolCall(type, id, serializedAdditionalRawData, sharepointGrounding); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepSharepointToolCall)} does not support writing '{options.Format}' format."); + } + } + + RunStepSharepointToolCall IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepSharepointToolCall(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepSharepointToolCall)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new RunStepSharepointToolCall FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepSharepointToolCall(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepSharepointToolCall.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepSharepointToolCall.cs new file mode 100644 index 000000000000..d80f3b2072a5 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepSharepointToolCall.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// + /// A record of a call to a SharePoint tool, issued by the model in evaluation of a defined tool, that represents + /// executed SharePoint actions. + /// + public partial class RunStepSharepointToolCall : RunStepToolCall + { + /// Initializes a new instance of . + /// The ID of the tool call. This ID must be referenced when you submit tool outputs. + /// Reserved for future use. + /// or is null. + internal RunStepSharepointToolCall(string id, IReadOnlyDictionary sharePoint) : base(id) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(sharePoint, nameof(sharePoint)); + + Type = "sharepoint_grounding"; + SharePoint = sharePoint; + } + + /// Initializes a new instance of . + /// The object type. + /// The ID of the tool call. This ID must be referenced when you submit tool outputs. + /// Keeps track of any properties unknown to the library. + /// Reserved for future use. + internal RunStepSharepointToolCall(string type, string id, IDictionary serializedAdditionalRawData, IReadOnlyDictionary sharePoint) : base(type, id, serializedAdditionalRawData) + { + SharePoint = sharePoint; + } + + /// Initializes a new instance of for deserialization. + internal RunStepSharepointToolCall() + { + } + + /// Reserved for future use. + public IReadOnlyDictionary SharePoint { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepStatus.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepStatus.cs new file mode 100644 index 000000000000..08fae763eb1a --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepStatus.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// Possible values for the status of a run step. + public readonly partial struct RunStepStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RunStepStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InProgressValue = "in_progress"; + private const string CancelledValue = "cancelled"; + private const string FailedValue = "failed"; + private const string CompletedValue = "completed"; + private const string ExpiredValue = "expired"; + + /// Represents a run step still in progress. + public static RunStepStatus InProgress { get; } = new RunStepStatus(InProgressValue); + /// Represents a run step that was cancelled. + public static RunStepStatus Cancelled { get; } = new RunStepStatus(CancelledValue); + /// Represents a run step that failed. + public static RunStepStatus Failed { get; } = new RunStepStatus(FailedValue); + /// Represents a run step that successfully completed. + public static RunStepStatus Completed { get; } = new RunStepStatus(CompletedValue); + /// Represents a run step that expired before otherwise finishing. + public static RunStepStatus Expired { get; } = new RunStepStatus(ExpiredValue); + /// Determines if two values are the same. + public static bool operator ==(RunStepStatus left, RunStepStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RunStepStatus left, RunStepStatus right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator RunStepStatus(string value) => new RunStepStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RunStepStatus other && Equals(other); + /// + public bool Equals(RunStepStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepStreamEvent.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepStreamEvent.cs new file mode 100644 index 000000000000..52b5f5b081bd --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepStreamEvent.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// Run step operation related streaming events. + public readonly partial struct RunStepStreamEvent : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RunStepStreamEvent(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ThreadRunStepCreatedValue = "thread.run.step.created"; + private const string ThreadRunStepInProgressValue = "thread.run.step.in_progress"; + private const string ThreadRunStepDeltaValue = "thread.run.step.delta"; + private const string ThreadRunStepCompletedValue = "thread.run.step.completed"; + private const string ThreadRunStepFailedValue = "thread.run.step.failed"; + private const string ThreadRunStepCancelledValue = "thread.run.step.cancelled"; + private const string ThreadRunStepExpiredValue = "thread.run.step.expired"; + + /// Event sent when a new thread run step is created. The data of this event is of type RunStep. + public static RunStepStreamEvent ThreadRunStepCreated { get; } = new RunStepStreamEvent(ThreadRunStepCreatedValue); + /// Event sent when a run step moves to `in_progress` status. The data of this event is of type RunStep. + public static RunStepStreamEvent ThreadRunStepInProgress { get; } = new RunStepStreamEvent(ThreadRunStepInProgressValue); + /// Event sent when a run step is being streamed. The data of this event is of type RunStepDeltaChunk. + public static RunStepStreamEvent ThreadRunStepDelta { get; } = new RunStepStreamEvent(ThreadRunStepDeltaValue); + /// Event sent when a run step is completed. The data of this event is of type RunStep. + public static RunStepStreamEvent ThreadRunStepCompleted { get; } = new RunStepStreamEvent(ThreadRunStepCompletedValue); + /// Event sent when a run step fails. The data of this event is of type RunStep. + public static RunStepStreamEvent ThreadRunStepFailed { get; } = new RunStepStreamEvent(ThreadRunStepFailedValue); + /// Event sent when a run step is cancelled. The data of this event is of type RunStep. + public static RunStepStreamEvent ThreadRunStepCancelled { get; } = new RunStepStreamEvent(ThreadRunStepCancelledValue); + /// Event sent when a run step is expired. The data of this event is of type RunStep. + public static RunStepStreamEvent ThreadRunStepExpired { get; } = new RunStepStreamEvent(ThreadRunStepExpiredValue); + /// Determines if two values are the same. + public static bool operator ==(RunStepStreamEvent left, RunStepStreamEvent right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RunStepStreamEvent left, RunStepStreamEvent right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator RunStepStreamEvent(string value) => new RunStepStreamEvent(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RunStepStreamEvent other && Equals(other); + /// + public bool Equals(RunStepStreamEvent other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepToolCall.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepToolCall.Serialization.cs new file mode 100644 index 000000000000..698b85268f3d --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepToolCall.Serialization.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + [PersistableModelProxy(typeof(UnknownRunStepToolCall))] + public partial class RunStepToolCall : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepToolCall)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RunStepToolCall IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepToolCall)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepToolCall(document.RootElement, options); + } + + internal static RunStepToolCall DeserializeRunStepToolCall(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("type", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "azure_ai_search": return RunStepAzureAISearchToolCall.DeserializeRunStepAzureAISearchToolCall(element, options); + case "bing_grounding": return RunStepBingGroundingToolCall.DeserializeRunStepBingGroundingToolCall(element, options); + case "code_interpreter": return RunStepCodeInterpreterToolCall.DeserializeRunStepCodeInterpreterToolCall(element, options); + case "fabric_dataagent": return RunStepMicrosoftFabricToolCall.DeserializeRunStepMicrosoftFabricToolCall(element, options); + case "file_search": return RunStepFileSearchToolCall.DeserializeRunStepFileSearchToolCall(element, options); + case "function": return RunStepFunctionToolCall.DeserializeRunStepFunctionToolCall(element, options); + case "sharepoint_grounding": return RunStepSharepointToolCall.DeserializeRunStepSharepointToolCall(element, options); + } + } + return UnknownRunStepToolCall.DeserializeUnknownRunStepToolCall(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepToolCall)} does not support writing '{options.Format}' format."); + } + } + + RunStepToolCall IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepToolCall(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepToolCall)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RunStepToolCall FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepToolCall(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepToolCall.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepToolCall.cs new file mode 100644 index 000000000000..bd5d6dd9ebb6 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepToolCall.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// + /// An abstract representation of a detailed tool call as recorded within a run step for an existing run. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , and . + /// + public abstract partial class RunStepToolCall + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The ID of the tool call. This ID must be referenced when you submit tool outputs. + /// is null. + protected RunStepToolCall(string id) + { + Argument.AssertNotNull(id, nameof(id)); + + Id = id; + } + + /// Initializes a new instance of . + /// The object type. + /// The ID of the tool call. This ID must be referenced when you submit tool outputs. + /// Keeps track of any properties unknown to the library. + internal RunStepToolCall(string type, string id, IDictionary serializedAdditionalRawData) + { + Type = type; + Id = id; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RunStepToolCall() + { + } + + /// The object type. + internal string Type { get; set; } + /// The ID of the tool call. This ID must be referenced when you submit tool outputs. + public string Id { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepToolCallDetails.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepToolCallDetails.Serialization.cs new file mode 100644 index 000000000000..fced7b146ae4 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepToolCallDetails.Serialization.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class RunStepToolCallDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepToolCallDetails)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("tool_calls"u8); + writer.WriteStartArray(); + foreach (var item in ToolCalls) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + + RunStepToolCallDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepToolCallDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepToolCallDetails(document.RootElement, options); + } + + internal static RunStepToolCallDetails DeserializeRunStepToolCallDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList toolCalls = default; + RunStepType type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tool_calls"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(RunStepToolCall.DeserializeRunStepToolCall(item, options)); + } + toolCalls = array; + continue; + } + if (property.NameEquals("type"u8)) + { + type = new RunStepType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RunStepToolCallDetails(type, serializedAdditionalRawData, toolCalls); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepToolCallDetails)} does not support writing '{options.Format}' format."); + } + } + + RunStepToolCallDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepToolCallDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepToolCallDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new RunStepToolCallDetails FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepToolCallDetails(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepToolCallDetails.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepToolCallDetails.cs new file mode 100644 index 000000000000..e39aecfb92d6 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepToolCallDetails.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Assistants +{ + /// The detailed information associated with a run step calling tools. + public partial class RunStepToolCallDetails : RunStepDetails + { + /// Initializes a new instance of . + /// + /// A list of tool call details for this run step. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , and . + /// + /// is null. + internal RunStepToolCallDetails(IEnumerable toolCalls) + { + Argument.AssertNotNull(toolCalls, nameof(toolCalls)); + + Type = RunStepType.ToolCalls; + ToolCalls = toolCalls.ToList(); + } + + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + /// + /// A list of tool call details for this run step. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , and . + /// + internal RunStepToolCallDetails(RunStepType type, IDictionary serializedAdditionalRawData, IReadOnlyList toolCalls) : base(type, serializedAdditionalRawData) + { + ToolCalls = toolCalls; + } + + /// Initializes a new instance of for deserialization. + internal RunStepToolCallDetails() + { + } + + /// + /// A list of tool call details for this run step. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , and . + /// + public IReadOnlyList ToolCalls { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepType.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepType.cs new file mode 100644 index 000000000000..a435401fac3f --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStepType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// The possible types of run steps. + public readonly partial struct RunStepType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RunStepType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string MessageCreationValue = "message_creation"; + private const string ToolCallsValue = "tool_calls"; + + /// Represents a run step to create a message. + public static RunStepType MessageCreation { get; } = new RunStepType(MessageCreationValue); + /// Represents a run step that calls tools. + public static RunStepType ToolCalls { get; } = new RunStepType(ToolCallsValue); + /// Determines if two values are the same. + public static bool operator ==(RunStepType left, RunStepType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RunStepType left, RunStepType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator RunStepType(string value) => new RunStepType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RunStepType other && Equals(other); + /// + public bool Equals(RunStepType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/RunStreamEvent.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStreamEvent.cs new file mode 100644 index 000000000000..8ca30fd278e7 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/RunStreamEvent.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// Run operation related streaming events. + public readonly partial struct RunStreamEvent : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RunStreamEvent(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ThreadRunCreatedValue = "thread.run.created"; + private const string ThreadRunQueuedValue = "thread.run.queued"; + private const string ThreadRunInProgressValue = "thread.run.in_progress"; + private const string ThreadRunRequiresActionValue = "thread.run.requires_action"; + private const string ThreadRunCompletedValue = "thread.run.completed"; + private const string ThreadRunIncompleteValue = "thread.run.incomplete"; + private const string ThreadRunFailedValue = "thread.run.failed"; + private const string ThreadRunCancellingValue = "thread.run.cancelling"; + private const string ThreadRunCancelledValue = "thread.run.cancelled"; + private const string ThreadRunExpiredValue = "thread.run.expired"; + + /// Event sent when a new run is created. The data of this event is of type ThreadRun. + public static RunStreamEvent ThreadRunCreated { get; } = new RunStreamEvent(ThreadRunCreatedValue); + /// Event sent when a run moves to `queued` status. The data of this event is of type ThreadRun. + public static RunStreamEvent ThreadRunQueued { get; } = new RunStreamEvent(ThreadRunQueuedValue); + /// Event sent when a run moves to `in_progress` status. The data of this event is of type ThreadRun. + public static RunStreamEvent ThreadRunInProgress { get; } = new RunStreamEvent(ThreadRunInProgressValue); + /// Event sent when a run moves to `requires_action` status. The data of this event is of type ThreadRun. + public static RunStreamEvent ThreadRunRequiresAction { get; } = new RunStreamEvent(ThreadRunRequiresActionValue); + /// Event sent when a run is completed. The data of this event is of type ThreadRun. + public static RunStreamEvent ThreadRunCompleted { get; } = new RunStreamEvent(ThreadRunCompletedValue); + /// Event sent when a run ends incomplete. The data of this event is of type ThreadRun. + public static RunStreamEvent ThreadRunIncomplete { get; } = new RunStreamEvent(ThreadRunIncompleteValue); + /// Event sent when a run fails. The data of this event is of type ThreadRun. + public static RunStreamEvent ThreadRunFailed { get; } = new RunStreamEvent(ThreadRunFailedValue); + /// Event sent when a run moves to `cancelling` status. The data of this event is of type ThreadRun. + public static RunStreamEvent ThreadRunCancelling { get; } = new RunStreamEvent(ThreadRunCancellingValue); + /// Event sent when a run is cancelled. The data of this event is of type ThreadRun. + public static RunStreamEvent ThreadRunCancelled { get; } = new RunStreamEvent(ThreadRunCancelledValue); + /// Event sent when a run is expired. The data of this event is of type ThreadRun. + public static RunStreamEvent ThreadRunExpired { get; } = new RunStreamEvent(ThreadRunExpiredValue); + /// Determines if two values are the same. + public static bool operator ==(RunStreamEvent left, RunStreamEvent right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RunStreamEvent left, RunStreamEvent right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator RunStreamEvent(string value) => new RunStreamEvent(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RunStreamEvent other && Equals(other); + /// + public bool Equals(RunStreamEvent other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/SharepointToolDefinition.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/SharepointToolDefinition.Serialization.cs new file mode 100644 index 000000000000..ff08b28a8ddc --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/SharepointToolDefinition.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class SharepointToolDefinition : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SharepointToolDefinition)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("sharepoint_grounding"u8); + writer.WriteObjectValue(SharepointGrounding, options); + } + + SharepointToolDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SharepointToolDefinition)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSharepointToolDefinition(document.RootElement, options); + } + + internal static SharepointToolDefinition DeserializeSharepointToolDefinition(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ToolConnectionList sharepointGrounding = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sharepoint_grounding"u8)) + { + sharepointGrounding = ToolConnectionList.DeserializeToolConnectionList(property.Value, options); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SharepointToolDefinition(type, serializedAdditionalRawData, sharepointGrounding); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SharepointToolDefinition)} does not support writing '{options.Format}' format."); + } + } + + SharepointToolDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSharepointToolDefinition(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SharepointToolDefinition)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new SharepointToolDefinition FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSharepointToolDefinition(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/SharepointToolDefinition.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/SharepointToolDefinition.cs new file mode 100644 index 000000000000..c42b80959b66 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/SharepointToolDefinition.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The input definition information for a sharepoint tool as used to configure an agent. + public partial class SharepointToolDefinition : ToolDefinition + { + /// Initializes a new instance of . + /// The list of connections used by the SharePoint tool. + /// is null. + public SharepointToolDefinition(ToolConnectionList sharepointGrounding) + { + Argument.AssertNotNull(sharepointGrounding, nameof(sharepointGrounding)); + + Type = "sharepoint_grounding"; + SharepointGrounding = sharepointGrounding; + } + + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + /// The list of connections used by the SharePoint tool. + internal SharepointToolDefinition(string type, IDictionary serializedAdditionalRawData, ToolConnectionList sharepointGrounding) : base(type, serializedAdditionalRawData) + { + SharepointGrounding = sharepointGrounding; + } + + /// Initializes a new instance of for deserialization. + internal SharepointToolDefinition() + { + } + + /// The list of connections used by the SharePoint tool. + public ToolConnectionList SharepointGrounding { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/SubmitToolOutputsAction.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/SubmitToolOutputsAction.Serialization.cs new file mode 100644 index 000000000000..633e7b4ecc43 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/SubmitToolOutputsAction.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class SubmitToolOutputsAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SubmitToolOutputsAction)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("submit_tool_outputs"u8); + writer.WriteObjectValue(InternalDetails, options); + } + + SubmitToolOutputsAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SubmitToolOutputsAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSubmitToolOutputsAction(document.RootElement, options); + } + + internal static SubmitToolOutputsAction DeserializeSubmitToolOutputsAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + InternalSubmitToolOutputsDetails submitToolOutputs = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("submit_tool_outputs"u8)) + { + submitToolOutputs = InternalSubmitToolOutputsDetails.DeserializeInternalSubmitToolOutputsDetails(property.Value, options); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SubmitToolOutputsAction(type, serializedAdditionalRawData, submitToolOutputs); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SubmitToolOutputsAction)} does not support writing '{options.Format}' format."); + } + } + + SubmitToolOutputsAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSubmitToolOutputsAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SubmitToolOutputsAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new SubmitToolOutputsAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSubmitToolOutputsAction(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/SubmitToolOutputsAction.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/SubmitToolOutputsAction.cs new file mode 100644 index 000000000000..8c4de3fd23c5 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/SubmitToolOutputsAction.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The details for required tool calls that must be submitted for an agent thread run to continue. + public partial class SubmitToolOutputsAction : RequiredAction + { + /// Initializes a new instance of . + /// The details describing tools that should be called to submit tool outputs. + /// is null. + internal SubmitToolOutputsAction(InternalSubmitToolOutputsDetails internalDetails) + { + Argument.AssertNotNull(internalDetails, nameof(internalDetails)); + + Type = "submit_tool_outputs"; + InternalDetails = internalDetails; + } + + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + /// The details describing tools that should be called to submit tool outputs. + internal SubmitToolOutputsAction(string type, IDictionary serializedAdditionalRawData, InternalSubmitToolOutputsDetails internalDetails) : base(type, serializedAdditionalRawData) + { + InternalDetails = internalDetails; + } + + /// Initializes a new instance of for deserialization. + internal SubmitToolOutputsAction() + { + } + + /// The details describing tools that should be called to submit tool outputs. + public InternalSubmitToolOutputsDetails InternalDetails { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/SubmitToolOutputsToRunRequest.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/SubmitToolOutputsToRunRequest.Serialization.cs new file mode 100644 index 000000000000..0c8e5fa09bb4 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/SubmitToolOutputsToRunRequest.Serialization.cs @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class SubmitToolOutputsToRunRequest : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SubmitToolOutputsToRunRequest)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("tool_outputs"u8); + writer.WriteStartArray(); + foreach (var item in ToolOutputs) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Stream)) + { + if (Stream != null) + { + writer.WritePropertyName("stream"u8); + writer.WriteBooleanValue(Stream.Value); + } + else + { + writer.WriteNull("stream"); + } + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SubmitToolOutputsToRunRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SubmitToolOutputsToRunRequest)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSubmitToolOutputsToRunRequest(document.RootElement, options); + } + + internal static SubmitToolOutputsToRunRequest DeserializeSubmitToolOutputsToRunRequest(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList toolOutputs = default; + bool? stream = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tool_outputs"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ToolOutput.DeserializeToolOutput(item, options)); + } + toolOutputs = array; + continue; + } + if (property.NameEquals("stream"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + stream = null; + continue; + } + stream = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SubmitToolOutputsToRunRequest(toolOutputs, stream, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SubmitToolOutputsToRunRequest)} does not support writing '{options.Format}' format."); + } + } + + SubmitToolOutputsToRunRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSubmitToolOutputsToRunRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SubmitToolOutputsToRunRequest)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static SubmitToolOutputsToRunRequest FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSubmitToolOutputsToRunRequest(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/SubmitToolOutputsToRunRequest.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/SubmitToolOutputsToRunRequest.cs new file mode 100644 index 000000000000..8ae526f02172 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/SubmitToolOutputsToRunRequest.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Assistants +{ + /// The SubmitToolOutputsToRunRequest. + internal partial class SubmitToolOutputsToRunRequest + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// A list of tools for which the outputs are being submitted. + /// is null. + internal SubmitToolOutputsToRunRequest(IEnumerable toolOutputs) + { + Argument.AssertNotNull(toolOutputs, nameof(toolOutputs)); + + ToolOutputs = toolOutputs.ToList(); + } + + /// Initializes a new instance of . + /// A list of tools for which the outputs are being submitted. + /// If true, returns a stream of events that happen during the Run as server-sent events, terminating when the run enters a terminal state. + /// Keeps track of any properties unknown to the library. + internal SubmitToolOutputsToRunRequest(IReadOnlyList toolOutputs, bool? stream, IDictionary serializedAdditionalRawData) + { + ToolOutputs = toolOutputs; + Stream = stream; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SubmitToolOutputsToRunRequest() + { + } + + /// A list of tools for which the outputs are being submitted. + public IReadOnlyList ToolOutputs { get; } + /// If true, returns a stream of events that happen during the Run as server-sent events, terminating when the run enters a terminal state. + public bool? Stream { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadDeletionStatus.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadDeletionStatus.Serialization.cs new file mode 100644 index 000000000000..f2f66c0b77a4 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadDeletionStatus.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class ThreadDeletionStatus : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ThreadDeletionStatus)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("deleted"u8); + writer.WriteBooleanValue(Deleted); + writer.WritePropertyName("object"u8); + writer.WriteStringValue(Object.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ThreadDeletionStatus IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ThreadDeletionStatus)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeThreadDeletionStatus(document.RootElement, options); + } + + internal static ThreadDeletionStatus DeserializeThreadDeletionStatus(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + bool deleted = default; + ThreadDeletionStatusObject @object = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("deleted"u8)) + { + deleted = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("object"u8)) + { + @object = new ThreadDeletionStatusObject(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ThreadDeletionStatus(id, deleted, @object, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ThreadDeletionStatus)} does not support writing '{options.Format}' format."); + } + } + + ThreadDeletionStatus IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeThreadDeletionStatus(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ThreadDeletionStatus)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ThreadDeletionStatus FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeThreadDeletionStatus(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadDeletionStatus.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadDeletionStatus.cs new file mode 100644 index 000000000000..345254da7758 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadDeletionStatus.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The status of a thread deletion operation. + internal partial class ThreadDeletionStatus + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The ID of the resource specified for deletion. + /// A value indicating whether deletion was successful. + /// is null. + internal ThreadDeletionStatus(string id, bool deleted) + { + Argument.AssertNotNull(id, nameof(id)); + + Id = id; + Deleted = deleted; + } + + /// Initializes a new instance of . + /// The ID of the resource specified for deletion. + /// A value indicating whether deletion was successful. + /// The object type, which is always 'thread.deleted'. + /// Keeps track of any properties unknown to the library. + internal ThreadDeletionStatus(string id, bool deleted, ThreadDeletionStatusObject @object, IDictionary serializedAdditionalRawData) + { + Id = id; + Deleted = deleted; + Object = @object; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ThreadDeletionStatus() + { + } + + /// The ID of the resource specified for deletion. + public string Id { get; } + /// A value indicating whether deletion was successful. + public bool Deleted { get; } + /// The object type, which is always 'thread.deleted'. + public ThreadDeletionStatusObject Object { get; } = ThreadDeletionStatusObject.ThreadDeleted; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadDeletionStatusObject.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadDeletionStatusObject.cs new file mode 100644 index 000000000000..1a83dc764225 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadDeletionStatusObject.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// The ThreadDeletionStatus_object. + internal readonly partial struct ThreadDeletionStatusObject : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ThreadDeletionStatusObject(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ThreadDeletedValue = "thread.deleted"; + + /// thread.deleted. + public static ThreadDeletionStatusObject ThreadDeleted { get; } = new ThreadDeletionStatusObject(ThreadDeletedValue); + /// Determines if two values are the same. + public static bool operator ==(ThreadDeletionStatusObject left, ThreadDeletionStatusObject right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ThreadDeletionStatusObject left, ThreadDeletionStatusObject right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ThreadDeletionStatusObject(string value) => new ThreadDeletionStatusObject(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ThreadDeletionStatusObject other && Equals(other); + /// + public bool Equals(ThreadDeletionStatusObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadMessage.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadMessage.Serialization.cs new file mode 100644 index 000000000000..203bfc1435d9 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadMessage.Serialization.cs @@ -0,0 +1,376 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class ThreadMessage : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ThreadMessage)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("object"u8); + writer.WriteStringValue(Object.ToString()); + writer.WritePropertyName("created_at"u8); + writer.WriteNumberValue(CreatedAt, "U"); + writer.WritePropertyName("thread_id"u8); + writer.WriteStringValue(ThreadId); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (IncompleteDetails != null) + { + writer.WritePropertyName("incomplete_details"u8); + writer.WriteObjectValue(IncompleteDetails, options); + } + else + { + writer.WriteNull("incomplete_details"); + } + if (CompletedAt != null) + { + writer.WritePropertyName("completed_at"u8); + writer.WriteNumberValue(CompletedAt.Value, "U"); + } + else + { + writer.WriteNull("completed_at"); + } + if (IncompleteAt != null) + { + writer.WritePropertyName("incomplete_at"u8); + writer.WriteNumberValue(IncompleteAt.Value, "U"); + } + else + { + writer.WriteNull("incomplete_at"); + } + writer.WritePropertyName("role"u8); + writer.WriteStringValue(Role.ToString()); + writer.WritePropertyName("content"u8); + writer.WriteStartArray(); + foreach (var item in ContentItems) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (AssistantId != null) + { + writer.WritePropertyName("assistant_id"u8); + writer.WriteStringValue(AssistantId); + } + else + { + writer.WriteNull("assistant_id"); + } + if (RunId != null) + { + writer.WritePropertyName("run_id"u8); + writer.WriteStringValue(RunId); + } + else + { + writer.WriteNull("run_id"); + } + if (Attachments != null && Optional.IsCollectionDefined(Attachments)) + { + writer.WritePropertyName("attachments"u8); + writer.WriteStartArray(); + foreach (var item in Attachments) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + else + { + writer.WriteNull("attachments"); + } + if (Metadata != null && Optional.IsCollectionDefined(Metadata)) + { + writer.WritePropertyName("metadata"u8); + writer.WriteStartObject(); + foreach (var item in Metadata) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + else + { + writer.WriteNull("metadata"); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ThreadMessage IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ThreadMessage)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeThreadMessage(document.RootElement, options); + } + + internal static ThreadMessage DeserializeThreadMessage(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + ThreadMessageObject @object = default; + DateTimeOffset createdAt = default; + string threadId = default; + MessageStatus status = default; + MessageIncompleteDetails incompleteDetails = default; + DateTimeOffset? completedAt = default; + DateTimeOffset? incompleteAt = default; + MessageRole role = default; + IReadOnlyList content = default; + string assistantId = default; + string runId = default; + IReadOnlyList attachments = default; + IReadOnlyDictionary metadata = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("object"u8)) + { + @object = new ThreadMessageObject(property.Value.GetString()); + continue; + } + if (property.NameEquals("created_at"u8)) + { + createdAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); + continue; + } + if (property.NameEquals("thread_id"u8)) + { + threadId = property.Value.GetString(); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new MessageStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("incomplete_details"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + incompleteDetails = null; + continue; + } + incompleteDetails = MessageIncompleteDetails.DeserializeMessageIncompleteDetails(property.Value, options); + continue; + } + if (property.NameEquals("completed_at"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + completedAt = null; + continue; + } + completedAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); + continue; + } + if (property.NameEquals("incomplete_at"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + incompleteAt = null; + continue; + } + incompleteAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); + continue; + } + if (property.NameEquals("role"u8)) + { + role = new MessageRole(property.Value.GetString()); + continue; + } + if (property.NameEquals("content"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MessageContent.DeserializeMessageContent(item, options)); + } + content = array; + continue; + } + if (property.NameEquals("assistant_id"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + assistantId = null; + continue; + } + assistantId = property.Value.GetString(); + continue; + } + if (property.NameEquals("run_id"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + runId = null; + continue; + } + runId = property.Value.GetString(); + continue; + } + if (property.NameEquals("attachments"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + attachments = new ChangeTrackingList(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MessageAttachment.DeserializeMessageAttachment(item, options)); + } + attachments = array; + continue; + } + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + metadata = new ChangeTrackingDictionary(); + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + metadata = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ThreadMessage( + id, + @object, + createdAt, + threadId, + status, + incompleteDetails, + completedAt, + incompleteAt, + role, + content, + assistantId, + runId, + attachments, + metadata, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ThreadMessage)} does not support writing '{options.Format}' format."); + } + } + + ThreadMessage IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeThreadMessage(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ThreadMessage)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ThreadMessage FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeThreadMessage(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadMessage.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadMessage.cs new file mode 100644 index 000000000000..298b28a34d62 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadMessage.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Assistants +{ + /// A single, existing message within an agent thread. + public partial class ThreadMessage + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The identifier, which can be referenced in API endpoints. + /// The Unix timestamp, in seconds, representing when this object was created. + /// The ID of the thread that this message belongs to. + /// The status of the message. + /// On an incomplete message, details about why the message is incomplete. + /// The Unix timestamp (in seconds) for when the message was completed. + /// The Unix timestamp (in seconds) for when the message was marked as incomplete. + /// The role associated with the agent thread message. + /// + /// The list of content items associated with the agent thread message. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// If applicable, the ID of the agent that authored this message. + /// If applicable, the ID of the run associated with the authoring of this message. + /// A list of files attached to the message, and the tools they were added to. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// , or is null. + internal ThreadMessage(string id, DateTimeOffset createdAt, string threadId, MessageStatus status, MessageIncompleteDetails incompleteDetails, DateTimeOffset? completedAt, DateTimeOffset? incompleteAt, MessageRole role, IEnumerable contentItems, string assistantId, string runId, IEnumerable attachments, IReadOnlyDictionary metadata) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(threadId, nameof(threadId)); + Argument.AssertNotNull(contentItems, nameof(contentItems)); + + Id = id; + CreatedAt = createdAt; + ThreadId = threadId; + Status = status; + IncompleteDetails = incompleteDetails; + CompletedAt = completedAt; + IncompleteAt = incompleteAt; + Role = role; + ContentItems = contentItems.ToList(); + AssistantId = assistantId; + RunId = runId; + Attachments = attachments?.ToList(); + Metadata = metadata; + } + + /// Initializes a new instance of . + /// The identifier, which can be referenced in API endpoints. + /// The object type, which is always 'thread.message'. + /// The Unix timestamp, in seconds, representing when this object was created. + /// The ID of the thread that this message belongs to. + /// The status of the message. + /// On an incomplete message, details about why the message is incomplete. + /// The Unix timestamp (in seconds) for when the message was completed. + /// The Unix timestamp (in seconds) for when the message was marked as incomplete. + /// The role associated with the agent thread message. + /// + /// The list of content items associated with the agent thread message. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// If applicable, the ID of the agent that authored this message. + /// If applicable, the ID of the run associated with the authoring of this message. + /// A list of files attached to the message, and the tools they were added to. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// Keeps track of any properties unknown to the library. + internal ThreadMessage(string id, ThreadMessageObject @object, DateTimeOffset createdAt, string threadId, MessageStatus status, MessageIncompleteDetails incompleteDetails, DateTimeOffset? completedAt, DateTimeOffset? incompleteAt, MessageRole role, IReadOnlyList contentItems, string assistantId, string runId, IReadOnlyList attachments, IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) + { + Id = id; + Object = @object; + CreatedAt = createdAt; + ThreadId = threadId; + Status = status; + IncompleteDetails = incompleteDetails; + CompletedAt = completedAt; + IncompleteAt = incompleteAt; + Role = role; + ContentItems = contentItems; + AssistantId = assistantId; + RunId = runId; + Attachments = attachments; + Metadata = metadata; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ThreadMessage() + { + } + + /// The identifier, which can be referenced in API endpoints. + public string Id { get; } + /// The object type, which is always 'thread.message'. + public ThreadMessageObject Object { get; } = ThreadMessageObject.ThreadMessage; + + /// The Unix timestamp, in seconds, representing when this object was created. + public DateTimeOffset CreatedAt { get; } + /// The ID of the thread that this message belongs to. + public string ThreadId { get; } + /// The status of the message. + public MessageStatus Status { get; } + /// On an incomplete message, details about why the message is incomplete. + public MessageIncompleteDetails IncompleteDetails { get; } + /// The Unix timestamp (in seconds) for when the message was completed. + public DateTimeOffset? CompletedAt { get; } + /// The Unix timestamp (in seconds) for when the message was marked as incomplete. + public DateTimeOffset? IncompleteAt { get; } + /// The role associated with the agent thread message. + public MessageRole Role { get; } + /// + /// The list of content items associated with the agent thread message. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public IReadOnlyList ContentItems { get; } + /// If applicable, the ID of the agent that authored this message. + public string AssistantId { get; } + /// If applicable, the ID of the run associated with the authoring of this message. + public string RunId { get; } + /// A list of files attached to the message, and the tools they were added to. + public IReadOnlyList Attachments { get; } + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + public IReadOnlyDictionary Metadata { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadMessageObject.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadMessageObject.cs new file mode 100644 index 000000000000..b417d7ac9b77 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadMessageObject.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// The ThreadMessage_object. + public readonly partial struct ThreadMessageObject : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ThreadMessageObject(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ThreadMessageValue = "thread.message"; + + /// thread.message. + public static ThreadMessageObject ThreadMessage { get; } = new ThreadMessageObject(ThreadMessageValue); + /// Determines if two values are the same. + public static bool operator ==(ThreadMessageObject left, ThreadMessageObject right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ThreadMessageObject left, ThreadMessageObject right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ThreadMessageObject(string value) => new ThreadMessageObject(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ThreadMessageObject other && Equals(other); + /// + public bool Equals(ThreadMessageObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadMessageOptions.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadMessageOptions.Serialization.cs new file mode 100644 index 000000000000..3a34288ad79c --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadMessageOptions.Serialization.cs @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class ThreadMessageOptions : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ThreadMessageOptions)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("role"u8); + writer.WriteStringValue(Role.ToString()); + writer.WritePropertyName("content"u8); + writer.WriteStringValue(Content); + if (Optional.IsCollectionDefined(Attachments)) + { + if (Attachments != null) + { + writer.WritePropertyName("attachments"u8); + writer.WriteStartArray(); + foreach (var item in Attachments) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + else + { + writer.WriteNull("attachments"); + } + } + if (Optional.IsCollectionDefined(Metadata)) + { + if (Metadata != null) + { + writer.WritePropertyName("metadata"u8); + writer.WriteStartObject(); + foreach (var item in Metadata) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + else + { + writer.WriteNull("metadata"); + } + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ThreadMessageOptions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ThreadMessageOptions)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeThreadMessageOptions(document.RootElement, options); + } + + internal static ThreadMessageOptions DeserializeThreadMessageOptions(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + MessageRole role = default; + string content = default; + IList attachments = default; + IDictionary metadata = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("role"u8)) + { + role = new MessageRole(property.Value.GetString()); + continue; + } + if (property.NameEquals("content"u8)) + { + content = property.Value.GetString(); + continue; + } + if (property.NameEquals("attachments"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MessageAttachment.DeserializeMessageAttachment(item, options)); + } + attachments = array; + continue; + } + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + metadata = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ThreadMessageOptions(role, content, attachments ?? new ChangeTrackingList(), metadata ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ThreadMessageOptions)} does not support writing '{options.Format}' format."); + } + } + + ThreadMessageOptions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeThreadMessageOptions(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ThreadMessageOptions)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ThreadMessageOptions FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeThreadMessageOptions(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadMessageOptions.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadMessageOptions.cs new file mode 100644 index 000000000000..2abccf8f53ee --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadMessageOptions.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// A single message within an agent thread, as provided during that thread's creation for its initial state. + public partial class ThreadMessageOptions + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// + /// The role of the entity that is creating the message. Allowed values include: + /// - `user`: Indicates the message is sent by an actual user and should be used in most + /// cases to represent user-generated messages. + /// - `assistant`: Indicates the message is generated by the agent. Use this value to insert + /// messages from the agent into the + /// conversation. + /// + /// + /// The textual content of the initial message. Currently, robust input including images and annotated text may only be provided via + /// a separate call to the create message API. + /// + /// is null. + public ThreadMessageOptions(MessageRole role, string content) + { + Argument.AssertNotNull(content, nameof(content)); + + Role = role; + Content = content; + Attachments = new ChangeTrackingList(); + Metadata = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// + /// The role of the entity that is creating the message. Allowed values include: + /// - `user`: Indicates the message is sent by an actual user and should be used in most + /// cases to represent user-generated messages. + /// - `assistant`: Indicates the message is generated by the agent. Use this value to insert + /// messages from the agent into the + /// conversation. + /// + /// + /// The textual content of the initial message. Currently, robust input including images and annotated text may only be provided via + /// a separate call to the create message API. + /// + /// A list of files attached to the message, and the tools they should be added to. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// Keeps track of any properties unknown to the library. + internal ThreadMessageOptions(MessageRole role, string content, IList attachments, IDictionary metadata, IDictionary serializedAdditionalRawData) + { + Role = role; + Content = content; + Attachments = attachments; + Metadata = metadata; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ThreadMessageOptions() + { + } + + /// + /// The role of the entity that is creating the message. Allowed values include: + /// - `user`: Indicates the message is sent by an actual user and should be used in most + /// cases to represent user-generated messages. + /// - `assistant`: Indicates the message is generated by the agent. Use this value to insert + /// messages from the agent into the + /// conversation. + /// + public MessageRole Role { get; } + /// + /// The textual content of the initial message. Currently, robust input including images and annotated text may only be provided via + /// a separate call to the create message API. + /// + public string Content { get; } + /// A list of files attached to the message, and the tools they should be added to. + public IList Attachments { get; set; } + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + public IDictionary Metadata { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadRun.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadRun.Serialization.cs new file mode 100644 index 000000000000..ae691c7a2310 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadRun.Serialization.cs @@ -0,0 +1,650 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class ThreadRun : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ThreadRun)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("object"u8); + writer.WriteStringValue(Object.ToString()); + writer.WritePropertyName("thread_id"u8); + writer.WriteStringValue(ThreadId); + writer.WritePropertyName("assistant_id"u8); + writer.WriteStringValue(AssistantId); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsDefined(RequiredAction)) + { + if (RequiredAction != null) + { + writer.WritePropertyName("required_action"u8); + writer.WriteObjectValue(RequiredAction, options); + } + else + { + writer.WriteNull("required_action"); + } + } + if (LastError != null) + { + writer.WritePropertyName("last_error"u8); + writer.WriteObjectValue(LastError, options); + } + else + { + writer.WriteNull("last_error"); + } + writer.WritePropertyName("model"u8); + writer.WriteStringValue(Model); + writer.WritePropertyName("instructions"u8); + writer.WriteStringValue(Instructions); + writer.WritePropertyName("tools"u8); + writer.WriteStartArray(); + foreach (var item in Tools) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + writer.WritePropertyName("created_at"u8); + writer.WriteNumberValue(CreatedAt, "U"); + if (ExpiresAt != null) + { + writer.WritePropertyName("expires_at"u8); + writer.WriteNumberValue(ExpiresAt.Value, "U"); + } + else + { + writer.WriteNull("expires_at"); + } + if (StartedAt != null) + { + writer.WritePropertyName("started_at"u8); + writer.WriteNumberValue(StartedAt.Value, "U"); + } + else + { + writer.WriteNull("started_at"); + } + if (CompletedAt != null) + { + writer.WritePropertyName("completed_at"u8); + writer.WriteNumberValue(CompletedAt.Value, "U"); + } + else + { + writer.WriteNull("completed_at"); + } + if (CancelledAt != null) + { + writer.WritePropertyName("cancelled_at"u8); + writer.WriteNumberValue(CancelledAt.Value, "U"); + } + else + { + writer.WriteNull("cancelled_at"); + } + if (FailedAt != null) + { + writer.WritePropertyName("failed_at"u8); + writer.WriteNumberValue(FailedAt.Value, "U"); + } + else + { + writer.WriteNull("failed_at"); + } + if (IncompleteDetails != null) + { + writer.WritePropertyName("incomplete_details"u8); + writer.WriteObjectValue(IncompleteDetails, options); + } + else + { + writer.WriteNull("incomplete_details"); + } + if (Usage != null) + { + writer.WritePropertyName("usage"u8); + writer.WriteObjectValue(Usage, options); + } + else + { + writer.WriteNull("usage"); + } + if (Optional.IsDefined(Temperature)) + { + if (Temperature != null) + { + writer.WritePropertyName("temperature"u8); + writer.WriteNumberValue(Temperature.Value); + } + else + { + writer.WriteNull("temperature"); + } + } + if (Optional.IsDefined(TopP)) + { + if (TopP != null) + { + writer.WritePropertyName("top_p"u8); + writer.WriteNumberValue(TopP.Value); + } + else + { + writer.WriteNull("top_p"); + } + } + if (MaxPromptTokens != null) + { + writer.WritePropertyName("max_prompt_tokens"u8); + writer.WriteNumberValue(MaxPromptTokens.Value); + } + else + { + writer.WriteNull("max_prompt_tokens"); + } + if (MaxCompletionTokens != null) + { + writer.WritePropertyName("max_completion_tokens"u8); + writer.WriteNumberValue(MaxCompletionTokens.Value); + } + else + { + writer.WriteNull("max_completion_tokens"); + } + if (TruncationStrategy != null) + { + writer.WritePropertyName("truncation_strategy"u8); + writer.WriteObjectValue(TruncationStrategy, options); + } + else + { + writer.WriteNull("truncation_strategy"); + } + if (ToolChoice != null) + { + writer.WritePropertyName("tool_choice"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(ToolChoice); +#else + using (JsonDocument document = JsonDocument.Parse(ToolChoice, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + else + { + writer.WriteNull("tool_choice"); + } + if (ResponseFormat != null) + { + writer.WritePropertyName("response_format"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(ResponseFormat); +#else + using (JsonDocument document = JsonDocument.Parse(ResponseFormat, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + else + { + writer.WriteNull("response_format"); + } + if (Metadata != null && Optional.IsCollectionDefined(Metadata)) + { + writer.WritePropertyName("metadata"u8); + writer.WriteStartObject(); + foreach (var item in Metadata) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + else + { + writer.WriteNull("metadata"); + } + if (Optional.IsDefined(ToolResources)) + { + if (ToolResources != null) + { + writer.WritePropertyName("tool_resources"u8); + writer.WriteObjectValue(ToolResources, options); + } + else + { + writer.WriteNull("tool_resources"); + } + } + writer.WritePropertyName("parallel_tool_calls"u8); + writer.WriteBooleanValue(ParallelToolCalls); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ThreadRun IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ThreadRun)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeThreadRun(document.RootElement, options); + } + + internal static ThreadRun DeserializeThreadRun(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + ThreadRunObject @object = default; + string threadId = default; + string assistantId = default; + RunStatus status = default; + RequiredAction requiredAction = default; + RunError lastError = default; + string model = default; + string instructions = default; + IReadOnlyList tools = default; + DateTimeOffset createdAt = default; + DateTimeOffset? expiresAt = default; + DateTimeOffset? startedAt = default; + DateTimeOffset? completedAt = default; + DateTimeOffset? cancelledAt = default; + DateTimeOffset? failedAt = default; + IncompleteRunDetails incompleteDetails = default; + RunCompletionUsage usage = default; + float? temperature = default; + float? topP = default; + int? maxPromptTokens = default; + int? maxCompletionTokens = default; + TruncationObject truncationStrategy = default; + BinaryData toolChoice = default; + BinaryData responseFormat = default; + IReadOnlyDictionary metadata = default; + UpdateToolResourcesOptions toolResources = default; + bool parallelToolCalls = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("object"u8)) + { + @object = new ThreadRunObject(property.Value.GetString()); + continue; + } + if (property.NameEquals("thread_id"u8)) + { + threadId = property.Value.GetString(); + continue; + } + if (property.NameEquals("assistant_id"u8)) + { + assistantId = property.Value.GetString(); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new RunStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("required_action"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + requiredAction = null; + continue; + } + requiredAction = RequiredAction.DeserializeRequiredAction(property.Value, options); + continue; + } + if (property.NameEquals("last_error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + lastError = null; + continue; + } + lastError = RunError.DeserializeRunError(property.Value, options); + continue; + } + if (property.NameEquals("model"u8)) + { + model = property.Value.GetString(); + continue; + } + if (property.NameEquals("instructions"u8)) + { + instructions = property.Value.GetString(); + continue; + } + if (property.NameEquals("tools"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ToolDefinition.DeserializeToolDefinition(item, options)); + } + tools = array; + continue; + } + if (property.NameEquals("created_at"u8)) + { + createdAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); + continue; + } + if (property.NameEquals("expires_at"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + expiresAt = null; + continue; + } + expiresAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); + continue; + } + if (property.NameEquals("started_at"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + startedAt = null; + continue; + } + startedAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); + continue; + } + if (property.NameEquals("completed_at"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + completedAt = null; + continue; + } + completedAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); + continue; + } + if (property.NameEquals("cancelled_at"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + cancelledAt = null; + continue; + } + cancelledAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); + continue; + } + if (property.NameEquals("failed_at"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + failedAt = null; + continue; + } + failedAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); + continue; + } + if (property.NameEquals("incomplete_details"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + incompleteDetails = null; + continue; + } + incompleteDetails = IncompleteRunDetails.DeserializeIncompleteRunDetails(property.Value, options); + continue; + } + if (property.NameEquals("usage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + usage = null; + continue; + } + usage = RunCompletionUsage.DeserializeRunCompletionUsage(property.Value, options); + continue; + } + if (property.NameEquals("temperature"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + temperature = null; + continue; + } + temperature = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("top_p"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + topP = null; + continue; + } + topP = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("max_prompt_tokens"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + maxPromptTokens = null; + continue; + } + maxPromptTokens = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("max_completion_tokens"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + maxCompletionTokens = null; + continue; + } + maxCompletionTokens = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("truncation_strategy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + truncationStrategy = null; + continue; + } + truncationStrategy = TruncationObject.DeserializeTruncationObject(property.Value, options); + continue; + } + if (property.NameEquals("tool_choice"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + toolChoice = null; + continue; + } + toolChoice = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("response_format"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + responseFormat = null; + continue; + } + responseFormat = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + metadata = new ChangeTrackingDictionary(); + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + metadata = dictionary; + continue; + } + if (property.NameEquals("tool_resources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + toolResources = null; + continue; + } + toolResources = UpdateToolResourcesOptions.DeserializeUpdateToolResourcesOptions(property.Value, options); + continue; + } + if (property.NameEquals("parallel_tool_calls"u8)) + { + parallelToolCalls = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ThreadRun( + id, + @object, + threadId, + assistantId, + status, + requiredAction, + lastError, + model, + instructions, + tools, + createdAt, + expiresAt, + startedAt, + completedAt, + cancelledAt, + failedAt, + incompleteDetails, + usage, + temperature, + topP, + maxPromptTokens, + maxCompletionTokens, + truncationStrategy, + toolChoice, + responseFormat, + metadata, + toolResources, + parallelToolCalls, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ThreadRun)} does not support writing '{options.Format}' format."); + } + } + + ThreadRun IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeThreadRun(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ThreadRun)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ThreadRun FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeThreadRun(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadRun.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadRun.cs new file mode 100644 index 000000000000..c96a13694c4d --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadRun.cs @@ -0,0 +1,343 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Assistants +{ + /// Data representing a single evaluation run of an agent thread. + public partial class ThreadRun + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The identifier, which can be referenced in API endpoints. + /// The ID of the thread associated with this run. + /// The ID of the agent associated with the thread this run was performed against. + /// The status of the agent thread run. + /// The last error, if any, encountered by this agent thread run. + /// The ID of the model to use. + /// The overridden system instructions used for this agent thread run. + /// + /// The overridden enabled tools used for this agent thread run. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , and . + /// + /// The Unix timestamp, in seconds, representing when this object was created. + /// The Unix timestamp, in seconds, representing when this item expires. + /// The Unix timestamp, in seconds, representing when this item was started. + /// The Unix timestamp, in seconds, representing when this completed. + /// The Unix timestamp, in seconds, representing when this was cancelled. + /// The Unix timestamp, in seconds, representing when this failed. + /// Details on why the run is incomplete. Will be `null` if the run is not incomplete. + /// Usage statistics related to the run. This value will be `null` if the run is not in a terminal state (i.e. `in_progress`, `queued`, etc.). + /// The maximum number of prompt tokens specified to have been used over the course of the run. + /// The maximum number of completion tokens specified to have been used over the course of the run. + /// The strategy to use for dropping messages as the context windows moves forward. + /// Controls whether or not and which tool is called by the model. + /// The response format of the tool calls used in this run. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// Determines if tools can be executed in parallel within the run. + /// , , , , or is null. + internal ThreadRun(string id, string threadId, string assistantId, RunStatus status, RunError lastError, string model, string instructions, IEnumerable tools, DateTimeOffset createdAt, DateTimeOffset? expiresAt, DateTimeOffset? startedAt, DateTimeOffset? completedAt, DateTimeOffset? cancelledAt, DateTimeOffset? failedAt, IncompleteRunDetails incompleteDetails, RunCompletionUsage usage, int? maxPromptTokens, int? maxCompletionTokens, TruncationObject truncationStrategy, BinaryData toolChoice, BinaryData responseFormat, IReadOnlyDictionary metadata, bool parallelToolCalls) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(threadId, nameof(threadId)); + Argument.AssertNotNull(assistantId, nameof(assistantId)); + Argument.AssertNotNull(model, nameof(model)); + Argument.AssertNotNull(instructions, nameof(instructions)); + Argument.AssertNotNull(tools, nameof(tools)); + + Id = id; + ThreadId = threadId; + AssistantId = assistantId; + Status = status; + LastError = lastError; + Model = model; + Instructions = instructions; + Tools = tools.ToList(); + CreatedAt = createdAt; + ExpiresAt = expiresAt; + StartedAt = startedAt; + CompletedAt = completedAt; + CancelledAt = cancelledAt; + FailedAt = failedAt; + IncompleteDetails = incompleteDetails; + Usage = usage; + MaxPromptTokens = maxPromptTokens; + MaxCompletionTokens = maxCompletionTokens; + TruncationStrategy = truncationStrategy; + ToolChoice = toolChoice; + ResponseFormat = responseFormat; + Metadata = metadata; + ParallelToolCalls = parallelToolCalls; + } + + /// Initializes a new instance of . + /// The identifier, which can be referenced in API endpoints. + /// The object type, which is always 'thread.run'. + /// The ID of the thread associated with this run. + /// The ID of the agent associated with the thread this run was performed against. + /// The status of the agent thread run. + /// + /// The details of the action required for the agent thread run to continue. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + /// The last error, if any, encountered by this agent thread run. + /// The ID of the model to use. + /// The overridden system instructions used for this agent thread run. + /// + /// The overridden enabled tools used for this agent thread run. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , and . + /// + /// The Unix timestamp, in seconds, representing when this object was created. + /// The Unix timestamp, in seconds, representing when this item expires. + /// The Unix timestamp, in seconds, representing when this item was started. + /// The Unix timestamp, in seconds, representing when this completed. + /// The Unix timestamp, in seconds, representing when this was cancelled. + /// The Unix timestamp, in seconds, representing when this failed. + /// Details on why the run is incomplete. Will be `null` if the run is not incomplete. + /// Usage statistics related to the run. This value will be `null` if the run is not in a terminal state (i.e. `in_progress`, `queued`, etc.). + /// The sampling temperature used for this run. If not set, defaults to 1. + /// The nucleus sampling value used for this run. If not set, defaults to 1. + /// The maximum number of prompt tokens specified to have been used over the course of the run. + /// The maximum number of completion tokens specified to have been used over the course of the run. + /// The strategy to use for dropping messages as the context windows moves forward. + /// Controls whether or not and which tool is called by the model. + /// The response format of the tool calls used in this run. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// Override the tools the agent can use for this run. This is useful for modifying the behavior on a per-run basis. + /// Determines if tools can be executed in parallel within the run. + /// Keeps track of any properties unknown to the library. + internal ThreadRun(string id, ThreadRunObject @object, string threadId, string assistantId, RunStatus status, RequiredAction requiredAction, RunError lastError, string model, string instructions, IReadOnlyList tools, DateTimeOffset createdAt, DateTimeOffset? expiresAt, DateTimeOffset? startedAt, DateTimeOffset? completedAt, DateTimeOffset? cancelledAt, DateTimeOffset? failedAt, IncompleteRunDetails incompleteDetails, RunCompletionUsage usage, float? temperature, float? topP, int? maxPromptTokens, int? maxCompletionTokens, TruncationObject truncationStrategy, BinaryData toolChoice, BinaryData responseFormat, IReadOnlyDictionary metadata, UpdateToolResourcesOptions toolResources, bool parallelToolCalls, IDictionary serializedAdditionalRawData) + { + Id = id; + Object = @object; + ThreadId = threadId; + AssistantId = assistantId; + Status = status; + RequiredAction = requiredAction; + LastError = lastError; + Model = model; + Instructions = instructions; + Tools = tools; + CreatedAt = createdAt; + ExpiresAt = expiresAt; + StartedAt = startedAt; + CompletedAt = completedAt; + CancelledAt = cancelledAt; + FailedAt = failedAt; + IncompleteDetails = incompleteDetails; + Usage = usage; + Temperature = temperature; + TopP = topP; + MaxPromptTokens = maxPromptTokens; + MaxCompletionTokens = maxCompletionTokens; + TruncationStrategy = truncationStrategy; + ToolChoice = toolChoice; + ResponseFormat = responseFormat; + Metadata = metadata; + ToolResources = toolResources; + ParallelToolCalls = parallelToolCalls; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ThreadRun() + { + } + + /// The identifier, which can be referenced in API endpoints. + public string Id { get; } + /// The object type, which is always 'thread.run'. + public ThreadRunObject Object { get; } = ThreadRunObject.ThreadRun; + + /// The ID of the thread associated with this run. + public string ThreadId { get; } + /// The ID of the agent associated with the thread this run was performed against. + public string AssistantId { get; } + /// The status of the agent thread run. + public RunStatus Status { get; } + /// + /// The details of the action required for the agent thread run to continue. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + public RequiredAction RequiredAction { get; } + /// The last error, if any, encountered by this agent thread run. + public RunError LastError { get; } + /// The ID of the model to use. + public string Model { get; } + /// The overridden system instructions used for this agent thread run. + public string Instructions { get; } + /// + /// The overridden enabled tools used for this agent thread run. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , and . + /// + public IReadOnlyList Tools { get; } + /// The Unix timestamp, in seconds, representing when this object was created. + public DateTimeOffset CreatedAt { get; } + /// The Unix timestamp, in seconds, representing when this item expires. + public DateTimeOffset? ExpiresAt { get; } + /// The Unix timestamp, in seconds, representing when this item was started. + public DateTimeOffset? StartedAt { get; } + /// The Unix timestamp, in seconds, representing when this completed. + public DateTimeOffset? CompletedAt { get; } + /// The Unix timestamp, in seconds, representing when this was cancelled. + public DateTimeOffset? CancelledAt { get; } + /// The Unix timestamp, in seconds, representing when this failed. + public DateTimeOffset? FailedAt { get; } + /// Details on why the run is incomplete. Will be `null` if the run is not incomplete. + public IncompleteRunDetails IncompleteDetails { get; } + /// Usage statistics related to the run. This value will be `null` if the run is not in a terminal state (i.e. `in_progress`, `queued`, etc.). + public RunCompletionUsage Usage { get; } + /// The sampling temperature used for this run. If not set, defaults to 1. + public float? Temperature { get; } + /// The nucleus sampling value used for this run. If not set, defaults to 1. + public float? TopP { get; } + /// The maximum number of prompt tokens specified to have been used over the course of the run. + public int? MaxPromptTokens { get; } + /// The maximum number of completion tokens specified to have been used over the course of the run. + public int? MaxCompletionTokens { get; } + /// The strategy to use for dropping messages as the context windows moves forward. + public TruncationObject TruncationStrategy { get; } + /// + /// Controls whether or not and which tool is called by the model. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// + /// Supported types: + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + public BinaryData ToolChoice { get; } + /// + /// The response format of the tool calls used in this run. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// + /// Supported types: + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + public BinaryData ResponseFormat { get; } + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + public IReadOnlyDictionary Metadata { get; } + /// Override the tools the agent can use for this run. This is useful for modifying the behavior on a per-run basis. + public UpdateToolResourcesOptions ToolResources { get; } + /// Determines if tools can be executed in parallel within the run. + public bool ParallelToolCalls { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadRunObject.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadRunObject.cs new file mode 100644 index 000000000000..accefe5cf346 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadRunObject.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// The ThreadRun_object. + public readonly partial struct ThreadRunObject : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ThreadRunObject(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ThreadRunValue = "thread.run"; + + /// thread.run. + public static ThreadRunObject ThreadRun { get; } = new ThreadRunObject(ThreadRunValue); + /// Determines if two values are the same. + public static bool operator ==(ThreadRunObject left, ThreadRunObject right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ThreadRunObject left, ThreadRunObject right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ThreadRunObject(string value) => new ThreadRunObject(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ThreadRunObject other && Equals(other); + /// + public bool Equals(ThreadRunObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadStreamEvent.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadStreamEvent.cs new file mode 100644 index 000000000000..abbd47ff4fdb --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/ThreadStreamEvent.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// Thread operation related streaming events. + public readonly partial struct ThreadStreamEvent : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ThreadStreamEvent(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ThreadCreatedValue = "thread.created"; + + /// Event sent when a new thread is created. The data of this event is of type AgentThread. + public static ThreadStreamEvent ThreadCreated { get; } = new ThreadStreamEvent(ThreadCreatedValue); + /// Determines if two values are the same. + public static bool operator ==(ThreadStreamEvent left, ThreadStreamEvent right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ThreadStreamEvent left, ThreadStreamEvent right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ThreadStreamEvent(string value) => new ThreadStreamEvent(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ThreadStreamEvent other && Equals(other); + /// + public bool Equals(ThreadStreamEvent other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/ToolConnection.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/ToolConnection.Serialization.cs new file mode 100644 index 000000000000..59df3cb2a28e --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/ToolConnection.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class ToolConnection : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ToolConnection)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("connection_id"u8); + writer.WriteStringValue(ConnectionId); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ToolConnection IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ToolConnection)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeToolConnection(document.RootElement, options); + } + + internal static ToolConnection DeserializeToolConnection(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string connectionId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("connection_id"u8)) + { + connectionId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ToolConnection(connectionId, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ToolConnection)} does not support writing '{options.Format}' format."); + } + } + + ToolConnection IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeToolConnection(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ToolConnection)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ToolConnection FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeToolConnection(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/ToolConnection.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/ToolConnection.cs new file mode 100644 index 000000000000..6686fd5fc953 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/ToolConnection.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// A connection resource. + public partial class ToolConnection + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// A connection in a ToolConnectionList attached to this tool. + /// is null. + public ToolConnection(string connectionId) + { + Argument.AssertNotNull(connectionId, nameof(connectionId)); + + ConnectionId = connectionId; + } + + /// Initializes a new instance of . + /// A connection in a ToolConnectionList attached to this tool. + /// Keeps track of any properties unknown to the library. + internal ToolConnection(string connectionId, IDictionary serializedAdditionalRawData) + { + ConnectionId = connectionId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ToolConnection() + { + } + + /// A connection in a ToolConnectionList attached to this tool. + public string ConnectionId { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/ToolConnectionList.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/ToolConnectionList.Serialization.cs new file mode 100644 index 000000000000..634b57c2f515 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/ToolConnectionList.Serialization.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class ToolConnectionList : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ToolConnectionList)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(ConnectionList)) + { + writer.WritePropertyName("connections"u8); + writer.WriteStartArray(); + foreach (var item in ConnectionList) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ToolConnectionList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ToolConnectionList)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeToolConnectionList(document.RootElement, options); + } + + internal static ToolConnectionList DeserializeToolConnectionList(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList connections = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("connections"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ToolConnection.DeserializeToolConnection(item, options)); + } + connections = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ToolConnectionList(connections ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ToolConnectionList)} does not support writing '{options.Format}' format."); + } + } + + ToolConnectionList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeToolConnectionList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ToolConnectionList)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ToolConnectionList FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeToolConnectionList(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/ToolConnectionList.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/ToolConnectionList.cs new file mode 100644 index 000000000000..fd832463bb56 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/ToolConnectionList.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// A set of connection resources currently used by either the `bing_grounding`, `fabric_dataagent`, or `sharepoint_grounding` tools. + public partial class ToolConnectionList + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ToolConnectionList() + { + ConnectionList = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// + /// The connections attached to this tool. There can be a maximum of 1 connection + /// resource attached to the tool. + /// + /// Keeps track of any properties unknown to the library. + internal ToolConnectionList(IList connectionList, IDictionary serializedAdditionalRawData) + { + ConnectionList = connectionList; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// + /// The connections attached to this tool. There can be a maximum of 1 connection + /// resource attached to the tool. + /// + public IList ConnectionList { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/ToolDefinition.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/ToolDefinition.Serialization.cs new file mode 100644 index 000000000000..226ffef67ebd --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/ToolDefinition.Serialization.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + [PersistableModelProxy(typeof(UnknownToolDefinition))] + public partial class ToolDefinition : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ToolDefinition)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ToolDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ToolDefinition)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeToolDefinition(document.RootElement, options); + } + + internal static ToolDefinition DeserializeToolDefinition(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("type", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "azure_ai_search": return AzureAISearchToolDefinition.DeserializeAzureAISearchToolDefinition(element, options); + case "azure_function": return AzureFunctionToolDefinition.DeserializeAzureFunctionToolDefinition(element, options); + case "bing_grounding": return BingGroundingToolDefinition.DeserializeBingGroundingToolDefinition(element, options); + case "code_interpreter": return CodeInterpreterToolDefinition.DeserializeCodeInterpreterToolDefinition(element, options); + case "fabric_dataagent": return MicrosoftFabricToolDefinition.DeserializeMicrosoftFabricToolDefinition(element, options); + case "file_search": return FileSearchToolDefinition.DeserializeFileSearchToolDefinition(element, options); + case "function": return FunctionToolDefinition.DeserializeFunctionToolDefinition(element, options); + case "openapi": return OpenApiToolDefinition.DeserializeOpenApiToolDefinition(element, options); + case "sharepoint_grounding": return SharepointToolDefinition.DeserializeSharepointToolDefinition(element, options); + } + } + return UnknownToolDefinition.DeserializeUnknownToolDefinition(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ToolDefinition)} does not support writing '{options.Format}' format."); + } + } + + ToolDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeToolDefinition(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ToolDefinition)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ToolDefinition FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeToolDefinition(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/ToolDefinition.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/ToolDefinition.cs new file mode 100644 index 000000000000..1b5d1a0eeb38 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/ToolDefinition.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// + /// An abstract representation of an input tool definition that an agent can use. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , and . + /// + public abstract partial class ToolDefinition + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + protected ToolDefinition() + { + } + + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + internal ToolDefinition(string type, IDictionary serializedAdditionalRawData) + { + Type = type; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The object type. + internal string Type { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/ToolOutput.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/ToolOutput.Serialization.cs new file mode 100644 index 000000000000..4e9c7f4e084d --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/ToolOutput.Serialization.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class ToolOutput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ToolOutput)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ToolCallId)) + { + writer.WritePropertyName("tool_call_id"u8); + writer.WriteStringValue(ToolCallId); + } + if (Optional.IsDefined(Output)) + { + writer.WritePropertyName("output"u8); + writer.WriteStringValue(Output); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ToolOutput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ToolOutput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeToolOutput(document.RootElement, options); + } + + internal static ToolOutput DeserializeToolOutput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string toolCallId = default; + string output = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tool_call_id"u8)) + { + toolCallId = property.Value.GetString(); + continue; + } + if (property.NameEquals("output"u8)) + { + output = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ToolOutput(toolCallId, output, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ToolOutput)} does not support writing '{options.Format}' format."); + } + } + + ToolOutput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeToolOutput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ToolOutput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ToolOutput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeToolOutput(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/ToolOutput.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/ToolOutput.cs new file mode 100644 index 000000000000..a7c74c681e65 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/ToolOutput.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The data provided during a tool outputs submission to resolve pending tool calls and allow the model to continue. + public partial class ToolOutput + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ToolOutput() + { + } + + /// Initializes a new instance of . + /// The ID of the tool call being resolved, as provided in the tool calls of a required action from a run. + /// The output from the tool to be submitted. + /// Keeps track of any properties unknown to the library. + internal ToolOutput(string toolCallId, string output, IDictionary serializedAdditionalRawData) + { + ToolCallId = toolCallId; + Output = output; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The ID of the tool call being resolved, as provided in the tool calls of a required action from a run. + public string ToolCallId { get; set; } + /// The output from the tool to be submitted. + public string Output { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/ToolResources.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/ToolResources.Serialization.cs new file mode 100644 index 000000000000..bc8b2bfb03ed --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/ToolResources.Serialization.cs @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class ToolResources : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ToolResources)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(CodeInterpreter)) + { + writer.WritePropertyName("code_interpreter"u8); + writer.WriteObjectValue(CodeInterpreter, options); + } + if (Optional.IsDefined(FileSearch)) + { + writer.WritePropertyName("file_search"u8); + writer.WriteObjectValue(FileSearch, options); + } + if (Optional.IsDefined(AzureAISearch)) + { + writer.WritePropertyName("azure_ai_search"u8); + writer.WriteObjectValue(AzureAISearch, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ToolResources IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ToolResources)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeToolResources(document.RootElement, options); + } + + internal static ToolResources DeserializeToolResources(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CodeInterpreterToolResource codeInterpreter = default; + FileSearchToolResource fileSearch = default; + AzureAISearchResource azureAiSearch = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("code_interpreter"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + codeInterpreter = CodeInterpreterToolResource.DeserializeCodeInterpreterToolResource(property.Value, options); + continue; + } + if (property.NameEquals("file_search"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + fileSearch = FileSearchToolResource.DeserializeFileSearchToolResource(property.Value, options); + continue; + } + if (property.NameEquals("azure_ai_search"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + azureAiSearch = AzureAISearchResource.DeserializeAzureAISearchResource(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ToolResources(codeInterpreter, fileSearch, azureAiSearch, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ToolResources)} does not support writing '{options.Format}' format."); + } + } + + ToolResources IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeToolResources(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ToolResources)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ToolResources FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeToolResources(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/ToolResources.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/ToolResources.cs new file mode 100644 index 000000000000..cf944fee6a23 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/ToolResources.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// + /// A set of resources that are used by the agent's tools. The resources are specific to the type of + /// tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` + /// tool requires a list of vector store IDs. + /// + public partial class ToolResources + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ToolResources() + { + } + + /// Initializes a new instance of . + /// Resources to be used by the `code_interpreter` tool consisting of file IDs. + /// Resources to be used by the `file_search` tool consisting of vector store IDs. + /// Resources to be used by the `azure_ai_search` tool consisting of index IDs and names. + /// Keeps track of any properties unknown to the library. + internal ToolResources(CodeInterpreterToolResource codeInterpreter, FileSearchToolResource fileSearch, AzureAISearchResource azureAISearch, IDictionary serializedAdditionalRawData) + { + CodeInterpreter = codeInterpreter; + FileSearch = fileSearch; + AzureAISearch = azureAISearch; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Resources to be used by the `code_interpreter` tool consisting of file IDs. + public CodeInterpreterToolResource CodeInterpreter { get; set; } + /// Resources to be used by the `file_search` tool consisting of vector store IDs. + public FileSearchToolResource FileSearch { get; set; } + /// Resources to be used by the `azure_ai_search` tool consisting of index IDs and names. + public AzureAISearchResource AzureAISearch { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/TruncationObject.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/TruncationObject.Serialization.cs new file mode 100644 index 000000000000..7397fe69e64f --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/TruncationObject.Serialization.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class TruncationObject : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TruncationObject)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type.ToString()); + if (Optional.IsDefined(LastMessages)) + { + if (LastMessages != null) + { + writer.WritePropertyName("last_messages"u8); + writer.WriteNumberValue(LastMessages.Value); + } + else + { + writer.WriteNull("last_messages"); + } + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TruncationObject IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TruncationObject)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTruncationObject(document.RootElement, options); + } + + internal static TruncationObject DeserializeTruncationObject(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + TruncationStrategy type = default; + int? lastMessages = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new TruncationStrategy(property.Value.GetString()); + continue; + } + if (property.NameEquals("last_messages"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + lastMessages = null; + continue; + } + lastMessages = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TruncationObject(type, lastMessages, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TruncationObject)} does not support writing '{options.Format}' format."); + } + } + + TruncationObject IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTruncationObject(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TruncationObject)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static TruncationObject FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTruncationObject(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/TruncationObject.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/TruncationObject.cs new file mode 100644 index 000000000000..4627bc519488 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/TruncationObject.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// + /// Controls for how a thread will be truncated prior to the run. Use this to control the initial + /// context window of the run. + /// + public partial class TruncationObject + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// + /// The truncation strategy to use for the thread. The default is `auto`. If set to `last_messages`, the thread will + /// be truncated to the `lastMessages` count most recent messages in the thread. When set to `auto`, messages in the middle of the thread + /// will be dropped to fit the context length of the model, `max_prompt_tokens`. + /// + public TruncationObject(TruncationStrategy type) + { + Type = type; + } + + /// Initializes a new instance of . + /// + /// The truncation strategy to use for the thread. The default is `auto`. If set to `last_messages`, the thread will + /// be truncated to the `lastMessages` count most recent messages in the thread. When set to `auto`, messages in the middle of the thread + /// will be dropped to fit the context length of the model, `max_prompt_tokens`. + /// + /// The number of most recent messages from the thread when constructing the context for the run. + /// Keeps track of any properties unknown to the library. + internal TruncationObject(TruncationStrategy type, int? lastMessages, IDictionary serializedAdditionalRawData) + { + Type = type; + LastMessages = lastMessages; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TruncationObject() + { + } + + /// + /// The truncation strategy to use for the thread. The default is `auto`. If set to `last_messages`, the thread will + /// be truncated to the `lastMessages` count most recent messages in the thread. When set to `auto`, messages in the middle of the thread + /// will be dropped to fit the context length of the model, `max_prompt_tokens`. + /// + public TruncationStrategy Type { get; set; } + /// The number of most recent messages from the thread when constructing the context for the run. + public int? LastMessages { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/TruncationStrategy.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/TruncationStrategy.cs new file mode 100644 index 000000000000..c3f0bdb39690 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/TruncationStrategy.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// Possible truncation strategies for the thread. + public readonly partial struct TruncationStrategy : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TruncationStrategy(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AutoValue = "auto"; + private const string LastMessagesValue = "last_messages"; + + /// Default value. Messages in the middle of the thread will be dropped to fit the context length of the model. + public static TruncationStrategy Auto { get; } = new TruncationStrategy(AutoValue); + /// The thread will truncate to the `lastMessages` count of recent messages. + public static TruncationStrategy LastMessages { get; } = new TruncationStrategy(LastMessagesValue); + /// Determines if two values are the same. + public static bool operator ==(TruncationStrategy left, TruncationStrategy right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TruncationStrategy left, TruncationStrategy right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator TruncationStrategy(string value) => new TruncationStrategy(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TruncationStrategy other && Equals(other); + /// + public bool Equals(TruncationStrategy other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownMessageContent.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownMessageContent.Serialization.cs new file mode 100644 index 000000000000..5e25856c4dfc --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownMessageContent.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class UnknownMessageContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageContent)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + MessageContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMessageContent(document.RootElement, options); + } + + internal static UnknownMessageContent DeserializeUnknownMessageContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string type = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownMessageContent(type, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MessageContent)} does not support writing '{options.Format}' format."); + } + } + + MessageContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MessageContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownMessageContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUnknownMessageContent(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownMessageContent.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownMessageContent.cs new file mode 100644 index 000000000000..8663dccc1e4f --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownMessageContent.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Unknown version of MessageContent. + internal partial class UnknownMessageContent : MessageContent + { + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + internal UnknownMessageContent(string type, IDictionary serializedAdditionalRawData) : base(type, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownMessageContent() + { + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownMessageDeltaContent.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownMessageDeltaContent.Serialization.cs new file mode 100644 index 000000000000..8aa335b26dd3 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownMessageDeltaContent.Serialization.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class UnknownMessageDeltaContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageDeltaContent)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + MessageDeltaContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageDeltaContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMessageDeltaContent(document.RootElement, options); + } + + internal static UnknownMessageDeltaContent DeserializeUnknownMessageDeltaContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int index = default; + string type = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("index"u8)) + { + index = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownMessageDeltaContent(index, type, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MessageDeltaContent)} does not support writing '{options.Format}' format."); + } + } + + MessageDeltaContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageDeltaContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MessageDeltaContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownMessageDeltaContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUnknownMessageDeltaContent(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownMessageDeltaContent.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownMessageDeltaContent.cs new file mode 100644 index 000000000000..c5493ca30dfd --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownMessageDeltaContent.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Unknown version of MessageDeltaContent. + internal partial class UnknownMessageDeltaContent : MessageDeltaContent + { + /// Initializes a new instance of . + /// The index of the content part of the message. + /// The type of content for this content part. + /// Keeps track of any properties unknown to the library. + internal UnknownMessageDeltaContent(int index, string type, IDictionary serializedAdditionalRawData) : base(index, type, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownMessageDeltaContent() + { + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownMessageDeltaTextAnnotation.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownMessageDeltaTextAnnotation.Serialization.cs new file mode 100644 index 000000000000..2a570d5f2944 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownMessageDeltaTextAnnotation.Serialization.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class UnknownMessageDeltaTextAnnotation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageDeltaTextAnnotation)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + MessageDeltaTextAnnotation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageDeltaTextAnnotation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMessageDeltaTextAnnotation(document.RootElement, options); + } + + internal static UnknownMessageDeltaTextAnnotation DeserializeUnknownMessageDeltaTextAnnotation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int index = default; + string type = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("index"u8)) + { + index = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownMessageDeltaTextAnnotation(index, type, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MessageDeltaTextAnnotation)} does not support writing '{options.Format}' format."); + } + } + + MessageDeltaTextAnnotation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageDeltaTextAnnotation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MessageDeltaTextAnnotation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownMessageDeltaTextAnnotation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUnknownMessageDeltaTextAnnotation(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownMessageDeltaTextAnnotation.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownMessageDeltaTextAnnotation.cs new file mode 100644 index 000000000000..052ae5d52578 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownMessageDeltaTextAnnotation.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Unknown version of MessageDeltaTextAnnotation. + internal partial class UnknownMessageDeltaTextAnnotation : MessageDeltaTextAnnotation + { + /// Initializes a new instance of . + /// The index of the annotation within a text content part. + /// The type of the text content annotation. + /// Keeps track of any properties unknown to the library. + internal UnknownMessageDeltaTextAnnotation(int index, string type, IDictionary serializedAdditionalRawData) : base(index, type, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownMessageDeltaTextAnnotation() + { + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownMessageTextAnnotation.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownMessageTextAnnotation.Serialization.cs new file mode 100644 index 000000000000..d34a1162b425 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownMessageTextAnnotation.Serialization.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class UnknownMessageTextAnnotation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageTextAnnotation)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + MessageTextAnnotation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MessageTextAnnotation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMessageTextAnnotation(document.RootElement, options); + } + + internal static UnknownMessageTextAnnotation DeserializeUnknownMessageTextAnnotation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string type = "Unknown"; + string text = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownMessageTextAnnotation(type, text, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MessageTextAnnotation)} does not support writing '{options.Format}' format."); + } + } + + MessageTextAnnotation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMessageTextAnnotation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MessageTextAnnotation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownMessageTextAnnotation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUnknownMessageTextAnnotation(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownMessageTextAnnotation.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownMessageTextAnnotation.cs new file mode 100644 index 000000000000..c2fa1f196cfb --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownMessageTextAnnotation.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Unknown version of MessageTextAnnotation. + internal partial class UnknownMessageTextAnnotation : MessageTextAnnotation + { + /// Initializes a new instance of . + /// The object type. + /// The textual content associated with this text annotation item. + /// Keeps track of any properties unknown to the library. + internal UnknownMessageTextAnnotation(string type, string text, IDictionary serializedAdditionalRawData) : base(type, text, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownMessageTextAnnotation() + { + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownOpenApiAuthDetails.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownOpenApiAuthDetails.Serialization.cs new file mode 100644 index 000000000000..58014309d157 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownOpenApiAuthDetails.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class UnknownOpenApiAuthDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiAuthDetails)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + OpenApiAuthDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiAuthDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOpenApiAuthDetails(document.RootElement, options); + } + + internal static UnknownOpenApiAuthDetails DeserializeUnknownOpenApiAuthDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + OpenApiAuthType type = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new OpenApiAuthType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownOpenApiAuthDetails(type, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(OpenApiAuthDetails)} does not support writing '{options.Format}' format."); + } + } + + OpenApiAuthDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOpenApiAuthDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OpenApiAuthDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownOpenApiAuthDetails FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUnknownOpenApiAuthDetails(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownOpenApiAuthDetails.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownOpenApiAuthDetails.cs new file mode 100644 index 000000000000..dafb9f4da278 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownOpenApiAuthDetails.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Unknown version of OpenApiAuthDetails. + internal partial class UnknownOpenApiAuthDetails : OpenApiAuthDetails + { + /// Initializes a new instance of . + /// The type of authentication, must be anonymous/connection/managed_identity. + /// Keeps track of any properties unknown to the library. + internal UnknownOpenApiAuthDetails(OpenApiAuthType type, IDictionary serializedAdditionalRawData) : base(type, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownOpenApiAuthDetails() + { + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRequiredAction.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRequiredAction.Serialization.cs new file mode 100644 index 000000000000..59ff3a993335 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRequiredAction.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class UnknownRequiredAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RequiredAction)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + RequiredAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RequiredAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRequiredAction(document.RootElement, options); + } + + internal static UnknownRequiredAction DeserializeUnknownRequiredAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string type = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownRequiredAction(type, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RequiredAction)} does not support writing '{options.Format}' format."); + } + } + + RequiredAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRequiredAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RequiredAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownRequiredAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUnknownRequiredAction(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRequiredAction.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRequiredAction.cs new file mode 100644 index 000000000000..cba1a84c1071 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRequiredAction.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Unknown version of RequiredAction. + internal partial class UnknownRequiredAction : RequiredAction + { + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + internal UnknownRequiredAction(string type, IDictionary serializedAdditionalRawData) : base(type, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownRequiredAction() + { + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRequiredToolCall.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRequiredToolCall.Serialization.cs new file mode 100644 index 000000000000..15019ccb8417 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRequiredToolCall.Serialization.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class UnknownRequiredToolCall : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RequiredToolCall)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + RequiredToolCall IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RequiredToolCall)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRequiredToolCall(document.RootElement, options); + } + + internal static UnknownRequiredToolCall DeserializeUnknownRequiredToolCall(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string type = "Unknown"; + string id = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownRequiredToolCall(type, id, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RequiredToolCall)} does not support writing '{options.Format}' format."); + } + } + + RequiredToolCall IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRequiredToolCall(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RequiredToolCall)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownRequiredToolCall FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUnknownRequiredToolCall(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRequiredToolCall.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRequiredToolCall.cs new file mode 100644 index 000000000000..b1763d79ad05 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRequiredToolCall.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Unknown version of RequiredToolCall. + internal partial class UnknownRequiredToolCall : RequiredToolCall + { + /// Initializes a new instance of . + /// The object type for the required tool call. + /// The ID of the tool call. This ID must be referenced when submitting tool outputs. + /// Keeps track of any properties unknown to the library. + internal UnknownRequiredToolCall(string type, string id, IDictionary serializedAdditionalRawData) : base(type, id, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownRequiredToolCall() + { + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepCodeInterpreterToolCallOutput.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepCodeInterpreterToolCallOutput.Serialization.cs new file mode 100644 index 000000000000..c37cd8771fda --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepCodeInterpreterToolCallOutput.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class UnknownRunStepCodeInterpreterToolCallOutput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepCodeInterpreterToolCallOutput)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + RunStepCodeInterpreterToolCallOutput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepCodeInterpreterToolCallOutput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepCodeInterpreterToolCallOutput(document.RootElement, options); + } + + internal static UnknownRunStepCodeInterpreterToolCallOutput DeserializeUnknownRunStepCodeInterpreterToolCallOutput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string type = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownRunStepCodeInterpreterToolCallOutput(type, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepCodeInterpreterToolCallOutput)} does not support writing '{options.Format}' format."); + } + } + + RunStepCodeInterpreterToolCallOutput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepCodeInterpreterToolCallOutput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepCodeInterpreterToolCallOutput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownRunStepCodeInterpreterToolCallOutput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUnknownRunStepCodeInterpreterToolCallOutput(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepCodeInterpreterToolCallOutput.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepCodeInterpreterToolCallOutput.cs new file mode 100644 index 000000000000..57e20cd7621b --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepCodeInterpreterToolCallOutput.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Unknown version of RunStepCodeInterpreterToolCallOutput. + internal partial class UnknownRunStepCodeInterpreterToolCallOutput : RunStepCodeInterpreterToolCallOutput + { + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + internal UnknownRunStepCodeInterpreterToolCallOutput(string type, IDictionary serializedAdditionalRawData) : base(type, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownRunStepCodeInterpreterToolCallOutput() + { + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepDeltaCodeInterpreterOutput.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepDeltaCodeInterpreterOutput.Serialization.cs new file mode 100644 index 000000000000..24d5c007a4f8 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepDeltaCodeInterpreterOutput.Serialization.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class UnknownRunStepDeltaCodeInterpreterOutput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterOutput)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + RunStepDeltaCodeInterpreterOutput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterOutput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepDeltaCodeInterpreterOutput(document.RootElement, options); + } + + internal static UnknownRunStepDeltaCodeInterpreterOutput DeserializeUnknownRunStepDeltaCodeInterpreterOutput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int index = default; + string type = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("index"u8)) + { + index = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownRunStepDeltaCodeInterpreterOutput(index, type, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterOutput)} does not support writing '{options.Format}' format."); + } + } + + RunStepDeltaCodeInterpreterOutput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDeltaCodeInterpreterOutput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterOutput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownRunStepDeltaCodeInterpreterOutput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUnknownRunStepDeltaCodeInterpreterOutput(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepDeltaCodeInterpreterOutput.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepDeltaCodeInterpreterOutput.cs new file mode 100644 index 000000000000..d0b85556ee26 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepDeltaCodeInterpreterOutput.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Unknown version of RunStepDeltaCodeInterpreterOutput. + internal partial class UnknownRunStepDeltaCodeInterpreterOutput : RunStepDeltaCodeInterpreterOutput + { + /// Initializes a new instance of . + /// The index of the output in the streaming run step tool call's Code Interpreter outputs array. + /// The type of the streaming run step tool call's Code Interpreter output. + /// Keeps track of any properties unknown to the library. + internal UnknownRunStepDeltaCodeInterpreterOutput(int index, string type, IDictionary serializedAdditionalRawData) : base(index, type, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownRunStepDeltaCodeInterpreterOutput() + { + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepDeltaDetail.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepDeltaDetail.Serialization.cs new file mode 100644 index 000000000000..96e2dda3ea7b --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepDeltaDetail.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class UnknownRunStepDeltaDetail : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaDetail)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + RunStepDeltaDetail IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaDetail)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepDeltaDetail(document.RootElement, options); + } + + internal static UnknownRunStepDeltaDetail DeserializeUnknownRunStepDeltaDetail(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string type = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownRunStepDeltaDetail(type, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepDeltaDetail)} does not support writing '{options.Format}' format."); + } + } + + RunStepDeltaDetail IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDeltaDetail(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepDeltaDetail)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownRunStepDeltaDetail FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUnknownRunStepDeltaDetail(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepDeltaDetail.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepDeltaDetail.cs new file mode 100644 index 000000000000..148661b39a30 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepDeltaDetail.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Unknown version of RunStepDeltaDetail. + internal partial class UnknownRunStepDeltaDetail : RunStepDeltaDetail + { + /// Initializes a new instance of . + /// The object type for the run step detail object. + /// Keeps track of any properties unknown to the library. + internal UnknownRunStepDeltaDetail(string type, IDictionary serializedAdditionalRawData) : base(type, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownRunStepDeltaDetail() + { + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepDeltaToolCall.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepDeltaToolCall.Serialization.cs new file mode 100644 index 000000000000..36e14615bd77 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepDeltaToolCall.Serialization.cs @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class UnknownRunStepDeltaToolCall : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaToolCall)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + RunStepDeltaToolCall IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDeltaToolCall)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepDeltaToolCall(document.RootElement, options); + } + + internal static UnknownRunStepDeltaToolCall DeserializeUnknownRunStepDeltaToolCall(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int index = default; + string id = default; + string type = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("index"u8)) + { + index = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownRunStepDeltaToolCall(index, id, type, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepDeltaToolCall)} does not support writing '{options.Format}' format."); + } + } + + RunStepDeltaToolCall IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDeltaToolCall(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepDeltaToolCall)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownRunStepDeltaToolCall FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUnknownRunStepDeltaToolCall(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepDeltaToolCall.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepDeltaToolCall.cs new file mode 100644 index 000000000000..12d0aeb2720a --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepDeltaToolCall.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Unknown version of RunStepDeltaToolCall. + internal partial class UnknownRunStepDeltaToolCall : RunStepDeltaToolCall + { + /// Initializes a new instance of . + /// The index of the tool call detail in the run step's tool_calls array. + /// The ID of the tool call, used when submitting outputs to the run. + /// The type of the tool call detail item in a streaming run step's details. + /// Keeps track of any properties unknown to the library. + internal UnknownRunStepDeltaToolCall(int index, string id, string type, IDictionary serializedAdditionalRawData) : base(index, id, type, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownRunStepDeltaToolCall() + { + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepDetails.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepDetails.Serialization.cs new file mode 100644 index 000000000000..8e79f9ccff57 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepDetails.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class UnknownRunStepDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDetails)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + RunStepDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepDetails(document.RootElement, options); + } + + internal static UnknownRunStepDetails DeserializeUnknownRunStepDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RunStepType type = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new RunStepType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownRunStepDetails(type, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepDetails)} does not support writing '{options.Format}' format."); + } + } + + RunStepDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownRunStepDetails FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUnknownRunStepDetails(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepDetails.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepDetails.cs new file mode 100644 index 000000000000..08f1d29868d3 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepDetails.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Unknown version of RunStepDetails. + internal partial class UnknownRunStepDetails : RunStepDetails + { + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + internal UnknownRunStepDetails(RunStepType type, IDictionary serializedAdditionalRawData) : base(type, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownRunStepDetails() + { + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepToolCall.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepToolCall.Serialization.cs new file mode 100644 index 000000000000..d277e05c2ae6 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepToolCall.Serialization.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class UnknownRunStepToolCall : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepToolCall)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + RunStepToolCall IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunStepToolCall)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunStepToolCall(document.RootElement, options); + } + + internal static UnknownRunStepToolCall DeserializeUnknownRunStepToolCall(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string type = "Unknown"; + string id = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownRunStepToolCall(type, id, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RunStepToolCall)} does not support writing '{options.Format}' format."); + } + } + + RunStepToolCall IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRunStepToolCall(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunStepToolCall)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownRunStepToolCall FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUnknownRunStepToolCall(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepToolCall.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepToolCall.cs new file mode 100644 index 000000000000..6954a31475f8 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownRunStepToolCall.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Unknown version of RunStepToolCall. + internal partial class UnknownRunStepToolCall : RunStepToolCall + { + /// Initializes a new instance of . + /// The object type. + /// The ID of the tool call. This ID must be referenced when you submit tool outputs. + /// Keeps track of any properties unknown to the library. + internal UnknownRunStepToolCall(string type, string id, IDictionary serializedAdditionalRawData) : base(type, id, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownRunStepToolCall() + { + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownToolDefinition.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownToolDefinition.Serialization.cs new file mode 100644 index 000000000000..3c2c81939d74 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownToolDefinition.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class UnknownToolDefinition : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ToolDefinition)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + ToolDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ToolDefinition)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeToolDefinition(document.RootElement, options); + } + + internal static UnknownToolDefinition DeserializeUnknownToolDefinition(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string type = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownToolDefinition(type, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ToolDefinition)} does not support writing '{options.Format}' format."); + } + } + + ToolDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeToolDefinition(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ToolDefinition)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownToolDefinition FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUnknownToolDefinition(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownToolDefinition.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownToolDefinition.cs new file mode 100644 index 000000000000..d2955539e405 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownToolDefinition.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Unknown version of ToolDefinition. + internal partial class UnknownToolDefinition : ToolDefinition + { + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + internal UnknownToolDefinition(string type, IDictionary serializedAdditionalRawData) : base(type, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownToolDefinition() + { + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownVectorStoreChunkingStrategyRequest.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownVectorStoreChunkingStrategyRequest.Serialization.cs new file mode 100644 index 000000000000..7f9532d9ea86 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownVectorStoreChunkingStrategyRequest.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class UnknownVectorStoreChunkingStrategyRequest : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreChunkingStrategyRequest)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + VectorStoreChunkingStrategyRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreChunkingStrategyRequest)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVectorStoreChunkingStrategyRequest(document.RootElement, options); + } + + internal static UnknownVectorStoreChunkingStrategyRequest DeserializeUnknownVectorStoreChunkingStrategyRequest(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + VectorStoreChunkingStrategyRequestType type = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new VectorStoreChunkingStrategyRequestType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownVectorStoreChunkingStrategyRequest(type, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(VectorStoreChunkingStrategyRequest)} does not support writing '{options.Format}' format."); + } + } + + VectorStoreChunkingStrategyRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreChunkingStrategyRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VectorStoreChunkingStrategyRequest)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownVectorStoreChunkingStrategyRequest FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUnknownVectorStoreChunkingStrategyRequest(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownVectorStoreChunkingStrategyRequest.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownVectorStoreChunkingStrategyRequest.cs new file mode 100644 index 000000000000..5f0e095e40db --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownVectorStoreChunkingStrategyRequest.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Unknown version of VectorStoreChunkingStrategyRequest. + internal partial class UnknownVectorStoreChunkingStrategyRequest : VectorStoreChunkingStrategyRequest + { + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + internal UnknownVectorStoreChunkingStrategyRequest(VectorStoreChunkingStrategyRequestType type, IDictionary serializedAdditionalRawData) : base(type, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownVectorStoreChunkingStrategyRequest() + { + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownVectorStoreChunkingStrategyResponse.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownVectorStoreChunkingStrategyResponse.Serialization.cs new file mode 100644 index 000000000000..0fa211812396 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownVectorStoreChunkingStrategyResponse.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class UnknownVectorStoreChunkingStrategyResponse : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreChunkingStrategyResponse)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + VectorStoreChunkingStrategyResponse IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreChunkingStrategyResponse)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVectorStoreChunkingStrategyResponse(document.RootElement, options); + } + + internal static UnknownVectorStoreChunkingStrategyResponse DeserializeUnknownVectorStoreChunkingStrategyResponse(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + VectorStoreChunkingStrategyResponseType type = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new VectorStoreChunkingStrategyResponseType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownVectorStoreChunkingStrategyResponse(type, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(VectorStoreChunkingStrategyResponse)} does not support writing '{options.Format}' format."); + } + } + + VectorStoreChunkingStrategyResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreChunkingStrategyResponse(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VectorStoreChunkingStrategyResponse)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownVectorStoreChunkingStrategyResponse FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUnknownVectorStoreChunkingStrategyResponse(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownVectorStoreChunkingStrategyResponse.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownVectorStoreChunkingStrategyResponse.cs new file mode 100644 index 000000000000..245b7298b020 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UnknownVectorStoreChunkingStrategyResponse.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Unknown version of VectorStoreChunkingStrategyResponse. + internal partial class UnknownVectorStoreChunkingStrategyResponse : VectorStoreChunkingStrategyResponse + { + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + internal UnknownVectorStoreChunkingStrategyResponse(VectorStoreChunkingStrategyResponseType type, IDictionary serializedAdditionalRawData) : base(type, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownVectorStoreChunkingStrategyResponse() + { + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateAgentRequest.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateAgentRequest.Serialization.cs new file mode 100644 index 000000000000..f504132f2dbf --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateAgentRequest.Serialization.cs @@ -0,0 +1,374 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class UpdateAgentRequest : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(UpdateAgentRequest)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Model)) + { + writer.WritePropertyName("model"u8); + writer.WriteStringValue(Model); + } + if (Optional.IsDefined(Name)) + { + if (Name != null) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + else + { + writer.WriteNull("name"); + } + } + if (Optional.IsDefined(Description)) + { + if (Description != null) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + else + { + writer.WriteNull("description"); + } + } + if (Optional.IsDefined(Instructions)) + { + if (Instructions != null) + { + writer.WritePropertyName("instructions"u8); + writer.WriteStringValue(Instructions); + } + else + { + writer.WriteNull("instructions"); + } + } + if (Optional.IsCollectionDefined(Tools)) + { + writer.WritePropertyName("tools"u8); + writer.WriteStartArray(); + foreach (var item in Tools) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(ToolResources)) + { + writer.WritePropertyName("tool_resources"u8); + writer.WriteObjectValue(ToolResources, options); + } + if (Optional.IsDefined(Temperature)) + { + if (Temperature != null) + { + writer.WritePropertyName("temperature"u8); + writer.WriteNumberValue(Temperature.Value); + } + else + { + writer.WriteNull("temperature"); + } + } + if (Optional.IsDefined(TopP)) + { + if (TopP != null) + { + writer.WritePropertyName("top_p"u8); + writer.WriteNumberValue(TopP.Value); + } + else + { + writer.WriteNull("top_p"); + } + } + if (Optional.IsDefined(ResponseFormat)) + { + if (ResponseFormat != null) + { + writer.WritePropertyName("response_format"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(ResponseFormat); +#else + using (JsonDocument document = JsonDocument.Parse(ResponseFormat, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + else + { + writer.WriteNull("response_format"); + } + } + if (Optional.IsCollectionDefined(Metadata)) + { + if (Metadata != null) + { + writer.WritePropertyName("metadata"u8); + writer.WriteStartObject(); + foreach (var item in Metadata) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + else + { + writer.WriteNull("metadata"); + } + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + UpdateAgentRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(UpdateAgentRequest)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeUpdateAgentRequest(document.RootElement, options); + } + + internal static UpdateAgentRequest DeserializeUpdateAgentRequest(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string model = default; + string name = default; + string description = default; + string instructions = default; + IReadOnlyList tools = default; + ToolResources toolResources = default; + float? temperature = default; + float? topP = default; + BinaryData responseFormat = default; + IReadOnlyDictionary metadata = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("model"u8)) + { + model = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + name = null; + continue; + } + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + description = null; + continue; + } + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("instructions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + instructions = null; + continue; + } + instructions = property.Value.GetString(); + continue; + } + if (property.NameEquals("tools"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ToolDefinition.DeserializeToolDefinition(item, options)); + } + tools = array; + continue; + } + if (property.NameEquals("tool_resources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + toolResources = ToolResources.DeserializeToolResources(property.Value, options); + continue; + } + if (property.NameEquals("temperature"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + temperature = null; + continue; + } + temperature = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("top_p"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + topP = null; + continue; + } + topP = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("response_format"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + responseFormat = null; + continue; + } + responseFormat = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + metadata = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UpdateAgentRequest( + model, + name, + description, + instructions, + tools ?? new ChangeTrackingList(), + toolResources, + temperature, + topP, + responseFormat, + metadata ?? new ChangeTrackingDictionary(), + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(UpdateAgentRequest)} does not support writing '{options.Format}' format."); + } + } + + UpdateAgentRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUpdateAgentRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(UpdateAgentRequest)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static UpdateAgentRequest FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUpdateAgentRequest(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateAgentRequest.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateAgentRequest.cs new file mode 100644 index 000000000000..8f78a0944696 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateAgentRequest.cs @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The UpdateAgentRequest. + internal partial class UpdateAgentRequest + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal UpdateAgentRequest() + { + Tools = new ChangeTrackingList(); + Metadata = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The ID of the model to use. + /// The modified name for the agent to use. + /// The modified description for the agent to use. + /// The modified system instructions for the new agent to use. + /// + /// The modified collection of tools to enable for the agent. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , and . + /// + /// + /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, + /// the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. + /// + /// + /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, + /// while lower values like 0.2 will make it more focused and deterministic. + /// + /// + /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. + /// So 0.1 means only the tokens comprising the top 10% probability mass are considered. + /// + /// We generally recommend altering this or temperature but not both. + /// + /// The response format of the tool calls used by this agent. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// Keeps track of any properties unknown to the library. + internal UpdateAgentRequest(string model, string name, string description, string instructions, IReadOnlyList tools, ToolResources toolResources, float? temperature, float? topP, BinaryData responseFormat, IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) + { + Model = model; + Name = name; + Description = description; + Instructions = instructions; + Tools = tools; + ToolResources = toolResources; + Temperature = temperature; + TopP = topP; + ResponseFormat = responseFormat; + Metadata = metadata; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The ID of the model to use. + public string Model { get; } + /// The modified name for the agent to use. + public string Name { get; } + /// The modified description for the agent to use. + public string Description { get; } + /// The modified system instructions for the new agent to use. + public string Instructions { get; } + /// + /// The modified collection of tools to enable for the agent. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , and . + /// + public IReadOnlyList Tools { get; } + /// + /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, + /// the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. + /// + public ToolResources ToolResources { get; } + /// + /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, + /// while lower values like 0.2 will make it more focused and deterministic. + /// + public float? Temperature { get; } + /// + /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. + /// So 0.1 means only the tokens comprising the top 10% probability mass are considered. + /// + /// We generally recommend altering this or temperature but not both. + /// + public float? TopP { get; } + /// + /// The response format of the tool calls used by this agent. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// + /// Supported types: + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + public BinaryData ResponseFormat { get; } + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + public IReadOnlyDictionary Metadata { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateCodeInterpreterToolResourceOptions.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateCodeInterpreterToolResourceOptions.Serialization.cs new file mode 100644 index 000000000000..f2747a2dfdfc --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateCodeInterpreterToolResourceOptions.Serialization.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class UpdateCodeInterpreterToolResourceOptions : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(UpdateCodeInterpreterToolResourceOptions)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(FileIds)) + { + writer.WritePropertyName("file_ids"u8); + writer.WriteStartArray(); + foreach (var item in FileIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + UpdateCodeInterpreterToolResourceOptions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(UpdateCodeInterpreterToolResourceOptions)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeUpdateCodeInterpreterToolResourceOptions(document.RootElement, options); + } + + internal static UpdateCodeInterpreterToolResourceOptions DeserializeUpdateCodeInterpreterToolResourceOptions(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList fileIds = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("file_ids"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + fileIds = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UpdateCodeInterpreterToolResourceOptions(fileIds ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(UpdateCodeInterpreterToolResourceOptions)} does not support writing '{options.Format}' format."); + } + } + + UpdateCodeInterpreterToolResourceOptions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUpdateCodeInterpreterToolResourceOptions(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(UpdateCodeInterpreterToolResourceOptions)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static UpdateCodeInterpreterToolResourceOptions FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUpdateCodeInterpreterToolResourceOptions(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateCodeInterpreterToolResourceOptions.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateCodeInterpreterToolResourceOptions.cs new file mode 100644 index 000000000000..04cf8ff93dd6 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateCodeInterpreterToolResourceOptions.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Request object to update `code_interpreted` tool resources. + public partial class UpdateCodeInterpreterToolResourceOptions + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public UpdateCodeInterpreterToolResourceOptions() + { + FileIds = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// A list of file IDs to override the current list of the agent. + /// Keeps track of any properties unknown to the library. + internal UpdateCodeInterpreterToolResourceOptions(IList fileIds, IDictionary serializedAdditionalRawData) + { + FileIds = fileIds; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// A list of file IDs to override the current list of the agent. + public IList FileIds { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateFileSearchToolResourceOptions.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateFileSearchToolResourceOptions.Serialization.cs new file mode 100644 index 000000000000..6dc84e6a7b74 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateFileSearchToolResourceOptions.Serialization.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class UpdateFileSearchToolResourceOptions : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(UpdateFileSearchToolResourceOptions)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(VectorStoreIds)) + { + writer.WritePropertyName("vector_store_ids"u8); + writer.WriteStartArray(); + foreach (var item in VectorStoreIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + UpdateFileSearchToolResourceOptions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(UpdateFileSearchToolResourceOptions)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeUpdateFileSearchToolResourceOptions(document.RootElement, options); + } + + internal static UpdateFileSearchToolResourceOptions DeserializeUpdateFileSearchToolResourceOptions(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList vectorStoreIds = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("vector_store_ids"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + vectorStoreIds = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UpdateFileSearchToolResourceOptions(vectorStoreIds ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(UpdateFileSearchToolResourceOptions)} does not support writing '{options.Format}' format."); + } + } + + UpdateFileSearchToolResourceOptions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUpdateFileSearchToolResourceOptions(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(UpdateFileSearchToolResourceOptions)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static UpdateFileSearchToolResourceOptions FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUpdateFileSearchToolResourceOptions(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateFileSearchToolResourceOptions.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateFileSearchToolResourceOptions.cs new file mode 100644 index 000000000000..3df7b509dce2 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateFileSearchToolResourceOptions.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Request object to update `file_search` tool resources. + public partial class UpdateFileSearchToolResourceOptions + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public UpdateFileSearchToolResourceOptions() + { + VectorStoreIds = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// A list of vector store IDs to override the current list of the agent. + /// Keeps track of any properties unknown to the library. + internal UpdateFileSearchToolResourceOptions(IList vectorStoreIds, IDictionary serializedAdditionalRawData) + { + VectorStoreIds = vectorStoreIds; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// A list of vector store IDs to override the current list of the agent. + public IList VectorStoreIds { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateMessageRequest.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateMessageRequest.Serialization.cs new file mode 100644 index 000000000000..86a1b0c78e8f --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateMessageRequest.Serialization.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class UpdateMessageRequest : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(UpdateMessageRequest)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Metadata)) + { + if (Metadata != null) + { + writer.WritePropertyName("metadata"u8); + writer.WriteStartObject(); + foreach (var item in Metadata) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + else + { + writer.WriteNull("metadata"); + } + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + UpdateMessageRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(UpdateMessageRequest)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeUpdateMessageRequest(document.RootElement, options); + } + + internal static UpdateMessageRequest DeserializeUpdateMessageRequest(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyDictionary metadata = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + metadata = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UpdateMessageRequest(metadata ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(UpdateMessageRequest)} does not support writing '{options.Format}' format."); + } + } + + UpdateMessageRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUpdateMessageRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(UpdateMessageRequest)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static UpdateMessageRequest FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUpdateMessageRequest(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateMessageRequest.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateMessageRequest.cs new file mode 100644 index 000000000000..fbd6c0112235 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateMessageRequest.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The UpdateMessageRequest. + internal partial class UpdateMessageRequest + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal UpdateMessageRequest() + { + Metadata = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// Keeps track of any properties unknown to the library. + internal UpdateMessageRequest(IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) + { + Metadata = metadata; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + public IReadOnlyDictionary Metadata { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateRunRequest.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateRunRequest.Serialization.cs new file mode 100644 index 000000000000..5f2c3d261d1a --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateRunRequest.Serialization.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class UpdateRunRequest : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(UpdateRunRequest)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Metadata)) + { + if (Metadata != null) + { + writer.WritePropertyName("metadata"u8); + writer.WriteStartObject(); + foreach (var item in Metadata) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + else + { + writer.WriteNull("metadata"); + } + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + UpdateRunRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(UpdateRunRequest)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeUpdateRunRequest(document.RootElement, options); + } + + internal static UpdateRunRequest DeserializeUpdateRunRequest(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyDictionary metadata = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + metadata = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UpdateRunRequest(metadata ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(UpdateRunRequest)} does not support writing '{options.Format}' format."); + } + } + + UpdateRunRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUpdateRunRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(UpdateRunRequest)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static UpdateRunRequest FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUpdateRunRequest(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateRunRequest.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateRunRequest.cs new file mode 100644 index 000000000000..fd19e396e99a --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateRunRequest.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The UpdateRunRequest. + internal partial class UpdateRunRequest + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal UpdateRunRequest() + { + Metadata = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// Keeps track of any properties unknown to the library. + internal UpdateRunRequest(IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) + { + Metadata = metadata; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + public IReadOnlyDictionary Metadata { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateThreadRequest.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateThreadRequest.Serialization.cs new file mode 100644 index 000000000000..0586948fe021 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateThreadRequest.Serialization.cs @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + internal partial class UpdateThreadRequest : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(UpdateThreadRequest)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ToolResources)) + { + if (ToolResources != null) + { + writer.WritePropertyName("tool_resources"u8); + writer.WriteObjectValue(ToolResources, options); + } + else + { + writer.WriteNull("tool_resources"); + } + } + if (Optional.IsCollectionDefined(Metadata)) + { + if (Metadata != null) + { + writer.WritePropertyName("metadata"u8); + writer.WriteStartObject(); + foreach (var item in Metadata) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + else + { + writer.WriteNull("metadata"); + } + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + UpdateThreadRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(UpdateThreadRequest)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeUpdateThreadRequest(document.RootElement, options); + } + + internal static UpdateThreadRequest DeserializeUpdateThreadRequest(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ToolResources toolResources = default; + IReadOnlyDictionary metadata = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tool_resources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + toolResources = null; + continue; + } + toolResources = ToolResources.DeserializeToolResources(property.Value, options); + continue; + } + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + metadata = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UpdateThreadRequest(toolResources, metadata ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(UpdateThreadRequest)} does not support writing '{options.Format}' format."); + } + } + + UpdateThreadRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUpdateThreadRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(UpdateThreadRequest)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static UpdateThreadRequest FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUpdateThreadRequest(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateThreadRequest.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateThreadRequest.cs new file mode 100644 index 000000000000..4fbc13a2197e --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateThreadRequest.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The UpdateThreadRequest. + internal partial class UpdateThreadRequest + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal UpdateThreadRequest() + { + Metadata = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// + /// A set of resources that are made available to the agent's tools in this thread. The resources are specific to the + /// type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires + /// a list of vector store IDs + /// + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// Keeps track of any properties unknown to the library. + internal UpdateThreadRequest(ToolResources toolResources, IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) + { + ToolResources = toolResources; + Metadata = metadata; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// + /// A set of resources that are made available to the agent's tools in this thread. The resources are specific to the + /// type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires + /// a list of vector store IDs + /// + public ToolResources ToolResources { get; } + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + public IReadOnlyDictionary Metadata { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateToolResourcesOptions.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateToolResourcesOptions.Serialization.cs new file mode 100644 index 000000000000..6db85c679c82 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateToolResourcesOptions.Serialization.cs @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class UpdateToolResourcesOptions : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(UpdateToolResourcesOptions)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(CodeInterpreter)) + { + writer.WritePropertyName("code_interpreter"u8); + writer.WriteObjectValue(CodeInterpreter, options); + } + if (Optional.IsDefined(FileSearch)) + { + writer.WritePropertyName("file_search"u8); + writer.WriteObjectValue(FileSearch, options); + } + if (Optional.IsDefined(AzureAISearch)) + { + writer.WritePropertyName("azure_ai_search"u8); + writer.WriteObjectValue(AzureAISearch, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + UpdateToolResourcesOptions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(UpdateToolResourcesOptions)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeUpdateToolResourcesOptions(document.RootElement, options); + } + + internal static UpdateToolResourcesOptions DeserializeUpdateToolResourcesOptions(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + UpdateCodeInterpreterToolResourceOptions codeInterpreter = default; + UpdateFileSearchToolResourceOptions fileSearch = default; + AzureAISearchResource azureAiSearch = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("code_interpreter"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + codeInterpreter = UpdateCodeInterpreterToolResourceOptions.DeserializeUpdateCodeInterpreterToolResourceOptions(property.Value, options); + continue; + } + if (property.NameEquals("file_search"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + fileSearch = UpdateFileSearchToolResourceOptions.DeserializeUpdateFileSearchToolResourceOptions(property.Value, options); + continue; + } + if (property.NameEquals("azure_ai_search"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + azureAiSearch = AzureAISearchResource.DeserializeAzureAISearchResource(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UpdateToolResourcesOptions(codeInterpreter, fileSearch, azureAiSearch, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(UpdateToolResourcesOptions)} does not support writing '{options.Format}' format."); + } + } + + UpdateToolResourcesOptions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUpdateToolResourcesOptions(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(UpdateToolResourcesOptions)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static UpdateToolResourcesOptions FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUpdateToolResourcesOptions(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateToolResourcesOptions.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateToolResourcesOptions.cs new file mode 100644 index 000000000000..239eff3d55f7 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UpdateToolResourcesOptions.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// + /// Request object. A set of resources that are used by the agent's tools. The resources are specific to the type of tool. + /// For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of + /// vector store IDs. + /// + public partial class UpdateToolResourcesOptions + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public UpdateToolResourcesOptions() + { + } + + /// Initializes a new instance of . + /// + /// Overrides the list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files + /// associated with the tool. + /// + /// Overrides the vector store attached to this agent. There can be a maximum of 1 vector store attached to the agent. + /// Overrides the resources to be used by the `azure_ai_search` tool consisting of index IDs and names. + /// Keeps track of any properties unknown to the library. + internal UpdateToolResourcesOptions(UpdateCodeInterpreterToolResourceOptions codeInterpreter, UpdateFileSearchToolResourceOptions fileSearch, AzureAISearchResource azureAISearch, IDictionary serializedAdditionalRawData) + { + CodeInterpreter = codeInterpreter; + FileSearch = fileSearch; + AzureAISearch = azureAISearch; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// + /// Overrides the list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files + /// associated with the tool. + /// + public UpdateCodeInterpreterToolResourceOptions CodeInterpreter { get; set; } + /// Overrides the vector store attached to this agent. There can be a maximum of 1 vector store attached to the agent. + public UpdateFileSearchToolResourceOptions FileSearch { get; set; } + /// Overrides the resources to be used by the `azure_ai_search` tool consisting of index IDs and names. + public AzureAISearchResource AzureAISearch { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UploadFileRequest.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UploadFileRequest.Serialization.cs new file mode 100644 index 000000000000..1715b10467ab --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UploadFileRequest.Serialization.cs @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.IO; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class UploadFileRequest : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(UploadFileRequest)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("file"u8); + writer.WriteObjectValue(Data, options); + writer.WritePropertyName("purpose"u8); + writer.WriteStringValue(Purpose.ToString()); + if (Optional.IsDefined(Filename)) + { + writer.WritePropertyName("filename"u8); + writer.WriteStringValue(Filename); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + UploadFileRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(UploadFileRequest)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeUploadFileRequest(document.RootElement, options); + } + + internal static UploadFileRequest DeserializeUploadFileRequest(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + File file = default; + OpenAIFilePurpose purpose = default; + string filename = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("file"u8)) + { + file = File.DeserializeFile(property.Value, options); + continue; + } + if (property.NameEquals("purpose"u8)) + { + purpose = new OpenAIFilePurpose(property.Value.GetString()); + continue; + } + if (property.NameEquals("filename"u8)) + { + filename = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UploadFileRequest(file, purpose, filename, serializedAdditionalRawData); + } + + private BinaryData SerializeMultipart(ModelReaderWriterOptions options) + { + using MultipartFormDataRequestContent content = ToMultipartRequestContent(); + using MemoryStream stream = new MemoryStream(); + content.WriteTo(stream); + if (stream.Position > int.MaxValue) + { + return BinaryData.FromStream(stream); + } + else + { + return new BinaryData(stream.GetBuffer().AsMemory(0, (int)stream.Position)); + } + } + + internal virtual MultipartFormDataRequestContent ToMultipartRequestContent() + { + MultipartFormDataRequestContent content = new MultipartFormDataRequestContent(); + content.Add(ModelReaderWriter.Write(Data, ModelSerializationExtensions.WireOptions), "file"); + content.Add(Purpose.ToString(), "purpose"); + if (Optional.IsDefined(Filename)) + { + content.Add(Filename, "filename"); + } + return content; + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "MFD": + return SerializeMultipart(options); + default: + throw new FormatException($"The model {nameof(UploadFileRequest)} does not support writing '{options.Format}' format."); + } + } + + UploadFileRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUploadFileRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(UploadFileRequest)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "MFD"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static UploadFileRequest FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUploadFileRequest(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/UploadFileRequest.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/UploadFileRequest.cs new file mode 100644 index 000000000000..f8bfe3c3fbae --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/UploadFileRequest.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The UploadFileRequest. + public partial class UploadFileRequest + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The file data, in bytes. + /// The intended purpose of the uploaded file. Use `assistants` for Agents and Message files, `vision` for Agents image file inputs, `batch` for Batch API, and `fine-tune` for Fine-tuning. + /// is null. + public UploadFileRequest(File data, OpenAIFilePurpose purpose) + { + Argument.AssertNotNull(data, nameof(data)); + + Data = data; + Purpose = purpose; + } + + /// Initializes a new instance of . + /// The file data, in bytes. + /// The intended purpose of the uploaded file. Use `assistants` for Agents and Message files, `vision` for Agents image file inputs, `batch` for Batch API, and `fine-tune` for Fine-tuning. + /// The name of the file. + /// Keeps track of any properties unknown to the library. + internal UploadFileRequest(File data, OpenAIFilePurpose purpose, string filename, IDictionary serializedAdditionalRawData) + { + Data = data; + Purpose = purpose; + Filename = filename; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal UploadFileRequest() + { + } + + /// The file data, in bytes. + public File Data { get; } + /// The intended purpose of the uploaded file. Use `assistants` for Agents and Message files, `vision` for Agents image file inputs, `batch` for Batch API, and `fine-tune` for Fine-tuning. + public OpenAIFilePurpose Purpose { get; } + /// The name of the file. + public string Filename { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStore.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStore.Serialization.cs new file mode 100644 index 000000000000..28ab7bb85306 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStore.Serialization.cs @@ -0,0 +1,291 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class VectorStore : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStore)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("object"u8); + writer.WriteStringValue(Object.ToString()); + writer.WritePropertyName("created_at"u8); + writer.WriteNumberValue(CreatedAt, "U"); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WritePropertyName("usage_bytes"u8); + writer.WriteNumberValue(UsageBytes); + writer.WritePropertyName("file_counts"u8); + writer.WriteObjectValue(FileCounts, options); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsDefined(ExpiresAfter)) + { + writer.WritePropertyName("expires_after"u8); + writer.WriteObjectValue(ExpiresAfter, options); + } + if (Optional.IsDefined(ExpiresAt)) + { + if (ExpiresAt != null) + { + writer.WritePropertyName("expires_at"u8); + writer.WriteNumberValue(ExpiresAt.Value, "U"); + } + else + { + writer.WriteNull("expires_at"); + } + } + if (LastActiveAt != null) + { + writer.WritePropertyName("last_active_at"u8); + writer.WriteNumberValue(LastActiveAt.Value, "U"); + } + else + { + writer.WriteNull("last_active_at"); + } + if (Metadata != null && Optional.IsCollectionDefined(Metadata)) + { + writer.WritePropertyName("metadata"u8); + writer.WriteStartObject(); + foreach (var item in Metadata) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + else + { + writer.WriteNull("metadata"); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + VectorStore IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStore)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVectorStore(document.RootElement, options); + } + + internal static VectorStore DeserializeVectorStore(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + VectorStoreObject @object = default; + DateTimeOffset createdAt = default; + string name = default; + int usageBytes = default; + VectorStoreFileCount fileCounts = default; + VectorStoreStatus status = default; + VectorStoreExpirationPolicy expiresAfter = default; + DateTimeOffset? expiresAt = default; + DateTimeOffset? lastActiveAt = default; + IReadOnlyDictionary metadata = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("object"u8)) + { + @object = new VectorStoreObject(property.Value.GetString()); + continue; + } + if (property.NameEquals("created_at"u8)) + { + createdAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("usage_bytes"u8)) + { + usageBytes = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("file_counts"u8)) + { + fileCounts = VectorStoreFileCount.DeserializeVectorStoreFileCount(property.Value, options); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new VectorStoreStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("expires_after"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expiresAfter = VectorStoreExpirationPolicy.DeserializeVectorStoreExpirationPolicy(property.Value, options); + continue; + } + if (property.NameEquals("expires_at"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + expiresAt = null; + continue; + } + expiresAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); + continue; + } + if (property.NameEquals("last_active_at"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + lastActiveAt = null; + continue; + } + lastActiveAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); + continue; + } + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + metadata = new ChangeTrackingDictionary(); + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + metadata = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new VectorStore( + id, + @object, + createdAt, + name, + usageBytes, + fileCounts, + status, + expiresAfter, + expiresAt, + lastActiveAt, + metadata, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(VectorStore)} does not support writing '{options.Format}' format."); + } + } + + VectorStore IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStore(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VectorStore)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static VectorStore FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStore(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStore.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStore.cs new file mode 100644 index 000000000000..3fc9a3a4cfd9 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStore.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// A vector store is a collection of processed files can be used by the `file_search` tool. + public partial class VectorStore + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The identifier, which can be referenced in API endpoints. + /// The Unix timestamp (in seconds) for when the vector store was created. + /// The name of the vector store. + /// The total number of bytes used by the files in the vector store. + /// Files count grouped by status processed or being processed by this vector store. + /// The status of the vector store, which can be either `expired`, `in_progress`, or `completed`. A status of `completed` indicates that the vector store is ready for use. + /// The Unix timestamp (in seconds) for when the vector store was last active. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// , or is null. + internal VectorStore(string id, DateTimeOffset createdAt, string name, int usageBytes, VectorStoreFileCount fileCounts, VectorStoreStatus status, DateTimeOffset? lastActiveAt, IReadOnlyDictionary metadata) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(fileCounts, nameof(fileCounts)); + + Id = id; + CreatedAt = createdAt; + Name = name; + UsageBytes = usageBytes; + FileCounts = fileCounts; + Status = status; + LastActiveAt = lastActiveAt; + Metadata = metadata; + } + + /// Initializes a new instance of . + /// The identifier, which can be referenced in API endpoints. + /// The object type, which is always `vector_store`. + /// The Unix timestamp (in seconds) for when the vector store was created. + /// The name of the vector store. + /// The total number of bytes used by the files in the vector store. + /// Files count grouped by status processed or being processed by this vector store. + /// The status of the vector store, which can be either `expired`, `in_progress`, or `completed`. A status of `completed` indicates that the vector store is ready for use. + /// Details on when this vector store expires. + /// The Unix timestamp (in seconds) for when the vector store will expire. + /// The Unix timestamp (in seconds) for when the vector store was last active. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// Keeps track of any properties unknown to the library. + internal VectorStore(string id, VectorStoreObject @object, DateTimeOffset createdAt, string name, int usageBytes, VectorStoreFileCount fileCounts, VectorStoreStatus status, VectorStoreExpirationPolicy expiresAfter, DateTimeOffset? expiresAt, DateTimeOffset? lastActiveAt, IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) + { + Id = id; + Object = @object; + CreatedAt = createdAt; + Name = name; + UsageBytes = usageBytes; + FileCounts = fileCounts; + Status = status; + ExpiresAfter = expiresAfter; + ExpiresAt = expiresAt; + LastActiveAt = lastActiveAt; + Metadata = metadata; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VectorStore() + { + } + + /// The identifier, which can be referenced in API endpoints. + public string Id { get; } + /// The object type, which is always `vector_store`. + public VectorStoreObject Object { get; } = VectorStoreObject.VectorStore; + + /// The Unix timestamp (in seconds) for when the vector store was created. + public DateTimeOffset CreatedAt { get; } + /// The name of the vector store. + public string Name { get; } + /// The total number of bytes used by the files in the vector store. + public int UsageBytes { get; } + /// Files count grouped by status processed or being processed by this vector store. + public VectorStoreFileCount FileCounts { get; } + /// The status of the vector store, which can be either `expired`, `in_progress`, or `completed`. A status of `completed` indicates that the vector store is ready for use. + public VectorStoreStatus Status { get; } + /// Details on when this vector store expires. + public VectorStoreExpirationPolicy ExpiresAfter { get; } + /// The Unix timestamp (in seconds) for when the vector store will expire. + public DateTimeOffset? ExpiresAt { get; } + /// The Unix timestamp (in seconds) for when the vector store was last active. + public DateTimeOffset? LastActiveAt { get; } + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + public IReadOnlyDictionary Metadata { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreAutoChunkingStrategyRequest.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreAutoChunkingStrategyRequest.Serialization.cs new file mode 100644 index 000000000000..57b127650650 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreAutoChunkingStrategyRequest.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class VectorStoreAutoChunkingStrategyRequest : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreAutoChunkingStrategyRequest)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + VectorStoreAutoChunkingStrategyRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreAutoChunkingStrategyRequest)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVectorStoreAutoChunkingStrategyRequest(document.RootElement, options); + } + + internal static VectorStoreAutoChunkingStrategyRequest DeserializeVectorStoreAutoChunkingStrategyRequest(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + VectorStoreChunkingStrategyRequestType type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new VectorStoreChunkingStrategyRequestType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new VectorStoreAutoChunkingStrategyRequest(type, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(VectorStoreAutoChunkingStrategyRequest)} does not support writing '{options.Format}' format."); + } + } + + VectorStoreAutoChunkingStrategyRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreAutoChunkingStrategyRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VectorStoreAutoChunkingStrategyRequest)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new VectorStoreAutoChunkingStrategyRequest FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreAutoChunkingStrategyRequest(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreAutoChunkingStrategyRequest.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreAutoChunkingStrategyRequest.cs new file mode 100644 index 000000000000..564770104d00 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreAutoChunkingStrategyRequest.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The default strategy. This strategy currently uses a max_chunk_size_tokens of 800 and chunk_overlap_tokens of 400. + public partial class VectorStoreAutoChunkingStrategyRequest : VectorStoreChunkingStrategyRequest + { + /// Initializes a new instance of . + public VectorStoreAutoChunkingStrategyRequest() + { + Type = VectorStoreChunkingStrategyRequestType.Auto; + } + + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + internal VectorStoreAutoChunkingStrategyRequest(VectorStoreChunkingStrategyRequestType type, IDictionary serializedAdditionalRawData) : base(type, serializedAdditionalRawData) + { + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreAutoChunkingStrategyResponse.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreAutoChunkingStrategyResponse.Serialization.cs new file mode 100644 index 000000000000..7e6e3c0c2ba3 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreAutoChunkingStrategyResponse.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class VectorStoreAutoChunkingStrategyResponse : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreAutoChunkingStrategyResponse)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + VectorStoreAutoChunkingStrategyResponse IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreAutoChunkingStrategyResponse)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVectorStoreAutoChunkingStrategyResponse(document.RootElement, options); + } + + internal static VectorStoreAutoChunkingStrategyResponse DeserializeVectorStoreAutoChunkingStrategyResponse(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + VectorStoreChunkingStrategyResponseType type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new VectorStoreChunkingStrategyResponseType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new VectorStoreAutoChunkingStrategyResponse(type, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(VectorStoreAutoChunkingStrategyResponse)} does not support writing '{options.Format}' format."); + } + } + + VectorStoreAutoChunkingStrategyResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreAutoChunkingStrategyResponse(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VectorStoreAutoChunkingStrategyResponse)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new VectorStoreAutoChunkingStrategyResponse FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreAutoChunkingStrategyResponse(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreAutoChunkingStrategyResponse.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreAutoChunkingStrategyResponse.cs new file mode 100644 index 000000000000..24b240f2ab5c --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreAutoChunkingStrategyResponse.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// This is returned when the chunking strategy is unknown. Typically, this is because the file was indexed before the chunking_strategy concept was introduced in the API. + public partial class VectorStoreAutoChunkingStrategyResponse : VectorStoreChunkingStrategyResponse + { + /// Initializes a new instance of . + internal VectorStoreAutoChunkingStrategyResponse() + { + Type = VectorStoreChunkingStrategyResponseType.Other; + } + + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + internal VectorStoreAutoChunkingStrategyResponse(VectorStoreChunkingStrategyResponseType type, IDictionary serializedAdditionalRawData) : base(type, serializedAdditionalRawData) + { + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreChunkingStrategyRequest.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreChunkingStrategyRequest.Serialization.cs new file mode 100644 index 000000000000..d7435febfb40 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreChunkingStrategyRequest.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + [PersistableModelProxy(typeof(UnknownVectorStoreChunkingStrategyRequest))] + public partial class VectorStoreChunkingStrategyRequest : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreChunkingStrategyRequest)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + VectorStoreChunkingStrategyRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreChunkingStrategyRequest)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVectorStoreChunkingStrategyRequest(document.RootElement, options); + } + + internal static VectorStoreChunkingStrategyRequest DeserializeVectorStoreChunkingStrategyRequest(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("type", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "auto": return VectorStoreAutoChunkingStrategyRequest.DeserializeVectorStoreAutoChunkingStrategyRequest(element, options); + case "static": return VectorStoreStaticChunkingStrategyRequest.DeserializeVectorStoreStaticChunkingStrategyRequest(element, options); + } + } + return UnknownVectorStoreChunkingStrategyRequest.DeserializeUnknownVectorStoreChunkingStrategyRequest(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(VectorStoreChunkingStrategyRequest)} does not support writing '{options.Format}' format."); + } + } + + VectorStoreChunkingStrategyRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreChunkingStrategyRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VectorStoreChunkingStrategyRequest)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static VectorStoreChunkingStrategyRequest FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreChunkingStrategyRequest(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreChunkingStrategyRequest.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreChunkingStrategyRequest.cs new file mode 100644 index 000000000000..9d099a28b6da --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreChunkingStrategyRequest.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// + /// An abstract representation of a vector store chunking strategy configuration. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public abstract partial class VectorStoreChunkingStrategyRequest + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + protected VectorStoreChunkingStrategyRequest() + { + } + + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + internal VectorStoreChunkingStrategyRequest(VectorStoreChunkingStrategyRequestType type, IDictionary serializedAdditionalRawData) + { + Type = type; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The object type. + internal VectorStoreChunkingStrategyRequestType Type { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreChunkingStrategyRequestType.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreChunkingStrategyRequestType.cs new file mode 100644 index 000000000000..f8cadb1071ad --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreChunkingStrategyRequestType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// Type of chunking strategy. + internal readonly partial struct VectorStoreChunkingStrategyRequestType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public VectorStoreChunkingStrategyRequestType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AutoValue = "auto"; + private const string StaticValue = "static"; + + /// auto. + public static VectorStoreChunkingStrategyRequestType Auto { get; } = new VectorStoreChunkingStrategyRequestType(AutoValue); + /// static. + public static VectorStoreChunkingStrategyRequestType Static { get; } = new VectorStoreChunkingStrategyRequestType(StaticValue); + /// Determines if two values are the same. + public static bool operator ==(VectorStoreChunkingStrategyRequestType left, VectorStoreChunkingStrategyRequestType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(VectorStoreChunkingStrategyRequestType left, VectorStoreChunkingStrategyRequestType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator VectorStoreChunkingStrategyRequestType(string value) => new VectorStoreChunkingStrategyRequestType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VectorStoreChunkingStrategyRequestType other && Equals(other); + /// + public bool Equals(VectorStoreChunkingStrategyRequestType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreChunkingStrategyResponse.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreChunkingStrategyResponse.Serialization.cs new file mode 100644 index 000000000000..78748c0a74c6 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreChunkingStrategyResponse.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + [PersistableModelProxy(typeof(UnknownVectorStoreChunkingStrategyResponse))] + public partial class VectorStoreChunkingStrategyResponse : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreChunkingStrategyResponse)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + VectorStoreChunkingStrategyResponse IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreChunkingStrategyResponse)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVectorStoreChunkingStrategyResponse(document.RootElement, options); + } + + internal static VectorStoreChunkingStrategyResponse DeserializeVectorStoreChunkingStrategyResponse(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("type", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "other": return VectorStoreAutoChunkingStrategyResponse.DeserializeVectorStoreAutoChunkingStrategyResponse(element, options); + case "static": return VectorStoreStaticChunkingStrategyResponse.DeserializeVectorStoreStaticChunkingStrategyResponse(element, options); + } + } + return UnknownVectorStoreChunkingStrategyResponse.DeserializeUnknownVectorStoreChunkingStrategyResponse(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(VectorStoreChunkingStrategyResponse)} does not support writing '{options.Format}' format."); + } + } + + VectorStoreChunkingStrategyResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreChunkingStrategyResponse(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VectorStoreChunkingStrategyResponse)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static VectorStoreChunkingStrategyResponse FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreChunkingStrategyResponse(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreChunkingStrategyResponse.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreChunkingStrategyResponse.cs new file mode 100644 index 000000000000..46c020610953 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreChunkingStrategyResponse.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// + /// An abstract representation of a vector store chunking strategy configuration. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public abstract partial class VectorStoreChunkingStrategyResponse + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + protected VectorStoreChunkingStrategyResponse() + { + } + + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + internal VectorStoreChunkingStrategyResponse(VectorStoreChunkingStrategyResponseType type, IDictionary serializedAdditionalRawData) + { + Type = type; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The object type. + internal VectorStoreChunkingStrategyResponseType Type { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreChunkingStrategyResponseType.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreChunkingStrategyResponseType.cs new file mode 100644 index 000000000000..7de5528cc0e5 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreChunkingStrategyResponseType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// Type of chunking strategy. + internal readonly partial struct VectorStoreChunkingStrategyResponseType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public VectorStoreChunkingStrategyResponseType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string OtherValue = "other"; + private const string StaticValue = "static"; + + /// other. + public static VectorStoreChunkingStrategyResponseType Other { get; } = new VectorStoreChunkingStrategyResponseType(OtherValue); + /// static. + public static VectorStoreChunkingStrategyResponseType Static { get; } = new VectorStoreChunkingStrategyResponseType(StaticValue); + /// Determines if two values are the same. + public static bool operator ==(VectorStoreChunkingStrategyResponseType left, VectorStoreChunkingStrategyResponseType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(VectorStoreChunkingStrategyResponseType left, VectorStoreChunkingStrategyResponseType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator VectorStoreChunkingStrategyResponseType(string value) => new VectorStoreChunkingStrategyResponseType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VectorStoreChunkingStrategyResponseType other && Equals(other); + /// + public bool Equals(VectorStoreChunkingStrategyResponseType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreConfiguration.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreConfiguration.Serialization.cs new file mode 100644 index 000000000000..c020360ce16d --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreConfiguration.Serialization.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class VectorStoreConfiguration : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreConfiguration)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("data_sources"u8); + writer.WriteStartArray(); + foreach (var item in DataSources) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + VectorStoreConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreConfiguration)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVectorStoreConfiguration(document.RootElement, options); + } + + internal static VectorStoreConfiguration DeserializeVectorStoreConfiguration(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList dataSources = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("data_sources"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(VectorStoreDataSource.DeserializeVectorStoreDataSource(item, options)); + } + dataSources = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new VectorStoreConfiguration(dataSources, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(VectorStoreConfiguration)} does not support writing '{options.Format}' format."); + } + } + + VectorStoreConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreConfiguration(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VectorStoreConfiguration)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static VectorStoreConfiguration FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreConfiguration(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreConfiguration.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreConfiguration.cs new file mode 100644 index 000000000000..c320b0a4c492 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreConfiguration.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Assistants +{ + /// + /// Vector storage configuration is the list of data sources, used when multiple + /// files can be used for the enterprise file search. + /// + public partial class VectorStoreConfiguration + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Data sources. + /// is null. + public VectorStoreConfiguration(IEnumerable dataSources) + { + Argument.AssertNotNull(dataSources, nameof(dataSources)); + + DataSources = dataSources.ToList(); + } + + /// Initializes a new instance of . + /// Data sources. + /// Keeps track of any properties unknown to the library. + internal VectorStoreConfiguration(IList dataSources, IDictionary serializedAdditionalRawData) + { + DataSources = dataSources; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VectorStoreConfiguration() + { + } + + /// Data sources. + public IList DataSources { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreConfigurations.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreConfigurations.Serialization.cs new file mode 100644 index 000000000000..867d0474f6b1 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreConfigurations.Serialization.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class VectorStoreConfigurations : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreConfigurations)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("name"u8); + writer.WriteStringValue(StoreName); + writer.WritePropertyName("configuration"u8); + writer.WriteObjectValue(StoreConfiguration, options); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + VectorStoreConfigurations IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreConfigurations)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVectorStoreConfigurations(document.RootElement, options); + } + + internal static VectorStoreConfigurations DeserializeVectorStoreConfigurations(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + VectorStoreConfiguration configuration = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("configuration"u8)) + { + configuration = VectorStoreConfiguration.DeserializeVectorStoreConfiguration(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new VectorStoreConfigurations(name, configuration, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(VectorStoreConfigurations)} does not support writing '{options.Format}' format."); + } + } + + VectorStoreConfigurations IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreConfigurations(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VectorStoreConfigurations)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static VectorStoreConfigurations FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreConfigurations(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreConfigurations.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreConfigurations.cs new file mode 100644 index 000000000000..3f128f6d0e96 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreConfigurations.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The structure, containing the list of vector storage configurations i.e. the list of azure asset IDs. + public partial class VectorStoreConfigurations + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Name. + /// Configurations. + /// or is null. + public VectorStoreConfigurations(string storeName, VectorStoreConfiguration storeConfiguration) + { + Argument.AssertNotNull(storeName, nameof(storeName)); + Argument.AssertNotNull(storeConfiguration, nameof(storeConfiguration)); + + StoreName = storeName; + StoreConfiguration = storeConfiguration; + } + + /// Initializes a new instance of . + /// Name. + /// Configurations. + /// Keeps track of any properties unknown to the library. + internal VectorStoreConfigurations(string storeName, VectorStoreConfiguration storeConfiguration, IDictionary serializedAdditionalRawData) + { + StoreName = storeName; + StoreConfiguration = storeConfiguration; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VectorStoreConfigurations() + { + } + + /// Name. + public string StoreName { get; set; } + /// Configurations. + public VectorStoreConfiguration StoreConfiguration { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreDataSource.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreDataSource.Serialization.cs new file mode 100644 index 000000000000..4fa539357339 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreDataSource.Serialization.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class VectorStoreDataSource : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreDataSource)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("uri"u8); + writer.WriteStringValue(AssetIdentifier); + writer.WritePropertyName("type"u8); + writer.WriteStringValue(AssetType.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + VectorStoreDataSource IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreDataSource)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVectorStoreDataSource(document.RootElement, options); + } + + internal static VectorStoreDataSource DeserializeVectorStoreDataSource(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string uri = default; + VectorStoreDataSourceAssetType type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("uri"u8)) + { + uri = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new VectorStoreDataSourceAssetType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new VectorStoreDataSource(uri, type, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(VectorStoreDataSource)} does not support writing '{options.Format}' format."); + } + } + + VectorStoreDataSource IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreDataSource(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VectorStoreDataSource)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static VectorStoreDataSource FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreDataSource(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreDataSource.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreDataSource.cs new file mode 100644 index 000000000000..b9e943c4231e --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreDataSource.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// + /// The structure, containing Azure asset URI path and the asset type of the file used as a data source + /// for the enterprise file search. + /// + public partial class VectorStoreDataSource + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Asset URI. + /// The asset type. + /// is null. + public VectorStoreDataSource(string assetIdentifier, VectorStoreDataSourceAssetType assetType) + { + Argument.AssertNotNull(assetIdentifier, nameof(assetIdentifier)); + + AssetIdentifier = assetIdentifier; + AssetType = assetType; + } + + /// Initializes a new instance of . + /// Asset URI. + /// The asset type. + /// Keeps track of any properties unknown to the library. + internal VectorStoreDataSource(string assetIdentifier, VectorStoreDataSourceAssetType assetType, IDictionary serializedAdditionalRawData) + { + AssetIdentifier = assetIdentifier; + AssetType = assetType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VectorStoreDataSource() + { + } + + /// Asset URI. + public string AssetIdentifier { get; set; } + /// The asset type. + public VectorStoreDataSourceAssetType AssetType { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreDataSourceAssetType.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreDataSourceAssetType.cs new file mode 100644 index 000000000000..e6b298f06342 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreDataSourceAssetType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// + /// Type of vector storage asset. Asset type may be a uri_asset, in this case it should contain asset URI ID, + /// in the case of id_asset it should contain the data ID. + /// + public readonly partial struct VectorStoreDataSourceAssetType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public VectorStoreDataSourceAssetType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UriAssetValue = "uri_asset"; + private const string IdAssetValue = "id_asset"; + + /// Azure URI. + public static VectorStoreDataSourceAssetType UriAsset { get; } = new VectorStoreDataSourceAssetType(UriAssetValue); + /// The data ID. + public static VectorStoreDataSourceAssetType IdAsset { get; } = new VectorStoreDataSourceAssetType(IdAssetValue); + /// Determines if two values are the same. + public static bool operator ==(VectorStoreDataSourceAssetType left, VectorStoreDataSourceAssetType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(VectorStoreDataSourceAssetType left, VectorStoreDataSourceAssetType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator VectorStoreDataSourceAssetType(string value) => new VectorStoreDataSourceAssetType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VectorStoreDataSourceAssetType other && Equals(other); + /// + public bool Equals(VectorStoreDataSourceAssetType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreDeletionStatus.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreDeletionStatus.Serialization.cs new file mode 100644 index 000000000000..222ed69a55a2 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreDeletionStatus.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class VectorStoreDeletionStatus : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreDeletionStatus)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("deleted"u8); + writer.WriteBooleanValue(Deleted); + writer.WritePropertyName("object"u8); + writer.WriteStringValue(Object.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + VectorStoreDeletionStatus IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreDeletionStatus)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVectorStoreDeletionStatus(document.RootElement, options); + } + + internal static VectorStoreDeletionStatus DeserializeVectorStoreDeletionStatus(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + bool deleted = default; + VectorStoreDeletionStatusObject @object = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("deleted"u8)) + { + deleted = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("object"u8)) + { + @object = new VectorStoreDeletionStatusObject(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new VectorStoreDeletionStatus(id, deleted, @object, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(VectorStoreDeletionStatus)} does not support writing '{options.Format}' format."); + } + } + + VectorStoreDeletionStatus IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreDeletionStatus(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VectorStoreDeletionStatus)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static VectorStoreDeletionStatus FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreDeletionStatus(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreDeletionStatus.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreDeletionStatus.cs new file mode 100644 index 000000000000..186d5cfa9b95 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreDeletionStatus.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Response object for deleting a vector store. + public partial class VectorStoreDeletionStatus + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The ID of the resource specified for deletion. + /// A value indicating whether deletion was successful. + /// is null. + internal VectorStoreDeletionStatus(string id, bool deleted) + { + Argument.AssertNotNull(id, nameof(id)); + + Id = id; + Deleted = deleted; + } + + /// Initializes a new instance of . + /// The ID of the resource specified for deletion. + /// A value indicating whether deletion was successful. + /// The object type, which is always 'vector_store.deleted'. + /// Keeps track of any properties unknown to the library. + internal VectorStoreDeletionStatus(string id, bool deleted, VectorStoreDeletionStatusObject @object, IDictionary serializedAdditionalRawData) + { + Id = id; + Deleted = deleted; + Object = @object; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VectorStoreDeletionStatus() + { + } + + /// The ID of the resource specified for deletion. + public string Id { get; } + /// A value indicating whether deletion was successful. + public bool Deleted { get; } + /// The object type, which is always 'vector_store.deleted'. + public VectorStoreDeletionStatusObject Object { get; } = VectorStoreDeletionStatusObject.VectorStoreDeleted; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreDeletionStatusObject.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreDeletionStatusObject.cs new file mode 100644 index 000000000000..cf1c43a36ba2 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreDeletionStatusObject.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// The VectorStoreDeletionStatus_object. + public readonly partial struct VectorStoreDeletionStatusObject : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public VectorStoreDeletionStatusObject(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string VectorStoreDeletedValue = "vector_store.deleted"; + + /// vector_store.deleted. + public static VectorStoreDeletionStatusObject VectorStoreDeleted { get; } = new VectorStoreDeletionStatusObject(VectorStoreDeletedValue); + /// Determines if two values are the same. + public static bool operator ==(VectorStoreDeletionStatusObject left, VectorStoreDeletionStatusObject right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(VectorStoreDeletionStatusObject left, VectorStoreDeletionStatusObject right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator VectorStoreDeletionStatusObject(string value) => new VectorStoreDeletionStatusObject(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VectorStoreDeletionStatusObject other && Equals(other); + /// + public bool Equals(VectorStoreDeletionStatusObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreExpirationPolicy.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreExpirationPolicy.Serialization.cs new file mode 100644 index 000000000000..04d4c129ca88 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreExpirationPolicy.Serialization.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class VectorStoreExpirationPolicy : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreExpirationPolicy)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("anchor"u8); + writer.WriteStringValue(Anchor.ToString()); + writer.WritePropertyName("days"u8); + writer.WriteNumberValue(Days); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + VectorStoreExpirationPolicy IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreExpirationPolicy)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVectorStoreExpirationPolicy(document.RootElement, options); + } + + internal static VectorStoreExpirationPolicy DeserializeVectorStoreExpirationPolicy(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + VectorStoreExpirationPolicyAnchor anchor = default; + int days = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("anchor"u8)) + { + anchor = new VectorStoreExpirationPolicyAnchor(property.Value.GetString()); + continue; + } + if (property.NameEquals("days"u8)) + { + days = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new VectorStoreExpirationPolicy(anchor, days, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(VectorStoreExpirationPolicy)} does not support writing '{options.Format}' format."); + } + } + + VectorStoreExpirationPolicy IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreExpirationPolicy(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VectorStoreExpirationPolicy)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static VectorStoreExpirationPolicy FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreExpirationPolicy(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreExpirationPolicy.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreExpirationPolicy.cs new file mode 100644 index 000000000000..cb6e13bdb908 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreExpirationPolicy.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// The expiration policy for a vector store. + public partial class VectorStoreExpirationPolicy + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Anchor timestamp after which the expiration policy applies. Supported anchors: `last_active_at`. + /// The anchor timestamp after which the expiration policy applies. + public VectorStoreExpirationPolicy(VectorStoreExpirationPolicyAnchor anchor, int days) + { + Anchor = anchor; + Days = days; + } + + /// Initializes a new instance of . + /// Anchor timestamp after which the expiration policy applies. Supported anchors: `last_active_at`. + /// The anchor timestamp after which the expiration policy applies. + /// Keeps track of any properties unknown to the library. + internal VectorStoreExpirationPolicy(VectorStoreExpirationPolicyAnchor anchor, int days, IDictionary serializedAdditionalRawData) + { + Anchor = anchor; + Days = days; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VectorStoreExpirationPolicy() + { + } + + /// Anchor timestamp after which the expiration policy applies. Supported anchors: `last_active_at`. + public VectorStoreExpirationPolicyAnchor Anchor { get; set; } + /// The anchor timestamp after which the expiration policy applies. + public int Days { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreExpirationPolicyAnchor.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreExpirationPolicyAnchor.cs new file mode 100644 index 000000000000..90ad19087f05 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreExpirationPolicyAnchor.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// Describes the relationship between the days and the expiration of this vector store. + public readonly partial struct VectorStoreExpirationPolicyAnchor : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public VectorStoreExpirationPolicyAnchor(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string LastActiveAtValue = "last_active_at"; + + /// The expiration policy is based on the last time the vector store was active. + public static VectorStoreExpirationPolicyAnchor LastActiveAt { get; } = new VectorStoreExpirationPolicyAnchor(LastActiveAtValue); + /// Determines if two values are the same. + public static bool operator ==(VectorStoreExpirationPolicyAnchor left, VectorStoreExpirationPolicyAnchor right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(VectorStoreExpirationPolicyAnchor left, VectorStoreExpirationPolicyAnchor right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator VectorStoreExpirationPolicyAnchor(string value) => new VectorStoreExpirationPolicyAnchor(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VectorStoreExpirationPolicyAnchor other && Equals(other); + /// + public bool Equals(VectorStoreExpirationPolicyAnchor other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFile.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFile.Serialization.cs new file mode 100644 index 000000000000..38f3c51b0f61 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFile.Serialization.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class VectorStoreFile : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreFile)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("object"u8); + writer.WriteStringValue(Object.ToString()); + writer.WritePropertyName("usage_bytes"u8); + writer.WriteNumberValue(UsageBytes); + writer.WritePropertyName("created_at"u8); + writer.WriteNumberValue(CreatedAt, "U"); + writer.WritePropertyName("vector_store_id"u8); + writer.WriteStringValue(VectorStoreId); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (LastError != null) + { + writer.WritePropertyName("last_error"u8); + writer.WriteObjectValue(LastError, options); + } + else + { + writer.WriteNull("last_error"); + } + writer.WritePropertyName("chunking_strategy"u8); + writer.WriteObjectValue(ChunkingStrategy, options); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + VectorStoreFile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreFile)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVectorStoreFile(document.RootElement, options); + } + + internal static VectorStoreFile DeserializeVectorStoreFile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + VectorStoreFileObject @object = default; + int usageBytes = default; + DateTimeOffset createdAt = default; + string vectorStoreId = default; + VectorStoreFileStatus status = default; + VectorStoreFileError lastError = default; + VectorStoreChunkingStrategyResponse chunkingStrategy = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("object"u8)) + { + @object = new VectorStoreFileObject(property.Value.GetString()); + continue; + } + if (property.NameEquals("usage_bytes"u8)) + { + usageBytes = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("created_at"u8)) + { + createdAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); + continue; + } + if (property.NameEquals("vector_store_id"u8)) + { + vectorStoreId = property.Value.GetString(); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new VectorStoreFileStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("last_error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + lastError = null; + continue; + } + lastError = VectorStoreFileError.DeserializeVectorStoreFileError(property.Value, options); + continue; + } + if (property.NameEquals("chunking_strategy"u8)) + { + chunkingStrategy = VectorStoreChunkingStrategyResponse.DeserializeVectorStoreChunkingStrategyResponse(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new VectorStoreFile( + id, + @object, + usageBytes, + createdAt, + vectorStoreId, + status, + lastError, + chunkingStrategy, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(VectorStoreFile)} does not support writing '{options.Format}' format."); + } + } + + VectorStoreFile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreFile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VectorStoreFile)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static VectorStoreFile FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreFile(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFile.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFile.cs new file mode 100644 index 000000000000..42a563bb40bd --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFile.cs @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Description of a file attached to a vector store. + public partial class VectorStoreFile + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The identifier, which can be referenced in API endpoints. + /// + /// The total vector store usage in bytes. Note that this may be different from the original file + /// size. + /// + /// The Unix timestamp (in seconds) for when the vector store file was created. + /// The ID of the vector store that the file is attached to. + /// The status of the vector store file, which can be either `in_progress`, `completed`, `cancelled`, or `failed`. The status `completed` indicates that the vector store file is ready for use. + /// The last error associated with this vector store file. Will be `null` if there are no errors. + /// + /// The strategy used to chunk the file. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// , or is null. + internal VectorStoreFile(string id, int usageBytes, DateTimeOffset createdAt, string vectorStoreId, VectorStoreFileStatus status, VectorStoreFileError lastError, VectorStoreChunkingStrategyResponse chunkingStrategy) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(vectorStoreId, nameof(vectorStoreId)); + Argument.AssertNotNull(chunkingStrategy, nameof(chunkingStrategy)); + + Id = id; + UsageBytes = usageBytes; + CreatedAt = createdAt; + VectorStoreId = vectorStoreId; + Status = status; + LastError = lastError; + ChunkingStrategy = chunkingStrategy; + } + + /// Initializes a new instance of . + /// The identifier, which can be referenced in API endpoints. + /// The object type, which is always `vector_store.file`. + /// + /// The total vector store usage in bytes. Note that this may be different from the original file + /// size. + /// + /// The Unix timestamp (in seconds) for when the vector store file was created. + /// The ID of the vector store that the file is attached to. + /// The status of the vector store file, which can be either `in_progress`, `completed`, `cancelled`, or `failed`. The status `completed` indicates that the vector store file is ready for use. + /// The last error associated with this vector store file. Will be `null` if there are no errors. + /// + /// The strategy used to chunk the file. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// Keeps track of any properties unknown to the library. + internal VectorStoreFile(string id, VectorStoreFileObject @object, int usageBytes, DateTimeOffset createdAt, string vectorStoreId, VectorStoreFileStatus status, VectorStoreFileError lastError, VectorStoreChunkingStrategyResponse chunkingStrategy, IDictionary serializedAdditionalRawData) + { + Id = id; + Object = @object; + UsageBytes = usageBytes; + CreatedAt = createdAt; + VectorStoreId = vectorStoreId; + Status = status; + LastError = lastError; + ChunkingStrategy = chunkingStrategy; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VectorStoreFile() + { + } + + /// The identifier, which can be referenced in API endpoints. + public string Id { get; } + /// The object type, which is always `vector_store.file`. + public VectorStoreFileObject Object { get; } = VectorStoreFileObject.VectorStoreFile; + + /// + /// The total vector store usage in bytes. Note that this may be different from the original file + /// size. + /// + public int UsageBytes { get; } + /// The Unix timestamp (in seconds) for when the vector store file was created. + public DateTimeOffset CreatedAt { get; } + /// The ID of the vector store that the file is attached to. + public string VectorStoreId { get; } + /// The status of the vector store file, which can be either `in_progress`, `completed`, `cancelled`, or `failed`. The status `completed` indicates that the vector store file is ready for use. + public VectorStoreFileStatus Status { get; } + /// The last error associated with this vector store file. Will be `null` if there are no errors. + public VectorStoreFileError LastError { get; } + /// + /// The strategy used to chunk the file. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public VectorStoreChunkingStrategyResponse ChunkingStrategy { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileBatch.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileBatch.Serialization.cs new file mode 100644 index 000000000000..fcf690739d53 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileBatch.Serialization.cs @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class VectorStoreFileBatch : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreFileBatch)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("object"u8); + writer.WriteStringValue(Object.ToString()); + writer.WritePropertyName("created_at"u8); + writer.WriteNumberValue(CreatedAt, "U"); + writer.WritePropertyName("vector_store_id"u8); + writer.WriteStringValue(VectorStoreId); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + writer.WritePropertyName("file_counts"u8); + writer.WriteObjectValue(FileCounts, options); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + VectorStoreFileBatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreFileBatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVectorStoreFileBatch(document.RootElement, options); + } + + internal static VectorStoreFileBatch DeserializeVectorStoreFileBatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + VectorStoreFileBatchObject @object = default; + DateTimeOffset createdAt = default; + string vectorStoreId = default; + VectorStoreFileBatchStatus status = default; + VectorStoreFileCount fileCounts = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("object"u8)) + { + @object = new VectorStoreFileBatchObject(property.Value.GetString()); + continue; + } + if (property.NameEquals("created_at"u8)) + { + createdAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); + continue; + } + if (property.NameEquals("vector_store_id"u8)) + { + vectorStoreId = property.Value.GetString(); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new VectorStoreFileBatchStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("file_counts"u8)) + { + fileCounts = VectorStoreFileCount.DeserializeVectorStoreFileCount(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new VectorStoreFileBatch( + id, + @object, + createdAt, + vectorStoreId, + status, + fileCounts, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(VectorStoreFileBatch)} does not support writing '{options.Format}' format."); + } + } + + VectorStoreFileBatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreFileBatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VectorStoreFileBatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static VectorStoreFileBatch FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreFileBatch(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileBatch.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileBatch.cs new file mode 100644 index 000000000000..898a0bbf515b --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileBatch.cs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// A batch of files attached to a vector store. + public partial class VectorStoreFileBatch + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The identifier, which can be referenced in API endpoints. + /// The Unix timestamp (in seconds) for when the vector store files batch was created. + /// The ID of the vector store that the file is attached to. + /// The status of the vector store files batch, which can be either `in_progress`, `completed`, `cancelled` or `failed`. + /// Files count grouped by status processed or being processed by this vector store. + /// , or is null. + internal VectorStoreFileBatch(string id, DateTimeOffset createdAt, string vectorStoreId, VectorStoreFileBatchStatus status, VectorStoreFileCount fileCounts) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(vectorStoreId, nameof(vectorStoreId)); + Argument.AssertNotNull(fileCounts, nameof(fileCounts)); + + Id = id; + CreatedAt = createdAt; + VectorStoreId = vectorStoreId; + Status = status; + FileCounts = fileCounts; + } + + /// Initializes a new instance of . + /// The identifier, which can be referenced in API endpoints. + /// The object type, which is always `vector_store.file_batch`. + /// The Unix timestamp (in seconds) for when the vector store files batch was created. + /// The ID of the vector store that the file is attached to. + /// The status of the vector store files batch, which can be either `in_progress`, `completed`, `cancelled` or `failed`. + /// Files count grouped by status processed or being processed by this vector store. + /// Keeps track of any properties unknown to the library. + internal VectorStoreFileBatch(string id, VectorStoreFileBatchObject @object, DateTimeOffset createdAt, string vectorStoreId, VectorStoreFileBatchStatus status, VectorStoreFileCount fileCounts, IDictionary serializedAdditionalRawData) + { + Id = id; + Object = @object; + CreatedAt = createdAt; + VectorStoreId = vectorStoreId; + Status = status; + FileCounts = fileCounts; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VectorStoreFileBatch() + { + } + + /// The identifier, which can be referenced in API endpoints. + public string Id { get; } + /// The object type, which is always `vector_store.file_batch`. + public VectorStoreFileBatchObject Object { get; } = VectorStoreFileBatchObject.VectorStoreFilesBatch; + + /// The Unix timestamp (in seconds) for when the vector store files batch was created. + public DateTimeOffset CreatedAt { get; } + /// The ID of the vector store that the file is attached to. + public string VectorStoreId { get; } + /// The status of the vector store files batch, which can be either `in_progress`, `completed`, `cancelled` or `failed`. + public VectorStoreFileBatchStatus Status { get; } + /// Files count grouped by status processed or being processed by this vector store. + public VectorStoreFileCount FileCounts { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileBatchObject.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileBatchObject.cs new file mode 100644 index 000000000000..dc2987751157 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileBatchObject.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// The VectorStoreFileBatch_object. + public readonly partial struct VectorStoreFileBatchObject : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public VectorStoreFileBatchObject(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string VectorStoreFilesBatchValue = "vector_store.files_batch"; + + /// vector_store.files_batch. + public static VectorStoreFileBatchObject VectorStoreFilesBatch { get; } = new VectorStoreFileBatchObject(VectorStoreFilesBatchValue); + /// Determines if two values are the same. + public static bool operator ==(VectorStoreFileBatchObject left, VectorStoreFileBatchObject right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(VectorStoreFileBatchObject left, VectorStoreFileBatchObject right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator VectorStoreFileBatchObject(string value) => new VectorStoreFileBatchObject(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VectorStoreFileBatchObject other && Equals(other); + /// + public bool Equals(VectorStoreFileBatchObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileBatchStatus.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileBatchStatus.cs new file mode 100644 index 000000000000..ef1ada005b00 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileBatchStatus.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// The status of the vector store file batch. + public readonly partial struct VectorStoreFileBatchStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public VectorStoreFileBatchStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InProgressValue = "in_progress"; + private const string CompletedValue = "completed"; + private const string CancelledValue = "cancelled"; + private const string FailedValue = "failed"; + + /// The vector store is still processing this file batch. + public static VectorStoreFileBatchStatus InProgress { get; } = new VectorStoreFileBatchStatus(InProgressValue); + /// the vector store file batch is ready for use. + public static VectorStoreFileBatchStatus Completed { get; } = new VectorStoreFileBatchStatus(CompletedValue); + /// The vector store file batch was cancelled. + public static VectorStoreFileBatchStatus Cancelled { get; } = new VectorStoreFileBatchStatus(CancelledValue); + /// The vector store file batch failed to process. + public static VectorStoreFileBatchStatus Failed { get; } = new VectorStoreFileBatchStatus(FailedValue); + /// Determines if two values are the same. + public static bool operator ==(VectorStoreFileBatchStatus left, VectorStoreFileBatchStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(VectorStoreFileBatchStatus left, VectorStoreFileBatchStatus right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator VectorStoreFileBatchStatus(string value) => new VectorStoreFileBatchStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VectorStoreFileBatchStatus other && Equals(other); + /// + public bool Equals(VectorStoreFileBatchStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileCount.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileCount.Serialization.cs new file mode 100644 index 000000000000..c4c0aec2fb8f --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileCount.Serialization.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class VectorStoreFileCount : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreFileCount)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("in_progress"u8); + writer.WriteNumberValue(InProgress); + writer.WritePropertyName("completed"u8); + writer.WriteNumberValue(Completed); + writer.WritePropertyName("failed"u8); + writer.WriteNumberValue(Failed); + writer.WritePropertyName("cancelled"u8); + writer.WriteNumberValue(Cancelled); + writer.WritePropertyName("total"u8); + writer.WriteNumberValue(Total); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + VectorStoreFileCount IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreFileCount)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVectorStoreFileCount(document.RootElement, options); + } + + internal static VectorStoreFileCount DeserializeVectorStoreFileCount(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int inProgress = default; + int completed = default; + int failed = default; + int cancelled = default; + int total = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("in_progress"u8)) + { + inProgress = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("completed"u8)) + { + completed = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("failed"u8)) + { + failed = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("cancelled"u8)) + { + cancelled = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("total"u8)) + { + total = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new VectorStoreFileCount( + inProgress, + completed, + failed, + cancelled, + total, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(VectorStoreFileCount)} does not support writing '{options.Format}' format."); + } + } + + VectorStoreFileCount IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreFileCount(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VectorStoreFileCount)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static VectorStoreFileCount FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreFileCount(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileCount.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileCount.cs new file mode 100644 index 000000000000..3ccf802846a0 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileCount.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Counts of files processed or being processed by this vector store grouped by status. + public partial class VectorStoreFileCount + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The number of files that are currently being processed. + /// The number of files that have been successfully processed. + /// The number of files that have failed to process. + /// The number of files that were cancelled. + /// The total number of files. + internal VectorStoreFileCount(int inProgress, int completed, int failed, int cancelled, int total) + { + InProgress = inProgress; + Completed = completed; + Failed = failed; + Cancelled = cancelled; + Total = total; + } + + /// Initializes a new instance of . + /// The number of files that are currently being processed. + /// The number of files that have been successfully processed. + /// The number of files that have failed to process. + /// The number of files that were cancelled. + /// The total number of files. + /// Keeps track of any properties unknown to the library. + internal VectorStoreFileCount(int inProgress, int completed, int failed, int cancelled, int total, IDictionary serializedAdditionalRawData) + { + InProgress = inProgress; + Completed = completed; + Failed = failed; + Cancelled = cancelled; + Total = total; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VectorStoreFileCount() + { + } + + /// The number of files that are currently being processed. + public int InProgress { get; } + /// The number of files that have been successfully processed. + public int Completed { get; } + /// The number of files that have failed to process. + public int Failed { get; } + /// The number of files that were cancelled. + public int Cancelled { get; } + /// The total number of files. + public int Total { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileDeletionStatus.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileDeletionStatus.Serialization.cs new file mode 100644 index 000000000000..05cdfec73547 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileDeletionStatus.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class VectorStoreFileDeletionStatus : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreFileDeletionStatus)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("deleted"u8); + writer.WriteBooleanValue(Deleted); + writer.WritePropertyName("object"u8); + writer.WriteStringValue(Object.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + VectorStoreFileDeletionStatus IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreFileDeletionStatus)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVectorStoreFileDeletionStatus(document.RootElement, options); + } + + internal static VectorStoreFileDeletionStatus DeserializeVectorStoreFileDeletionStatus(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + bool deleted = default; + VectorStoreFileDeletionStatusObject @object = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("deleted"u8)) + { + deleted = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("object"u8)) + { + @object = new VectorStoreFileDeletionStatusObject(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new VectorStoreFileDeletionStatus(id, deleted, @object, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(VectorStoreFileDeletionStatus)} does not support writing '{options.Format}' format."); + } + } + + VectorStoreFileDeletionStatus IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreFileDeletionStatus(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VectorStoreFileDeletionStatus)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static VectorStoreFileDeletionStatus FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreFileDeletionStatus(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileDeletionStatus.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileDeletionStatus.cs new file mode 100644 index 000000000000..c1e747ba4e97 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileDeletionStatus.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Response object for deleting a vector store file relationship. + public partial class VectorStoreFileDeletionStatus + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The ID of the resource specified for deletion. + /// A value indicating whether deletion was successful. + /// is null. + internal VectorStoreFileDeletionStatus(string id, bool deleted) + { + Argument.AssertNotNull(id, nameof(id)); + + Id = id; + Deleted = deleted; + } + + /// Initializes a new instance of . + /// The ID of the resource specified for deletion. + /// A value indicating whether deletion was successful. + /// The object type, which is always 'vector_store.deleted'. + /// Keeps track of any properties unknown to the library. + internal VectorStoreFileDeletionStatus(string id, bool deleted, VectorStoreFileDeletionStatusObject @object, IDictionary serializedAdditionalRawData) + { + Id = id; + Deleted = deleted; + Object = @object; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VectorStoreFileDeletionStatus() + { + } + + /// The ID of the resource specified for deletion. + public string Id { get; } + /// A value indicating whether deletion was successful. + public bool Deleted { get; } + /// The object type, which is always 'vector_store.deleted'. + public VectorStoreFileDeletionStatusObject Object { get; } = VectorStoreFileDeletionStatusObject.VectorStoreFileDeleted; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileDeletionStatusObject.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileDeletionStatusObject.cs new file mode 100644 index 000000000000..9e9375c41e1d --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileDeletionStatusObject.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// The VectorStoreFileDeletionStatus_object. + public readonly partial struct VectorStoreFileDeletionStatusObject : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public VectorStoreFileDeletionStatusObject(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string VectorStoreFileDeletedValue = "vector_store.file.deleted"; + + /// vector_store.file.deleted. + public static VectorStoreFileDeletionStatusObject VectorStoreFileDeleted { get; } = new VectorStoreFileDeletionStatusObject(VectorStoreFileDeletedValue); + /// Determines if two values are the same. + public static bool operator ==(VectorStoreFileDeletionStatusObject left, VectorStoreFileDeletionStatusObject right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(VectorStoreFileDeletionStatusObject left, VectorStoreFileDeletionStatusObject right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator VectorStoreFileDeletionStatusObject(string value) => new VectorStoreFileDeletionStatusObject(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VectorStoreFileDeletionStatusObject other && Equals(other); + /// + public bool Equals(VectorStoreFileDeletionStatusObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileError.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileError.Serialization.cs new file mode 100644 index 000000000000..f84b274ec6e8 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileError.Serialization.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class VectorStoreFileError : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreFileError)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code.ToString()); + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + VectorStoreFileError IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreFileError)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVectorStoreFileError(document.RootElement, options); + } + + internal static VectorStoreFileError DeserializeVectorStoreFileError(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + VectorStoreFileErrorCode code = default; + string message = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("code"u8)) + { + code = new VectorStoreFileErrorCode(property.Value.GetString()); + continue; + } + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new VectorStoreFileError(code, message, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(VectorStoreFileError)} does not support writing '{options.Format}' format."); + } + } + + VectorStoreFileError IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreFileError(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VectorStoreFileError)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static VectorStoreFileError FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreFileError(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileError.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileError.cs new file mode 100644 index 000000000000..52548af59ca2 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileError.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Details on the error that may have occurred while processing a file for this vector store. + public partial class VectorStoreFileError + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// One of `server_error` or `rate_limit_exceeded`. + /// A human-readable description of the error. + /// is null. + internal VectorStoreFileError(VectorStoreFileErrorCode code, string message) + { + Argument.AssertNotNull(message, nameof(message)); + + Code = code; + Message = message; + } + + /// Initializes a new instance of . + /// One of `server_error` or `rate_limit_exceeded`. + /// A human-readable description of the error. + /// Keeps track of any properties unknown to the library. + internal VectorStoreFileError(VectorStoreFileErrorCode code, string message, IDictionary serializedAdditionalRawData) + { + Code = code; + Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VectorStoreFileError() + { + } + + /// One of `server_error` or `rate_limit_exceeded`. + public VectorStoreFileErrorCode Code { get; } + /// A human-readable description of the error. + public string Message { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileErrorCode.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileErrorCode.cs new file mode 100644 index 000000000000..3e6a2e5863a9 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileErrorCode.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// Error code variants for vector store file processing. + public readonly partial struct VectorStoreFileErrorCode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public VectorStoreFileErrorCode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ServerErrorValue = "server_error"; + private const string InvalidFileValue = "invalid_file"; + private const string UnsupportedFileValue = "unsupported_file"; + + /// An server error occurred. + public static VectorStoreFileErrorCode ServerError { get; } = new VectorStoreFileErrorCode(ServerErrorValue); + /// The file is not valid. + public static VectorStoreFileErrorCode InvalidFile { get; } = new VectorStoreFileErrorCode(InvalidFileValue); + /// The file is of unsupported type. + public static VectorStoreFileErrorCode UnsupportedFile { get; } = new VectorStoreFileErrorCode(UnsupportedFileValue); + /// Determines if two values are the same. + public static bool operator ==(VectorStoreFileErrorCode left, VectorStoreFileErrorCode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(VectorStoreFileErrorCode left, VectorStoreFileErrorCode right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator VectorStoreFileErrorCode(string value) => new VectorStoreFileErrorCode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VectorStoreFileErrorCode other && Equals(other); + /// + public bool Equals(VectorStoreFileErrorCode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileObject.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileObject.cs new file mode 100644 index 000000000000..e6592200b640 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileObject.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// The VectorStoreFile_object. + public readonly partial struct VectorStoreFileObject : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public VectorStoreFileObject(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string VectorStoreFileValue = "vector_store.file"; + + /// vector_store.file. + public static VectorStoreFileObject VectorStoreFile { get; } = new VectorStoreFileObject(VectorStoreFileValue); + /// Determines if two values are the same. + public static bool operator ==(VectorStoreFileObject left, VectorStoreFileObject right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(VectorStoreFileObject left, VectorStoreFileObject right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator VectorStoreFileObject(string value) => new VectorStoreFileObject(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VectorStoreFileObject other && Equals(other); + /// + public bool Equals(VectorStoreFileObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileStatus.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileStatus.cs new file mode 100644 index 000000000000..dd9dd5e72228 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileStatus.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// Vector store file status. + public readonly partial struct VectorStoreFileStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public VectorStoreFileStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InProgressValue = "in_progress"; + private const string CompletedValue = "completed"; + private const string FailedValue = "failed"; + private const string CancelledValue = "cancelled"; + + /// The file is currently being processed. + public static VectorStoreFileStatus InProgress { get; } = new VectorStoreFileStatus(InProgressValue); + /// The file has been successfully processed. + public static VectorStoreFileStatus Completed { get; } = new VectorStoreFileStatus(CompletedValue); + /// The file has failed to process. + public static VectorStoreFileStatus Failed { get; } = new VectorStoreFileStatus(FailedValue); + /// The file was cancelled. + public static VectorStoreFileStatus Cancelled { get; } = new VectorStoreFileStatus(CancelledValue); + /// Determines if two values are the same. + public static bool operator ==(VectorStoreFileStatus left, VectorStoreFileStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(VectorStoreFileStatus left, VectorStoreFileStatus right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator VectorStoreFileStatus(string value) => new VectorStoreFileStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VectorStoreFileStatus other && Equals(other); + /// + public bool Equals(VectorStoreFileStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileStatusFilter.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileStatusFilter.cs new file mode 100644 index 000000000000..a240229d8e27 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreFileStatusFilter.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// Query parameter filter for vector store file retrieval endpoint. + public readonly partial struct VectorStoreFileStatusFilter : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public VectorStoreFileStatusFilter(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InProgressValue = "in_progress"; + private const string CompletedValue = "completed"; + private const string FailedValue = "failed"; + private const string CancelledValue = "cancelled"; + + /// Retrieve only files that are currently being processed. + public static VectorStoreFileStatusFilter InProgress { get; } = new VectorStoreFileStatusFilter(InProgressValue); + /// Retrieve only files that have been successfully processed. + public static VectorStoreFileStatusFilter Completed { get; } = new VectorStoreFileStatusFilter(CompletedValue); + /// Retrieve only files that have failed to process. + public static VectorStoreFileStatusFilter Failed { get; } = new VectorStoreFileStatusFilter(FailedValue); + /// Retrieve only files that were cancelled. + public static VectorStoreFileStatusFilter Cancelled { get; } = new VectorStoreFileStatusFilter(CancelledValue); + /// Determines if two values are the same. + public static bool operator ==(VectorStoreFileStatusFilter left, VectorStoreFileStatusFilter right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(VectorStoreFileStatusFilter left, VectorStoreFileStatusFilter right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator VectorStoreFileStatusFilter(string value) => new VectorStoreFileStatusFilter(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VectorStoreFileStatusFilter other && Equals(other); + /// + public bool Equals(VectorStoreFileStatusFilter other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreObject.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreObject.cs new file mode 100644 index 000000000000..dc487e425166 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreObject.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// The VectorStore_object. + public readonly partial struct VectorStoreObject : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public VectorStoreObject(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string VectorStoreValue = "vector_store"; + + /// vector_store. + public static VectorStoreObject VectorStore { get; } = new VectorStoreObject(VectorStoreValue); + /// Determines if two values are the same. + public static bool operator ==(VectorStoreObject left, VectorStoreObject right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(VectorStoreObject left, VectorStoreObject right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator VectorStoreObject(string value) => new VectorStoreObject(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VectorStoreObject other && Equals(other); + /// + public bool Equals(VectorStoreObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreStaticChunkingStrategyOptions.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreStaticChunkingStrategyOptions.Serialization.cs new file mode 100644 index 000000000000..73683885b328 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreStaticChunkingStrategyOptions.Serialization.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class VectorStoreStaticChunkingStrategyOptions : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreStaticChunkingStrategyOptions)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("max_chunk_size_tokens"u8); + writer.WriteNumberValue(MaxChunkSizeTokens); + writer.WritePropertyName("chunk_overlap_tokens"u8); + writer.WriteNumberValue(ChunkOverlapTokens); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + VectorStoreStaticChunkingStrategyOptions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreStaticChunkingStrategyOptions)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVectorStoreStaticChunkingStrategyOptions(document.RootElement, options); + } + + internal static VectorStoreStaticChunkingStrategyOptions DeserializeVectorStoreStaticChunkingStrategyOptions(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int maxChunkSizeTokens = default; + int chunkOverlapTokens = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("max_chunk_size_tokens"u8)) + { + maxChunkSizeTokens = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("chunk_overlap_tokens"u8)) + { + chunkOverlapTokens = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new VectorStoreStaticChunkingStrategyOptions(maxChunkSizeTokens, chunkOverlapTokens, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(VectorStoreStaticChunkingStrategyOptions)} does not support writing '{options.Format}' format."); + } + } + + VectorStoreStaticChunkingStrategyOptions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreStaticChunkingStrategyOptions(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VectorStoreStaticChunkingStrategyOptions)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static VectorStoreStaticChunkingStrategyOptions FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreStaticChunkingStrategyOptions(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreStaticChunkingStrategyOptions.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreStaticChunkingStrategyOptions.cs new file mode 100644 index 000000000000..ddf36004843f --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreStaticChunkingStrategyOptions.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// Options to configure a vector store static chunking strategy. + public partial class VectorStoreStaticChunkingStrategyOptions + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The maximum number of tokens in each chunk. The default value is 800. The minimum value is 100 and the maximum value is 4096. + /// + /// The number of tokens that overlap between chunks. The default value is 400. + /// Note that the overlap must not exceed half of max_chunk_size_tokens. + /// + public VectorStoreStaticChunkingStrategyOptions(int maxChunkSizeTokens, int chunkOverlapTokens) + { + MaxChunkSizeTokens = maxChunkSizeTokens; + ChunkOverlapTokens = chunkOverlapTokens; + } + + /// Initializes a new instance of . + /// The maximum number of tokens in each chunk. The default value is 800. The minimum value is 100 and the maximum value is 4096. + /// + /// The number of tokens that overlap between chunks. The default value is 400. + /// Note that the overlap must not exceed half of max_chunk_size_tokens. + /// + /// Keeps track of any properties unknown to the library. + internal VectorStoreStaticChunkingStrategyOptions(int maxChunkSizeTokens, int chunkOverlapTokens, IDictionary serializedAdditionalRawData) + { + MaxChunkSizeTokens = maxChunkSizeTokens; + ChunkOverlapTokens = chunkOverlapTokens; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VectorStoreStaticChunkingStrategyOptions() + { + } + + /// The maximum number of tokens in each chunk. The default value is 800. The minimum value is 100 and the maximum value is 4096. + public int MaxChunkSizeTokens { get; set; } + /// + /// The number of tokens that overlap between chunks. The default value is 400. + /// Note that the overlap must not exceed half of max_chunk_size_tokens. + /// + public int ChunkOverlapTokens { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreStaticChunkingStrategyRequest.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreStaticChunkingStrategyRequest.Serialization.cs new file mode 100644 index 000000000000..0064b6a8e7f7 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreStaticChunkingStrategyRequest.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class VectorStoreStaticChunkingStrategyRequest : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreStaticChunkingStrategyRequest)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("static"u8); + writer.WriteObjectValue(Static, options); + } + + VectorStoreStaticChunkingStrategyRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreStaticChunkingStrategyRequest)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVectorStoreStaticChunkingStrategyRequest(document.RootElement, options); + } + + internal static VectorStoreStaticChunkingStrategyRequest DeserializeVectorStoreStaticChunkingStrategyRequest(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + VectorStoreStaticChunkingStrategyOptions @static = default; + VectorStoreChunkingStrategyRequestType type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("static"u8)) + { + @static = VectorStoreStaticChunkingStrategyOptions.DeserializeVectorStoreStaticChunkingStrategyOptions(property.Value, options); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new VectorStoreChunkingStrategyRequestType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new VectorStoreStaticChunkingStrategyRequest(type, serializedAdditionalRawData, @static); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(VectorStoreStaticChunkingStrategyRequest)} does not support writing '{options.Format}' format."); + } + } + + VectorStoreStaticChunkingStrategyRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreStaticChunkingStrategyRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VectorStoreStaticChunkingStrategyRequest)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new VectorStoreStaticChunkingStrategyRequest FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreStaticChunkingStrategyRequest(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreStaticChunkingStrategyRequest.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreStaticChunkingStrategyRequest.cs new file mode 100644 index 000000000000..a54136af8098 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreStaticChunkingStrategyRequest.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// A statically configured chunking strategy. + public partial class VectorStoreStaticChunkingStrategyRequest : VectorStoreChunkingStrategyRequest + { + /// Initializes a new instance of . + /// The options for the static chunking strategy. + /// is null. + public VectorStoreStaticChunkingStrategyRequest(VectorStoreStaticChunkingStrategyOptions @static) + { + Argument.AssertNotNull(@static, nameof(@static)); + + Type = VectorStoreChunkingStrategyRequestType.Static; + Static = @static; + } + + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + /// The options for the static chunking strategy. + internal VectorStoreStaticChunkingStrategyRequest(VectorStoreChunkingStrategyRequestType type, IDictionary serializedAdditionalRawData, VectorStoreStaticChunkingStrategyOptions @static) : base(type, serializedAdditionalRawData) + { + Static = @static; + } + + /// Initializes a new instance of for deserialization. + internal VectorStoreStaticChunkingStrategyRequest() + { + } + + /// The options for the static chunking strategy. + public VectorStoreStaticChunkingStrategyOptions Static { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreStaticChunkingStrategyResponse.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreStaticChunkingStrategyResponse.Serialization.cs new file mode 100644 index 000000000000..b07c1a9fa77d --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreStaticChunkingStrategyResponse.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Assistants +{ + public partial class VectorStoreStaticChunkingStrategyResponse : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreStaticChunkingStrategyResponse)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("static"u8); + writer.WriteObjectValue(Static, options); + } + + VectorStoreStaticChunkingStrategyResponse IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VectorStoreStaticChunkingStrategyResponse)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVectorStoreStaticChunkingStrategyResponse(document.RootElement, options); + } + + internal static VectorStoreStaticChunkingStrategyResponse DeserializeVectorStoreStaticChunkingStrategyResponse(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + VectorStoreStaticChunkingStrategyOptions @static = default; + VectorStoreChunkingStrategyResponseType type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("static"u8)) + { + @static = VectorStoreStaticChunkingStrategyOptions.DeserializeVectorStoreStaticChunkingStrategyOptions(property.Value, options); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new VectorStoreChunkingStrategyResponseType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new VectorStoreStaticChunkingStrategyResponse(type, serializedAdditionalRawData, @static); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(VectorStoreStaticChunkingStrategyResponse)} does not support writing '{options.Format}' format."); + } + } + + VectorStoreStaticChunkingStrategyResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreStaticChunkingStrategyResponse(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VectorStoreStaticChunkingStrategyResponse)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new VectorStoreStaticChunkingStrategyResponse FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVectorStoreStaticChunkingStrategyResponse(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreStaticChunkingStrategyResponse.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreStaticChunkingStrategyResponse.cs new file mode 100644 index 000000000000..e22a306ddefa --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreStaticChunkingStrategyResponse.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Assistants +{ + /// A statically configured chunking strategy. + public partial class VectorStoreStaticChunkingStrategyResponse : VectorStoreChunkingStrategyResponse + { + /// Initializes a new instance of . + /// The options for the static chunking strategy. + /// is null. + internal VectorStoreStaticChunkingStrategyResponse(VectorStoreStaticChunkingStrategyOptions @static) + { + Argument.AssertNotNull(@static, nameof(@static)); + + Type = VectorStoreChunkingStrategyResponseType.Static; + Static = @static; + } + + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + /// The options for the static chunking strategy. + internal VectorStoreStaticChunkingStrategyResponse(VectorStoreChunkingStrategyResponseType type, IDictionary serializedAdditionalRawData, VectorStoreStaticChunkingStrategyOptions @static) : base(type, serializedAdditionalRawData) + { + Static = @static; + } + + /// Initializes a new instance of for deserialization. + internal VectorStoreStaticChunkingStrategyResponse() + { + } + + /// The options for the static chunking strategy. + public VectorStoreStaticChunkingStrategyOptions Static { get; } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreStatus.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreStatus.cs new file mode 100644 index 000000000000..0e0818f87e8e --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Generated/VectorStoreStatus.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Assistants +{ + /// Vector store possible status. + public readonly partial struct VectorStoreStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public VectorStoreStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ExpiredValue = "expired"; + private const string InProgressValue = "in_progress"; + private const string CompletedValue = "completed"; + + /// expired status indicates that this vector store has expired and is no longer available for use. + public static VectorStoreStatus Expired { get; } = new VectorStoreStatus(ExpiredValue); + /// in_progress status indicates that this vector store is still processing files. + public static VectorStoreStatus InProgress { get; } = new VectorStoreStatus(InProgressValue); + /// completed status indicates that this vector store is ready for use. + public static VectorStoreStatus Completed { get; } = new VectorStoreStatus(CompletedValue); + /// Determines if two values are the same. + public static bool operator ==(VectorStoreStatus left, VectorStoreStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(VectorStoreStatus left, VectorStoreStatus right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator VectorStoreStatus(string value) => new VectorStoreStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VectorStoreStatus other && Equals(other); + /// + public bool Equals(VectorStoreStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/ai/Azure.AI.Assistants/src/Properties/AssemblyInfo.cs b/sdk/ai/Azure.AI.Assistants/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..adaf82c665bb --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/src/Properties/AssemblyInfo.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Azure.AI.Assistants.Tests, PublicKey = 0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] + +// Replace Microsoft.Test with the correct resource provider namepace for your service and uncomment. +// See https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-services-resource-providers +// for the list of possible values. +[assembly: Azure.Core.AzureResourceProviderNamespace("Microsoft.Template")] diff --git a/sdk/ai/Azure.AI.Assistants/tests/Azure.AI.Assistants.Tests.csproj b/sdk/ai/Azure.AI.Assistants/tests/Azure.AI.Assistants.Tests.csproj new file mode 100644 index 000000000000..689790a3afee --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/tests/Azure.AI.Assistants.Tests.csproj @@ -0,0 +1,20 @@ + + + $(RequiredTargetFrameworks) + + $(NoWarn);CS1591 + + + + + + + + + + + + + + + diff --git a/sdk/ai/Azure.AI.Assistants/tests/Generated/Samples/Samples_AIAssistantClient.cs b/sdk/ai/Azure.AI.Assistants/tests/Generated/Samples/Samples_AIAssistantClient.cs new file mode 100644 index 000000000000..d42a5a009c51 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/tests/Generated/Samples/Samples_AIAssistantClient.cs @@ -0,0 +1,7046 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.AI.Assistants.Samples +{ + public partial class Samples_AIAssistantClient + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CreateAgent_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + model = "", + }); + Response response = client.CreateAgent(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").ToString()); + Console.WriteLine(result.GetProperty("temperature").ToString()); + Console.WriteLine(result.GetProperty("top_p").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CreateAgent_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + model = "", + }); + Response response = await client.CreateAgentAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").ToString()); + Console.WriteLine(result.GetProperty("temperature").ToString()); + Console.WriteLine(result.GetProperty("top_p").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CreateAgent_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.CreateAgent(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CreateAgent_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.CreateAgentAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CreateAgent_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + model = "", + name = "", + description = "", + instructions = "", + tools = new object[] + { +new +{ +type = "code_interpreter", +} + }, + tool_resources = new + { + code_interpreter = new + { + file_ids = new object[] + { +"" + }, + data_sources = new object[] + { +new +{ +uri = "", +type = "uri_asset", +} + }, + }, + file_search = new + { + vector_store_ids = new object[] + { +"" + }, + vector_stores = new object[] + { +new +{ +name = "", +configuration = new +{ +data_sources = new object[] +{ +null +}, +}, +} + }, + }, + azure_ai_search = new + { + indexes = new object[] + { +new +{ +index_connection_id = "", +index_name = "", +query_type = "simple", +top_k = 1234, +filter = "", +} + }, + }, + }, + temperature = 123.45F, + top_p = 123.45F, + response_format = "", + metadata = new + { + key = "", + }, + }); + Response response = client.CreateAgent(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("uri").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("uri").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); + Console.WriteLine(result.GetProperty("temperature").ToString()); + Console.WriteLine(result.GetProperty("top_p").ToString()); + Console.WriteLine(result.GetProperty("response_format").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CreateAgent_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + model = "", + name = "", + description = "", + instructions = "", + tools = new object[] + { +new +{ +type = "code_interpreter", +} + }, + tool_resources = new + { + code_interpreter = new + { + file_ids = new object[] + { +"" + }, + data_sources = new object[] + { +new +{ +uri = "", +type = "uri_asset", +} + }, + }, + file_search = new + { + vector_store_ids = new object[] + { +"" + }, + vector_stores = new object[] + { +new +{ +name = "", +configuration = new +{ +data_sources = new object[] +{ +null +}, +}, +} + }, + }, + azure_ai_search = new + { + indexes = new object[] + { +new +{ +index_connection_id = "", +index_name = "", +query_type = "simple", +top_k = 1234, +filter = "", +} + }, + }, + }, + temperature = 123.45F, + top_p = 123.45F, + response_format = "", + metadata = new + { + key = "", + }, + }); + Response response = await client.CreateAgentAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("uri").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("uri").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); + Console.WriteLine(result.GetProperty("temperature").ToString()); + Console.WriteLine(result.GetProperty("top_p").ToString()); + Console.WriteLine(result.GetProperty("response_format").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CreateAgent_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + ToolResources toolResources = new ToolResources + { + CodeInterpreter = new CodeInterpreterToolResource + { + FileIds = { "" }, + DataSources = { new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset) }, + }, + FileSearch = new FileSearchToolResource + { + VectorStoreIds = { "" }, + VectorStores = {new VectorStoreConfigurations("", new VectorStoreConfiguration(new VectorStoreDataSource[] +{ +default +}))}, + }, + AzureAISearch = new AzureAISearchResource + { + IndexList = {new AISearchIndexResource("", "") +{ +QueryType = AzureAISearchQueryType.Simple, +TopK = 1234, +Filter = "", +}}, + }, + }; + Response response = client.CreateAgent("", name: "", description: "", instructions: "", tools: new ToolDefinition[] + { +new CodeInterpreterToolDefinition() + }, toolResources: toolResources, temperature: 123.45F, topP: 123.45F, responseFormat: BinaryData.FromObjectAsJson(""), metadata: new Dictionary + { + ["key"] = "" + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CreateAgent_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + ToolResources toolResources = new ToolResources + { + CodeInterpreter = new CodeInterpreterToolResource + { + FileIds = { "" }, + DataSources = { new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset) }, + }, + FileSearch = new FileSearchToolResource + { + VectorStoreIds = { "" }, + VectorStores = {new VectorStoreConfigurations("", new VectorStoreConfiguration(new VectorStoreDataSource[] +{ +default +}))}, + }, + AzureAISearch = new AzureAISearchResource + { + IndexList = {new AISearchIndexResource("", "") +{ +QueryType = AzureAISearchQueryType.Simple, +TopK = 1234, +Filter = "", +}}, + }, + }; + Response response = await client.CreateAgentAsync("", name: "", description: "", instructions: "", tools: new ToolDefinition[] + { +new CodeInterpreterToolDefinition() + }, toolResources: toolResources, temperature: 123.45F, topP: 123.45F, responseFormat: BinaryData.FromObjectAsJson(""), metadata: new Dictionary + { + ["key"] = "" + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetAgent_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetAgent("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").ToString()); + Console.WriteLine(result.GetProperty("temperature").ToString()); + Console.WriteLine(result.GetProperty("top_p").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetAgent_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetAgentAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").ToString()); + Console.WriteLine(result.GetProperty("temperature").ToString()); + Console.WriteLine(result.GetProperty("top_p").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetAgent_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetAgent(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetAgent_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetAgentAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetAgent_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetAgent("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("uri").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("uri").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); + Console.WriteLine(result.GetProperty("temperature").ToString()); + Console.WriteLine(result.GetProperty("top_p").ToString()); + Console.WriteLine(result.GetProperty("response_format").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetAgent_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetAgentAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("uri").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("uri").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); + Console.WriteLine(result.GetProperty("temperature").ToString()); + Console.WriteLine(result.GetProperty("top_p").ToString()); + Console.WriteLine(result.GetProperty("response_format").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetAgent_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetAgent(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetAgent_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetAgentAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_UpdateAgent_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = client.UpdateAgent("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").ToString()); + Console.WriteLine(result.GetProperty("temperature").ToString()); + Console.WriteLine(result.GetProperty("top_p").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_UpdateAgent_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = await client.UpdateAgentAsync("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").ToString()); + Console.WriteLine(result.GetProperty("temperature").ToString()); + Console.WriteLine(result.GetProperty("top_p").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_UpdateAgent_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.UpdateAgent(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_UpdateAgent_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.UpdateAgentAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_UpdateAgent_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + model = "", + name = "", + description = "", + instructions = "", + tools = new object[] + { +new +{ +type = "code_interpreter", +} + }, + tool_resources = new + { + code_interpreter = new + { + file_ids = new object[] + { +"" + }, + data_sources = new object[] + { +new +{ +uri = "", +type = "uri_asset", +} + }, + }, + file_search = new + { + vector_store_ids = new object[] + { +"" + }, + vector_stores = new object[] + { +new +{ +name = "", +configuration = new +{ +data_sources = new object[] +{ +null +}, +}, +} + }, + }, + azure_ai_search = new + { + indexes = new object[] + { +new +{ +index_connection_id = "", +index_name = "", +query_type = "simple", +top_k = 1234, +filter = "", +} + }, + }, + }, + temperature = 123.45F, + top_p = 123.45F, + response_format = "", + metadata = new + { + key = "", + }, + }); + Response response = client.UpdateAgent("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("uri").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("uri").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); + Console.WriteLine(result.GetProperty("temperature").ToString()); + Console.WriteLine(result.GetProperty("top_p").ToString()); + Console.WriteLine(result.GetProperty("response_format").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_UpdateAgent_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + model = "", + name = "", + description = "", + instructions = "", + tools = new object[] + { +new +{ +type = "code_interpreter", +} + }, + tool_resources = new + { + code_interpreter = new + { + file_ids = new object[] + { +"" + }, + data_sources = new object[] + { +new +{ +uri = "", +type = "uri_asset", +} + }, + }, + file_search = new + { + vector_store_ids = new object[] + { +"" + }, + vector_stores = new object[] + { +new +{ +name = "", +configuration = new +{ +data_sources = new object[] +{ +null +}, +}, +} + }, + }, + azure_ai_search = new + { + indexes = new object[] + { +new +{ +index_connection_id = "", +index_name = "", +query_type = "simple", +top_k = 1234, +filter = "", +} + }, + }, + }, + temperature = 123.45F, + top_p = 123.45F, + response_format = "", + metadata = new + { + key = "", + }, + }); + Response response = await client.UpdateAgentAsync("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("uri").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("uri").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); + Console.WriteLine(result.GetProperty("temperature").ToString()); + Console.WriteLine(result.GetProperty("top_p").ToString()); + Console.WriteLine(result.GetProperty("response_format").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_UpdateAgent_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + ToolResources toolResources = new ToolResources + { + CodeInterpreter = new CodeInterpreterToolResource + { + FileIds = { "" }, + DataSources = { new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset) }, + }, + FileSearch = new FileSearchToolResource + { + VectorStoreIds = { "" }, + VectorStores = {new VectorStoreConfigurations("", new VectorStoreConfiguration(new VectorStoreDataSource[] +{ +default +}))}, + }, + AzureAISearch = new AzureAISearchResource + { + IndexList = {new AISearchIndexResource("", "") +{ +QueryType = AzureAISearchQueryType.Simple, +TopK = 1234, +Filter = "", +}}, + }, + }; + Response response = client.UpdateAgent("", model: "", name: "", description: "", instructions: "", tools: new ToolDefinition[] + { +new CodeInterpreterToolDefinition() + }, toolResources: toolResources, temperature: 123.45F, topP: 123.45F, responseFormat: BinaryData.FromObjectAsJson(""), metadata: new Dictionary + { + ["key"] = "" + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_UpdateAgent_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + ToolResources toolResources = new ToolResources + { + CodeInterpreter = new CodeInterpreterToolResource + { + FileIds = { "" }, + DataSources = { new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset) }, + }, + FileSearch = new FileSearchToolResource + { + VectorStoreIds = { "" }, + VectorStores = {new VectorStoreConfigurations("", new VectorStoreConfiguration(new VectorStoreDataSource[] +{ +default +}))}, + }, + AzureAISearch = new AzureAISearchResource + { + IndexList = {new AISearchIndexResource("", "") +{ +QueryType = AzureAISearchQueryType.Simple, +TopK = 1234, +Filter = "", +}}, + }, + }; + Response response = await client.UpdateAgentAsync("", model: "", name: "", description: "", instructions: "", tools: new ToolDefinition[] + { +new CodeInterpreterToolDefinition() + }, toolResources: toolResources, temperature: 123.45F, topP: 123.45F, responseFormat: BinaryData.FromObjectAsJson(""), metadata: new Dictionary + { + ["key"] = "" + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CreateThread_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = client.CreateThread(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CreateThread_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = await client.CreateThreadAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CreateThread_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.CreateThread(); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CreateThread_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.CreateThreadAsync(); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CreateThread_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + messages = new object[] + { +new +{ +role = "user", +content = "", +attachments = new object[] +{ +new +{ +file_id = "", +data_source = new +{ +uri = "", +type = "uri_asset", +}, +tools = new object[] +{ +new +{ +type = "code_interpreter", +} +}, +} +}, +metadata = new +{ +key = "", +}, +} + }, + tool_resources = new + { + code_interpreter = new + { + file_ids = new object[] + { +"" + }, + data_sources = new object[] + { +null + }, + }, + file_search = new + { + vector_store_ids = new object[] + { +"" + }, + vector_stores = new object[] + { +new +{ +name = "", +configuration = new +{ +data_sources = new object[] +{ +null +}, +}, +} + }, + }, + azure_ai_search = new + { + indexes = new object[] + { +new +{ +index_connection_id = "", +index_name = "", +query_type = "simple", +top_k = 1234, +filter = "", +} + }, + }, + }, + metadata = new + { + key = "", + }, + }); + Response response = client.CreateThread(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("uri").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("uri").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CreateThread_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + messages = new object[] + { +new +{ +role = "user", +content = "", +attachments = new object[] +{ +new +{ +file_id = "", +data_source = new +{ +uri = "", +type = "uri_asset", +}, +tools = new object[] +{ +new +{ +type = "code_interpreter", +} +}, +} +}, +metadata = new +{ +key = "", +}, +} + }, + tool_resources = new + { + code_interpreter = new + { + file_ids = new object[] + { +"" + }, + data_sources = new object[] + { +null + }, + }, + file_search = new + { + vector_store_ids = new object[] + { +"" + }, + vector_stores = new object[] + { +new +{ +name = "", +configuration = new +{ +data_sources = new object[] +{ +null +}, +}, +} + }, + }, + azure_ai_search = new + { + indexes = new object[] + { +new +{ +index_connection_id = "", +index_name = "", +query_type = "simple", +top_k = 1234, +filter = "", +} + }, + }, + }, + metadata = new + { + key = "", + }, + }); + Response response = await client.CreateThreadAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("uri").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("uri").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CreateThread_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + ToolResources toolResources = new ToolResources + { + CodeInterpreter = new CodeInterpreterToolResource + { + FileIds = { "" }, + DataSources = { default }, + }, + FileSearch = new FileSearchToolResource + { + VectorStoreIds = { "" }, + VectorStores = {new VectorStoreConfigurations("", new VectorStoreConfiguration(new VectorStoreDataSource[] +{ +default +}))}, + }, + AzureAISearch = new AzureAISearchResource + { + IndexList = {new AISearchIndexResource("", "") +{ +QueryType = AzureAISearchQueryType.Simple, +TopK = 1234, +Filter = "", +}}, + }, + }; + Response response = client.CreateThread(messages: new ThreadMessageOptions[] + { +new ThreadMessageOptions(MessageRole.User, "") +{ +Attachments = {new MessageAttachment(new BinaryData[] +{ +BinaryData.FromObjectAsJson(new +{ +type = "code_interpreter", +}) +}) +{ +FileId = "", +DataSource = new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset), +}}, +Metadata = +{ +["key"] = "" +}, +} + }, toolResources: toolResources, metadata: new Dictionary + { + ["key"] = "" + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CreateThread_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + ToolResources toolResources = new ToolResources + { + CodeInterpreter = new CodeInterpreterToolResource + { + FileIds = { "" }, + DataSources = { default }, + }, + FileSearch = new FileSearchToolResource + { + VectorStoreIds = { "" }, + VectorStores = {new VectorStoreConfigurations("", new VectorStoreConfiguration(new VectorStoreDataSource[] +{ +default +}))}, + }, + AzureAISearch = new AzureAISearchResource + { + IndexList = {new AISearchIndexResource("", "") +{ +QueryType = AzureAISearchQueryType.Simple, +TopK = 1234, +Filter = "", +}}, + }, + }; + Response response = await client.CreateThreadAsync(messages: new ThreadMessageOptions[] + { +new ThreadMessageOptions(MessageRole.User, "") +{ +Attachments = {new MessageAttachment(new BinaryData[] +{ +BinaryData.FromObjectAsJson(new +{ +type = "code_interpreter", +}) +}) +{ +FileId = "", +DataSource = new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset), +}}, +Metadata = +{ +["key"] = "" +}, +} + }, toolResources: toolResources, metadata: new Dictionary + { + ["key"] = "" + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetThread_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetThread("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetThread_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetThreadAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetThread_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetThread(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetThread_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetThreadAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetThread_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetThread("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("uri").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("uri").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetThread_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetThreadAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("uri").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("uri").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetThread_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetThread(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetThread_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetThreadAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_UpdateThread_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = client.UpdateThread("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_UpdateThread_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = await client.UpdateThreadAsync("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_UpdateThread_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.UpdateThread(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_UpdateThread_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.UpdateThreadAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_UpdateThread_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + tool_resources = new + { + code_interpreter = new + { + file_ids = new object[] + { +"" + }, + data_sources = new object[] + { +new +{ +uri = "", +type = "uri_asset", +} + }, + }, + file_search = new + { + vector_store_ids = new object[] + { +"" + }, + vector_stores = new object[] + { +new +{ +name = "", +configuration = new +{ +data_sources = new object[] +{ +null +}, +}, +} + }, + }, + azure_ai_search = new + { + indexes = new object[] + { +new +{ +index_connection_id = "", +index_name = "", +query_type = "simple", +top_k = 1234, +filter = "", +} + }, + }, + }, + metadata = new + { + key = "", + }, + }); + Response response = client.UpdateThread("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("uri").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("uri").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_UpdateThread_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + tool_resources = new + { + code_interpreter = new + { + file_ids = new object[] + { +"" + }, + data_sources = new object[] + { +new +{ +uri = "", +type = "uri_asset", +} + }, + }, + file_search = new + { + vector_store_ids = new object[] + { +"" + }, + vector_stores = new object[] + { +new +{ +name = "", +configuration = new +{ +data_sources = new object[] +{ +null +}, +}, +} + }, + }, + azure_ai_search = new + { + indexes = new object[] + { +new +{ +index_connection_id = "", +index_name = "", +query_type = "simple", +top_k = 1234, +filter = "", +} + }, + }, + }, + metadata = new + { + key = "", + }, + }); + Response response = await client.UpdateThreadAsync("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("uri").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("data_sources")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("uri").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_stores")[0].GetProperty("configuration").GetProperty("data_sources")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_UpdateThread_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + ToolResources toolResources = new ToolResources + { + CodeInterpreter = new CodeInterpreterToolResource + { + FileIds = { "" }, + DataSources = { new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset) }, + }, + FileSearch = new FileSearchToolResource + { + VectorStoreIds = { "" }, + VectorStores = {new VectorStoreConfigurations("", new VectorStoreConfiguration(new VectorStoreDataSource[] +{ +default +}))}, + }, + AzureAISearch = new AzureAISearchResource + { + IndexList = {new AISearchIndexResource("", "") +{ +QueryType = AzureAISearchQueryType.Simple, +TopK = 1234, +Filter = "", +}}, + }, + }; + Response response = client.UpdateThread("", toolResources: toolResources, metadata: new Dictionary + { + ["key"] = "" + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_UpdateThread_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + ToolResources toolResources = new ToolResources + { + CodeInterpreter = new CodeInterpreterToolResource + { + FileIds = { "" }, + DataSources = { new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset) }, + }, + FileSearch = new FileSearchToolResource + { + VectorStoreIds = { "" }, + VectorStores = {new VectorStoreConfigurations("", new VectorStoreConfiguration(new VectorStoreDataSource[] +{ +default +}))}, + }, + AzureAISearch = new AzureAISearchResource + { + IndexList = {new AISearchIndexResource("", "") +{ +QueryType = AzureAISearchQueryType.Simple, +TopK = 1234, +Filter = "", +}}, + }, + }; + Response response = await client.UpdateThreadAsync("", toolResources: toolResources, metadata: new Dictionary + { + ["key"] = "" + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CreateMessage_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + role = "user", + content = "", + }); + Response response = client.CreateMessage("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_at").ToString()); + Console.WriteLine(result.GetProperty("role").ToString()); + Console.WriteLine(result.GetProperty("content")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("run_id").ToString()); + Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("tools")[0].ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CreateMessage_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + role = "user", + content = "", + }); + Response response = await client.CreateMessageAsync("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_at").ToString()); + Console.WriteLine(result.GetProperty("role").ToString()); + Console.WriteLine(result.GetProperty("content")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("run_id").ToString()); + Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("tools")[0].ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CreateMessage_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.CreateMessage("", MessageRole.User, ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CreateMessage_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.CreateMessageAsync("", MessageRole.User, ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CreateMessage_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + role = "user", + content = "", + attachments = new object[] + { +new +{ +file_id = "", +data_source = new +{ +uri = "", +type = "uri_asset", +}, +tools = new object[] +{ +new +{ +type = "code_interpreter", +} +}, +} + }, + metadata = new + { + key = "", + }, + }); + Response response = client.CreateMessage("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_at").ToString()); + Console.WriteLine(result.GetProperty("role").ToString()); + Console.WriteLine(result.GetProperty("content")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("run_id").ToString()); + Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("file_id").ToString()); + Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("data_source").GetProperty("uri").ToString()); + Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("data_source").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("tools")[0].ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CreateMessage_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + role = "user", + content = "", + attachments = new object[] + { +new +{ +file_id = "", +data_source = new +{ +uri = "", +type = "uri_asset", +}, +tools = new object[] +{ +new +{ +type = "code_interpreter", +} +}, +} + }, + metadata = new + { + key = "", + }, + }); + Response response = await client.CreateMessageAsync("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_at").ToString()); + Console.WriteLine(result.GetProperty("role").ToString()); + Console.WriteLine(result.GetProperty("content")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("run_id").ToString()); + Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("file_id").ToString()); + Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("data_source").GetProperty("uri").ToString()); + Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("data_source").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("tools")[0].ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CreateMessage_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.CreateMessage("", MessageRole.User, "", attachments: new MessageAttachment[] + { +new MessageAttachment(new BinaryData[] +{ +BinaryData.FromObjectAsJson(new +{ +type = "code_interpreter", +}) +}) +{ +FileId = "", +DataSource = new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset), +} + }, metadata: new Dictionary + { + ["key"] = "" + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CreateMessage_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.CreateMessageAsync("", MessageRole.User, "", attachments: new MessageAttachment[] + { +new MessageAttachment(new BinaryData[] +{ +BinaryData.FromObjectAsJson(new +{ +type = "code_interpreter", +}) +}) +{ +FileId = "", +DataSource = new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset), +} + }, metadata: new Dictionary + { + ["key"] = "" + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetMessage_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetMessage("", "", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_at").ToString()); + Console.WriteLine(result.GetProperty("role").ToString()); + Console.WriteLine(result.GetProperty("content")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("run_id").ToString()); + Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("tools")[0].ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetMessage_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetMessageAsync("", "", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_at").ToString()); + Console.WriteLine(result.GetProperty("role").ToString()); + Console.WriteLine(result.GetProperty("content")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("run_id").ToString()); + Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("tools")[0].ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetMessage_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetMessage("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetMessage_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetMessageAsync("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetMessage_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetMessage("", "", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_at").ToString()); + Console.WriteLine(result.GetProperty("role").ToString()); + Console.WriteLine(result.GetProperty("content")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("run_id").ToString()); + Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("file_id").ToString()); + Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("data_source").GetProperty("uri").ToString()); + Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("data_source").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("tools")[0].ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetMessage_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetMessageAsync("", "", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_at").ToString()); + Console.WriteLine(result.GetProperty("role").ToString()); + Console.WriteLine(result.GetProperty("content")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("run_id").ToString()); + Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("file_id").ToString()); + Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("data_source").GetProperty("uri").ToString()); + Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("data_source").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("tools")[0].ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetMessage_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetMessage("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetMessage_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetMessageAsync("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_UpdateMessage_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = client.UpdateMessage("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_at").ToString()); + Console.WriteLine(result.GetProperty("role").ToString()); + Console.WriteLine(result.GetProperty("content")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("run_id").ToString()); + Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("tools")[0].ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_UpdateMessage_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = await client.UpdateMessageAsync("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_at").ToString()); + Console.WriteLine(result.GetProperty("role").ToString()); + Console.WriteLine(result.GetProperty("content")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("run_id").ToString()); + Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("tools")[0].ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_UpdateMessage_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.UpdateMessage("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_UpdateMessage_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.UpdateMessageAsync("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_UpdateMessage_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + metadata = new + { + key = "", + }, + }); + Response response = client.UpdateMessage("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_at").ToString()); + Console.WriteLine(result.GetProperty("role").ToString()); + Console.WriteLine(result.GetProperty("content")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("run_id").ToString()); + Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("file_id").ToString()); + Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("data_source").GetProperty("uri").ToString()); + Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("data_source").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("tools")[0].ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_UpdateMessage_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + metadata = new + { + key = "", + }, + }); + Response response = await client.UpdateMessageAsync("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_at").ToString()); + Console.WriteLine(result.GetProperty("role").ToString()); + Console.WriteLine(result.GetProperty("content")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("run_id").ToString()); + Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("file_id").ToString()); + Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("data_source").GetProperty("uri").ToString()); + Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("data_source").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("attachments")[0].GetProperty("tools")[0].ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_UpdateMessage_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.UpdateMessage("", "", metadata: new Dictionary + { + ["key"] = "" + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_UpdateMessage_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.UpdateMessageAsync("", "", metadata: new Dictionary + { + ["key"] = "" + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CreateRun_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + assistant_id = "", + }); + Response response = client.CreateRun("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("expires_at").ToString()); + Console.WriteLine(result.GetProperty("started_at").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("cancelled_at").ToString()); + Console.WriteLine(result.GetProperty("failed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_choice").ToString()); + Console.WriteLine(result.GetProperty("response_format").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CreateRun_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + assistant_id = "", + }); + Response response = await client.CreateRunAsync("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("expires_at").ToString()); + Console.WriteLine(result.GetProperty("started_at").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("cancelled_at").ToString()); + Console.WriteLine(result.GetProperty("failed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_choice").ToString()); + Console.WriteLine(result.GetProperty("response_format").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CreateRun_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.CreateRun("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CreateRun_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.CreateRunAsync("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CreateRun_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + assistant_id = "", + model = "", + instructions = "", + additional_instructions = "", + additional_messages = new object[] + { +new +{ +role = "user", +content = "", +attachments = new object[] +{ +new +{ +file_id = "", +data_source = new +{ +uri = "", +type = "uri_asset", +}, +tools = new object[] +{ +new +{ +type = "code_interpreter", +} +}, +} +}, +metadata = new +{ +key = "", +}, +} + }, + tools = new object[] + { +new +{ +type = "code_interpreter", +} + }, + stream = true, + temperature = 123.45F, + top_p = 123.45F, + max_prompt_tokens = 1234, + max_completion_tokens = 1234, + truncation_strategy = new + { + type = "auto", + last_messages = 1234, + }, + tool_choice = "", + response_format = "", + parallel_tool_calls = true, + metadata = new + { + key = "", + }, + }); + Response response = client.CreateRun("", content, include: new RunAdditionalFieldList[] { RunAdditionalFieldList.FileSearchContents }); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("required_action").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("expires_at").ToString()); + Console.WriteLine(result.GetProperty("started_at").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("cancelled_at").ToString()); + Console.WriteLine(result.GetProperty("failed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); + Console.WriteLine(result.GetProperty("temperature").ToString()); + Console.WriteLine(result.GetProperty("top_p").ToString()); + Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("last_messages").ToString()); + Console.WriteLine(result.GetProperty("tool_choice").ToString()); + Console.WriteLine(result.GetProperty("response_format").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); + Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CreateRun_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + assistant_id = "", + model = "", + instructions = "", + additional_instructions = "", + additional_messages = new object[] + { +new +{ +role = "user", +content = "", +attachments = new object[] +{ +new +{ +file_id = "", +data_source = new +{ +uri = "", +type = "uri_asset", +}, +tools = new object[] +{ +new +{ +type = "code_interpreter", +} +}, +} +}, +metadata = new +{ +key = "", +}, +} + }, + tools = new object[] + { +new +{ +type = "code_interpreter", +} + }, + stream = true, + temperature = 123.45F, + top_p = 123.45F, + max_prompt_tokens = 1234, + max_completion_tokens = 1234, + truncation_strategy = new + { + type = "auto", + last_messages = 1234, + }, + tool_choice = "", + response_format = "", + parallel_tool_calls = true, + metadata = new + { + key = "", + }, + }); + Response response = await client.CreateRunAsync("", content, include: new RunAdditionalFieldList[] { RunAdditionalFieldList.FileSearchContents }); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("required_action").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("expires_at").ToString()); + Console.WriteLine(result.GetProperty("started_at").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("cancelled_at").ToString()); + Console.WriteLine(result.GetProperty("failed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); + Console.WriteLine(result.GetProperty("temperature").ToString()); + Console.WriteLine(result.GetProperty("top_p").ToString()); + Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("last_messages").ToString()); + Console.WriteLine(result.GetProperty("tool_choice").ToString()); + Console.WriteLine(result.GetProperty("response_format").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); + Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CreateRun_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + TruncationObject truncationStrategy = new TruncationObject(TruncationStrategy.Auto) + { + LastMessages = 1234, + }; + Response response = client.CreateRun("", "", overrideModelName: "", overrideInstructions: "", additionalInstructions: "", additionalMessages: new ThreadMessageOptions[] + { +new ThreadMessageOptions(MessageRole.User, "") +{ +Attachments = {new MessageAttachment(new BinaryData[] +{ +BinaryData.FromObjectAsJson(new +{ +type = "code_interpreter", +}) +}) +{ +FileId = "", +DataSource = new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset), +}}, +Metadata = +{ +["key"] = "" +}, +} + }, overrideTools: new ToolDefinition[] + { +new CodeInterpreterToolDefinition() + }, stream: true, temperature: 123.45F, topP: 123.45F, maxPromptTokens: 1234, maxCompletionTokens: 1234, truncationStrategy: truncationStrategy, toolChoice: BinaryData.FromObjectAsJson(""), responseFormat: BinaryData.FromObjectAsJson(""), parallelToolCalls: true, metadata: new Dictionary + { + ["key"] = "" + }, include: new RunAdditionalFieldList[] { RunAdditionalFieldList.FileSearchContents }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CreateRun_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + TruncationObject truncationStrategy = new TruncationObject(TruncationStrategy.Auto) + { + LastMessages = 1234, + }; + Response response = await client.CreateRunAsync("", "", overrideModelName: "", overrideInstructions: "", additionalInstructions: "", additionalMessages: new ThreadMessageOptions[] + { +new ThreadMessageOptions(MessageRole.User, "") +{ +Attachments = {new MessageAttachment(new BinaryData[] +{ +BinaryData.FromObjectAsJson(new +{ +type = "code_interpreter", +}) +}) +{ +FileId = "", +DataSource = new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset), +}}, +Metadata = +{ +["key"] = "" +}, +} + }, overrideTools: new ToolDefinition[] + { +new CodeInterpreterToolDefinition() + }, stream: true, temperature: 123.45F, topP: 123.45F, maxPromptTokens: 1234, maxCompletionTokens: 1234, truncationStrategy: truncationStrategy, toolChoice: BinaryData.FromObjectAsJson(""), responseFormat: BinaryData.FromObjectAsJson(""), parallelToolCalls: true, metadata: new Dictionary + { + ["key"] = "" + }, include: new RunAdditionalFieldList[] { RunAdditionalFieldList.FileSearchContents }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetRun_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetRun("", "", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("expires_at").ToString()); + Console.WriteLine(result.GetProperty("started_at").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("cancelled_at").ToString()); + Console.WriteLine(result.GetProperty("failed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_choice").ToString()); + Console.WriteLine(result.GetProperty("response_format").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetRun_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetRunAsync("", "", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("expires_at").ToString()); + Console.WriteLine(result.GetProperty("started_at").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("cancelled_at").ToString()); + Console.WriteLine(result.GetProperty("failed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_choice").ToString()); + Console.WriteLine(result.GetProperty("response_format").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetRun_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetRun("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetRun_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetRunAsync("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetRun_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetRun("", "", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("required_action").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("expires_at").ToString()); + Console.WriteLine(result.GetProperty("started_at").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("cancelled_at").ToString()); + Console.WriteLine(result.GetProperty("failed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); + Console.WriteLine(result.GetProperty("temperature").ToString()); + Console.WriteLine(result.GetProperty("top_p").ToString()); + Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("last_messages").ToString()); + Console.WriteLine(result.GetProperty("tool_choice").ToString()); + Console.WriteLine(result.GetProperty("response_format").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); + Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetRun_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetRunAsync("", "", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("required_action").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("expires_at").ToString()); + Console.WriteLine(result.GetProperty("started_at").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("cancelled_at").ToString()); + Console.WriteLine(result.GetProperty("failed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); + Console.WriteLine(result.GetProperty("temperature").ToString()); + Console.WriteLine(result.GetProperty("top_p").ToString()); + Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("last_messages").ToString()); + Console.WriteLine(result.GetProperty("tool_choice").ToString()); + Console.WriteLine(result.GetProperty("response_format").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); + Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetRun_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetRun("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetRun_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetRunAsync("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_UpdateRun_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = client.UpdateRun("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("expires_at").ToString()); + Console.WriteLine(result.GetProperty("started_at").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("cancelled_at").ToString()); + Console.WriteLine(result.GetProperty("failed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_choice").ToString()); + Console.WriteLine(result.GetProperty("response_format").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_UpdateRun_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = await client.UpdateRunAsync("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("expires_at").ToString()); + Console.WriteLine(result.GetProperty("started_at").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("cancelled_at").ToString()); + Console.WriteLine(result.GetProperty("failed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_choice").ToString()); + Console.WriteLine(result.GetProperty("response_format").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_UpdateRun_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.UpdateRun("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_UpdateRun_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.UpdateRunAsync("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_UpdateRun_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + metadata = new + { + key = "", + }, + }); + Response response = client.UpdateRun("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("required_action").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("expires_at").ToString()); + Console.WriteLine(result.GetProperty("started_at").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("cancelled_at").ToString()); + Console.WriteLine(result.GetProperty("failed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); + Console.WriteLine(result.GetProperty("temperature").ToString()); + Console.WriteLine(result.GetProperty("top_p").ToString()); + Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("last_messages").ToString()); + Console.WriteLine(result.GetProperty("tool_choice").ToString()); + Console.WriteLine(result.GetProperty("response_format").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); + Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_UpdateRun_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + metadata = new + { + key = "", + }, + }); + Response response = await client.UpdateRunAsync("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("required_action").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("expires_at").ToString()); + Console.WriteLine(result.GetProperty("started_at").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("cancelled_at").ToString()); + Console.WriteLine(result.GetProperty("failed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); + Console.WriteLine(result.GetProperty("temperature").ToString()); + Console.WriteLine(result.GetProperty("top_p").ToString()); + Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("last_messages").ToString()); + Console.WriteLine(result.GetProperty("tool_choice").ToString()); + Console.WriteLine(result.GetProperty("response_format").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); + Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_UpdateRun_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.UpdateRun("", "", metadata: new Dictionary + { + ["key"] = "" + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_UpdateRun_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.UpdateRunAsync("", "", metadata: new Dictionary + { + ["key"] = "" + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_SubmitToolOutputsToRun_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + tool_outputs = new object[] + { +new object() + }, + }); + Response response = client.SubmitToolOutputsToRun("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("expires_at").ToString()); + Console.WriteLine(result.GetProperty("started_at").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("cancelled_at").ToString()); + Console.WriteLine(result.GetProperty("failed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_choice").ToString()); + Console.WriteLine(result.GetProperty("response_format").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_SubmitToolOutputsToRun_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + tool_outputs = new object[] + { +new object() + }, + }); + Response response = await client.SubmitToolOutputsToRunAsync("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("expires_at").ToString()); + Console.WriteLine(result.GetProperty("started_at").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("cancelled_at").ToString()); + Console.WriteLine(result.GetProperty("failed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_choice").ToString()); + Console.WriteLine(result.GetProperty("response_format").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_SubmitToolOutputsToRun_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.SubmitToolOutputsToRun("", "", new ToolOutput[] + { +new ToolOutput() + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_SubmitToolOutputsToRun_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.SubmitToolOutputsToRunAsync("", "", new ToolOutput[] + { +new ToolOutput() + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_SubmitToolOutputsToRun_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + tool_outputs = new object[] + { +new +{ +tool_call_id = "", +output = "", +} + }, + stream = true, + }); + Response response = client.SubmitToolOutputsToRun("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("required_action").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("expires_at").ToString()); + Console.WriteLine(result.GetProperty("started_at").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("cancelled_at").ToString()); + Console.WriteLine(result.GetProperty("failed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); + Console.WriteLine(result.GetProperty("temperature").ToString()); + Console.WriteLine(result.GetProperty("top_p").ToString()); + Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("last_messages").ToString()); + Console.WriteLine(result.GetProperty("tool_choice").ToString()); + Console.WriteLine(result.GetProperty("response_format").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); + Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_SubmitToolOutputsToRun_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + tool_outputs = new object[] + { +new +{ +tool_call_id = "", +output = "", +} + }, + stream = true, + }); + Response response = await client.SubmitToolOutputsToRunAsync("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("required_action").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("expires_at").ToString()); + Console.WriteLine(result.GetProperty("started_at").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("cancelled_at").ToString()); + Console.WriteLine(result.GetProperty("failed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); + Console.WriteLine(result.GetProperty("temperature").ToString()); + Console.WriteLine(result.GetProperty("top_p").ToString()); + Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("last_messages").ToString()); + Console.WriteLine(result.GetProperty("tool_choice").ToString()); + Console.WriteLine(result.GetProperty("response_format").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); + Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_SubmitToolOutputsToRun_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.SubmitToolOutputsToRun("", "", new ToolOutput[] + { +new ToolOutput +{ +ToolCallId = "", +Output = "", +} + }, stream: true); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_SubmitToolOutputsToRun_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.SubmitToolOutputsToRunAsync("", "", new ToolOutput[] + { +new ToolOutput +{ +ToolCallId = "", +Output = "", +} + }, stream: true); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CancelRun_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.CancelRun("", "", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("expires_at").ToString()); + Console.WriteLine(result.GetProperty("started_at").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("cancelled_at").ToString()); + Console.WriteLine(result.GetProperty("failed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_choice").ToString()); + Console.WriteLine(result.GetProperty("response_format").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CancelRun_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.CancelRunAsync("", "", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("expires_at").ToString()); + Console.WriteLine(result.GetProperty("started_at").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("cancelled_at").ToString()); + Console.WriteLine(result.GetProperty("failed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_choice").ToString()); + Console.WriteLine(result.GetProperty("response_format").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CancelRun_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.CancelRun("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CancelRun_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.CancelRunAsync("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CancelRun_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.CancelRun("", "", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("required_action").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("expires_at").ToString()); + Console.WriteLine(result.GetProperty("started_at").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("cancelled_at").ToString()); + Console.WriteLine(result.GetProperty("failed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); + Console.WriteLine(result.GetProperty("temperature").ToString()); + Console.WriteLine(result.GetProperty("top_p").ToString()); + Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("last_messages").ToString()); + Console.WriteLine(result.GetProperty("tool_choice").ToString()); + Console.WriteLine(result.GetProperty("response_format").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); + Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CancelRun_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.CancelRunAsync("", "", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("required_action").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("expires_at").ToString()); + Console.WriteLine(result.GetProperty("started_at").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("cancelled_at").ToString()); + Console.WriteLine(result.GetProperty("failed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); + Console.WriteLine(result.GetProperty("temperature").ToString()); + Console.WriteLine(result.GetProperty("top_p").ToString()); + Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("last_messages").ToString()); + Console.WriteLine(result.GetProperty("tool_choice").ToString()); + Console.WriteLine(result.GetProperty("response_format").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); + Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CancelRun_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.CancelRun("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CancelRun_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.CancelRunAsync("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CreateThreadAndRun_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + assistant_id = "", + }); + Response response = client.CreateThreadAndRun(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("expires_at").ToString()); + Console.WriteLine(result.GetProperty("started_at").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("cancelled_at").ToString()); + Console.WriteLine(result.GetProperty("failed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_choice").ToString()); + Console.WriteLine(result.GetProperty("response_format").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CreateThreadAndRun_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + assistant_id = "", + }); + Response response = await client.CreateThreadAndRunAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("expires_at").ToString()); + Console.WriteLine(result.GetProperty("started_at").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("cancelled_at").ToString()); + Console.WriteLine(result.GetProperty("failed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("tool_choice").ToString()); + Console.WriteLine(result.GetProperty("response_format").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CreateThreadAndRun_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.CreateThreadAndRun(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CreateThreadAndRun_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.CreateThreadAndRunAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CreateThreadAndRun_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + assistant_id = "", + thread = new + { + messages = new object[] + { +new +{ +role = "user", +content = "", +attachments = new object[] +{ +new +{ +file_id = "", +data_source = new +{ +uri = "", +type = "uri_asset", +}, +tools = new object[] +{ +new +{ +type = "code_interpreter", +} +}, +} +}, +metadata = new +{ +key = "", +}, +} + }, + tool_resources = new + { + code_interpreter = new + { + file_ids = new object[] + { +"" + }, + data_sources = new object[] + { +null + }, + }, + file_search = new + { + vector_store_ids = new object[] + { +"" + }, + vector_stores = new object[] + { +new +{ +name = "", +configuration = new +{ +data_sources = new object[] +{ +null +}, +}, +} + }, + }, + azure_ai_search = new + { + indexes = new object[] + { +new +{ +index_connection_id = "", +index_name = "", +query_type = "simple", +top_k = 1234, +filter = "", +} + }, + }, + }, + metadata = new + { + key = "", + }, + }, + model = "", + instructions = "", + tools = new object[] + { +new +{ +type = "code_interpreter", +} + }, + tool_resources = new + { + code_interpreter = new + { + file_ids = new object[] + { +"" + }, + }, + file_search = new + { + vector_store_ids = new object[] + { +"" + }, + }, + }, + stream = true, + temperature = 123.45F, + top_p = 123.45F, + max_prompt_tokens = 1234, + max_completion_tokens = 1234, + truncation_strategy = new + { + type = "auto", + last_messages = 1234, + }, + tool_choice = "", + response_format = "", + parallel_tool_calls = true, + metadata = new + { + key = "", + }, + }); + Response response = client.CreateThreadAndRun(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("required_action").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("expires_at").ToString()); + Console.WriteLine(result.GetProperty("started_at").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("cancelled_at").ToString()); + Console.WriteLine(result.GetProperty("failed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); + Console.WriteLine(result.GetProperty("temperature").ToString()); + Console.WriteLine(result.GetProperty("top_p").ToString()); + Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("last_messages").ToString()); + Console.WriteLine(result.GetProperty("tool_choice").ToString()); + Console.WriteLine(result.GetProperty("response_format").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); + Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CreateThreadAndRun_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + assistant_id = "", + thread = new + { + messages = new object[] + { +new +{ +role = "user", +content = "", +attachments = new object[] +{ +new +{ +file_id = "", +data_source = new +{ +uri = "", +type = "uri_asset", +}, +tools = new object[] +{ +new +{ +type = "code_interpreter", +} +}, +} +}, +metadata = new +{ +key = "", +}, +} + }, + tool_resources = new + { + code_interpreter = new + { + file_ids = new object[] + { +"" + }, + data_sources = new object[] + { +null + }, + }, + file_search = new + { + vector_store_ids = new object[] + { +"" + }, + vector_stores = new object[] + { +new +{ +name = "", +configuration = new +{ +data_sources = new object[] +{ +null +}, +}, +} + }, + }, + azure_ai_search = new + { + indexes = new object[] + { +new +{ +index_connection_id = "", +index_name = "", +query_type = "simple", +top_k = 1234, +filter = "", +} + }, + }, + }, + metadata = new + { + key = "", + }, + }, + model = "", + instructions = "", + tools = new object[] + { +new +{ +type = "code_interpreter", +} + }, + tool_resources = new + { + code_interpreter = new + { + file_ids = new object[] + { +"" + }, + }, + file_search = new + { + vector_store_ids = new object[] + { +"" + }, + }, + }, + stream = true, + temperature = 123.45F, + top_p = 123.45F, + max_prompt_tokens = 1234, + max_completion_tokens = 1234, + truncation_strategy = new + { + type = "auto", + last_messages = 1234, + }, + tool_choice = "", + response_format = "", + parallel_tool_calls = true, + metadata = new + { + key = "", + }, + }); + Response response = await client.CreateThreadAndRunAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("required_action").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("model").ToString()); + Console.WriteLine(result.GetProperty("instructions").ToString()); + Console.WriteLine(result.GetProperty("tools")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("expires_at").ToString()); + Console.WriteLine(result.GetProperty("started_at").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("cancelled_at").ToString()); + Console.WriteLine(result.GetProperty("failed_at").ToString()); + Console.WriteLine(result.GetProperty("incomplete_details").GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); + Console.WriteLine(result.GetProperty("temperature").ToString()); + Console.WriteLine(result.GetProperty("top_p").ToString()); + Console.WriteLine(result.GetProperty("max_prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("max_completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("truncation_strategy").GetProperty("last_messages").ToString()); + Console.WriteLine(result.GetProperty("tool_choice").ToString()); + Console.WriteLine(result.GetProperty("response_format").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("code_interpreter").GetProperty("file_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("file_search").GetProperty("vector_store_ids")[0].ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_connection_id").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("index_name").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("query_type").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("top_k").ToString()); + Console.WriteLine(result.GetProperty("tool_resources").GetProperty("azure_ai_search").GetProperty("indexes")[0].GetProperty("filter").ToString()); + Console.WriteLine(result.GetProperty("parallel_tool_calls").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CreateThreadAndRun_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + AgentThreadCreationOptions thread = new AgentThreadCreationOptions + { + Messages = {new ThreadMessageOptions(MessageRole.User, "") +{ +Attachments = {new MessageAttachment(new BinaryData[] +{ +BinaryData.FromObjectAsJson(new +{ +type = "code_interpreter", +}) +}) +{ +FileId = "", +DataSource = new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset), +}}, +Metadata = +{ +["key"] = "" +}, +}}, + ToolResources = new ToolResources + { + CodeInterpreter = new CodeInterpreterToolResource + { + FileIds = { "" }, + DataSources = { default }, + }, + FileSearch = new FileSearchToolResource + { + VectorStoreIds = { "" }, + VectorStores = {new VectorStoreConfigurations("", new VectorStoreConfiguration(new VectorStoreDataSource[] +{ +default +}))}, + }, + AzureAISearch = new AzureAISearchResource + { + IndexList = {new AISearchIndexResource("", "") +{ +QueryType = AzureAISearchQueryType.Simple, +TopK = 1234, +Filter = "", +}}, + }, + }, + Metadata = +{ +["key"] = "" +}, + }; + UpdateToolResourcesOptions toolResources = new UpdateToolResourcesOptions + { + CodeInterpreter = new UpdateCodeInterpreterToolResourceOptions + { + FileIds = { "" }, + }, + FileSearch = new UpdateFileSearchToolResourceOptions + { + VectorStoreIds = { "" }, + }, + AzureAISearch = default, + }; + TruncationObject truncationStrategy = new TruncationObject(TruncationStrategy.Auto) + { + LastMessages = 1234, + }; + Response response = client.CreateThreadAndRun("", thread: thread, overrideModelName: "", overrideInstructions: "", overrideTools: new ToolDefinition[] + { +new CodeInterpreterToolDefinition() + }, toolResources: toolResources, stream: true, temperature: 123.45F, topP: 123.45F, maxPromptTokens: 1234, maxCompletionTokens: 1234, truncationStrategy: truncationStrategy, toolChoice: BinaryData.FromObjectAsJson(""), responseFormat: BinaryData.FromObjectAsJson(""), parallelToolCalls: true, metadata: new Dictionary + { + ["key"] = "" + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CreateThreadAndRun_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + AgentThreadCreationOptions thread = new AgentThreadCreationOptions + { + Messages = {new ThreadMessageOptions(MessageRole.User, "") +{ +Attachments = {new MessageAttachment(new BinaryData[] +{ +BinaryData.FromObjectAsJson(new +{ +type = "code_interpreter", +}) +}) +{ +FileId = "", +DataSource = new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset), +}}, +Metadata = +{ +["key"] = "" +}, +}}, + ToolResources = new ToolResources + { + CodeInterpreter = new CodeInterpreterToolResource + { + FileIds = { "" }, + DataSources = { default }, + }, + FileSearch = new FileSearchToolResource + { + VectorStoreIds = { "" }, + VectorStores = {new VectorStoreConfigurations("", new VectorStoreConfiguration(new VectorStoreDataSource[] +{ +default +}))}, + }, + AzureAISearch = new AzureAISearchResource + { + IndexList = {new AISearchIndexResource("", "") +{ +QueryType = AzureAISearchQueryType.Simple, +TopK = 1234, +Filter = "", +}}, + }, + }, + Metadata = +{ +["key"] = "" +}, + }; + UpdateToolResourcesOptions toolResources = new UpdateToolResourcesOptions + { + CodeInterpreter = new UpdateCodeInterpreterToolResourceOptions + { + FileIds = { "" }, + }, + FileSearch = new UpdateFileSearchToolResourceOptions + { + VectorStoreIds = { "" }, + }, + AzureAISearch = default, + }; + TruncationObject truncationStrategy = new TruncationObject(TruncationStrategy.Auto) + { + LastMessages = 1234, + }; + Response response = await client.CreateThreadAndRunAsync("", thread: thread, overrideModelName: "", overrideInstructions: "", overrideTools: new ToolDefinition[] + { +new CodeInterpreterToolDefinition() + }, toolResources: toolResources, stream: true, temperature: 123.45F, topP: 123.45F, maxPromptTokens: 1234, maxCompletionTokens: 1234, truncationStrategy: truncationStrategy, toolChoice: BinaryData.FromObjectAsJson(""), responseFormat: BinaryData.FromObjectAsJson(""), parallelToolCalls: true, metadata: new Dictionary + { + ["key"] = "" + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetRunStep_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetRunStep("", "", "", null, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("run_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("step_details").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("expired_at").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("cancelled_at").ToString()); + Console.WriteLine(result.GetProperty("failed_at").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetRunStep_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetRunStepAsync("", "", "", null, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("run_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("step_details").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("expired_at").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("cancelled_at").ToString()); + Console.WriteLine(result.GetProperty("failed_at").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetRunStep_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetRunStep("", "", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetRunStep_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetRunStepAsync("", "", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetRunStep_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetRunStep("", "", "", new RunAdditionalFieldList[] { RunAdditionalFieldList.FileSearchContents }, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("run_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("step_details").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("expired_at").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("cancelled_at").ToString()); + Console.WriteLine(result.GetProperty("failed_at").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetRunStep_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetRunStepAsync("", "", "", new RunAdditionalFieldList[] { RunAdditionalFieldList.FileSearchContents }, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("assistant_id").ToString()); + Console.WriteLine(result.GetProperty("thread_id").ToString()); + Console.WriteLine(result.GetProperty("run_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("step_details").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("expired_at").ToString()); + Console.WriteLine(result.GetProperty("completed_at").ToString()); + Console.WriteLine(result.GetProperty("cancelled_at").ToString()); + Console.WriteLine(result.GetProperty("failed_at").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("completion_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("prompt_tokens").ToString()); + Console.WriteLine(result.GetProperty("usage").GetProperty("total_tokens").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetRunStep_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetRunStep("", "", "", include: new RunAdditionalFieldList[] { RunAdditionalFieldList.FileSearchContents }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetRunStep_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetRunStepAsync("", "", "", include: new RunAdditionalFieldList[] { RunAdditionalFieldList.FileSearchContents }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_UploadFile_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + file = new + { + contents = new object(), + }, + purpose = "fine-tune", + }); + Response response = client.UploadFile(content, "multipart/form-data"); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("bytes").ToString()); + Console.WriteLine(result.GetProperty("filename").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("purpose").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_UploadFile_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + file = new + { + contents = new object(), + }, + purpose = "fine-tune", + }); + Response response = await client.UploadFileAsync(content, "multipart/form-data"); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("bytes").ToString()); + Console.WriteLine(result.GetProperty("filename").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("purpose").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_UploadFile_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + UploadFileRequest body = new UploadFileRequest(new File(BinaryData.FromObjectAsJson(new object())), OpenAIFilePurpose.FineTune); + Response response = client.UploadFile(body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_UploadFile_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + UploadFileRequest body = new UploadFileRequest(new File(BinaryData.FromObjectAsJson(new object())), OpenAIFilePurpose.FineTune); + Response response = await client.UploadFileAsync(body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_UploadFile_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + file = new + { + contentType = "", + filename = "", + contents = new object(), + }, + purpose = "fine-tune", + filename = "", + }); + Response response = client.UploadFile(content, "multipart/form-data"); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("bytes").ToString()); + Console.WriteLine(result.GetProperty("filename").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("purpose").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("status_details").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_UploadFile_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + file = new + { + contentType = "", + filename = "", + contents = new object(), + }, + purpose = "fine-tune", + filename = "", + }); + Response response = await client.UploadFileAsync(content, "multipart/form-data"); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("bytes").ToString()); + Console.WriteLine(result.GetProperty("filename").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("purpose").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("status_details").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_UploadFile_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + UploadFileRequest body = new UploadFileRequest(new File(BinaryData.FromObjectAsJson(new object())) + { + ContentType = "", + Filename = "", + }, OpenAIFilePurpose.FineTune) + { + Filename = "", + }; + Response response = client.UploadFile(body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_UploadFile_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + UploadFileRequest body = new UploadFileRequest(new File(BinaryData.FromObjectAsJson(new object())) + { + ContentType = "", + Filename = "", + }, OpenAIFilePurpose.FineTune) + { + Filename = "", + }; + Response response = await client.UploadFileAsync(body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetFile_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetFile("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("bytes").ToString()); + Console.WriteLine(result.GetProperty("filename").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("purpose").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetFile_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetFileAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("bytes").ToString()); + Console.WriteLine(result.GetProperty("filename").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("purpose").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetFile_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetFile(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetFile_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetFileAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetFile_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetFile("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("bytes").ToString()); + Console.WriteLine(result.GetProperty("filename").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("purpose").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("status_details").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetFile_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetFileAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("bytes").ToString()); + Console.WriteLine(result.GetProperty("filename").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("purpose").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("status_details").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetFile_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetFile(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetFile_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetFileAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetFileContent_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetFileContent("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetFileContent_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetFileContentAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetFileContent_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetFileContent(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetFileContent_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetFileContentAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetFileContent_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetFileContent("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetFileContent_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetFileContentAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetFileContent_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetFileContent(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetFileContent_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetFileContentAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetVectorStores_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetVectorStores(null, null, null, null, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("metadata").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("first_id").ToString()); + Console.WriteLine(result.GetProperty("last_id").ToString()); + Console.WriteLine(result.GetProperty("has_more").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetVectorStores_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetVectorStoresAsync(null, null, null, null, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("metadata").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("first_id").ToString()); + Console.WriteLine(result.GetProperty("last_id").ToString()); + Console.WriteLine(result.GetProperty("has_more").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetVectorStores_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetVectorStores(); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetVectorStores_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetVectorStoresAsync(); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetVectorStores_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetVectorStores(1234, "asc", "", "", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("expires_after").GetProperty("anchor").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("expires_after").GetProperty("days").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("expires_at").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("metadata").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("first_id").ToString()); + Console.WriteLine(result.GetProperty("last_id").ToString()); + Console.WriteLine(result.GetProperty("has_more").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetVectorStores_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetVectorStoresAsync(1234, "asc", "", "", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("expires_after").GetProperty("anchor").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("expires_after").GetProperty("days").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("expires_at").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("metadata").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("first_id").ToString()); + Console.WriteLine(result.GetProperty("last_id").ToString()); + Console.WriteLine(result.GetProperty("has_more").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetVectorStores_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetVectorStores(limit: 1234, order: ListSortOrder.Ascending, after: "", before: ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetVectorStores_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetVectorStoresAsync(limit: 1234, order: ListSortOrder.Ascending, after: "", before: ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CreateVectorStore_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = client.CreateVectorStore(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CreateVectorStore_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = await client.CreateVectorStoreAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CreateVectorStore_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.CreateVectorStore(); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CreateVectorStore_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.CreateVectorStoreAsync(); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CreateVectorStore_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + file_ids = new object[] + { +"" + }, + name = "", + configuration = new + { + data_sources = new object[] + { +new +{ +uri = "", +type = "uri_asset", +} + }, + }, + expires_after = new + { + anchor = "last_active_at", + days = 1234, + }, + chunking_strategy = new + { + type = "auto", + }, + metadata = new + { + key = "", + }, + }); + Response response = client.CreateVectorStore(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("expires_after").GetProperty("anchor").ToString()); + Console.WriteLine(result.GetProperty("expires_after").GetProperty("days").ToString()); + Console.WriteLine(result.GetProperty("expires_at").ToString()); + Console.WriteLine(result.GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CreateVectorStore_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + file_ids = new object[] + { +"" + }, + name = "", + configuration = new + { + data_sources = new object[] + { +new +{ +uri = "", +type = "uri_asset", +} + }, + }, + expires_after = new + { + anchor = "last_active_at", + days = 1234, + }, + chunking_strategy = new + { + type = "auto", + }, + metadata = new + { + key = "", + }, + }); + Response response = await client.CreateVectorStoreAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("expires_after").GetProperty("anchor").ToString()); + Console.WriteLine(result.GetProperty("expires_after").GetProperty("days").ToString()); + Console.WriteLine(result.GetProperty("expires_at").ToString()); + Console.WriteLine(result.GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CreateVectorStore_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + VectorStoreConfiguration storeConfiguration = new VectorStoreConfiguration(new VectorStoreDataSource[] + { +new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset) + }); + VectorStoreExpirationPolicy expiresAfter = new VectorStoreExpirationPolicy(VectorStoreExpirationPolicyAnchor.LastActiveAt, 1234); + VectorStoreChunkingStrategyRequest chunkingStrategy = new VectorStoreAutoChunkingStrategyRequest(); + Response response = client.CreateVectorStore(fileIds: new string[] { "" }, name: "", storeConfiguration: storeConfiguration, expiresAfter: expiresAfter, chunkingStrategy: chunkingStrategy, metadata: new Dictionary + { + ["key"] = "" + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CreateVectorStore_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + VectorStoreConfiguration storeConfiguration = new VectorStoreConfiguration(new VectorStoreDataSource[] + { +new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset) + }); + VectorStoreExpirationPolicy expiresAfter = new VectorStoreExpirationPolicy(VectorStoreExpirationPolicyAnchor.LastActiveAt, 1234); + VectorStoreChunkingStrategyRequest chunkingStrategy = new VectorStoreAutoChunkingStrategyRequest(); + Response response = await client.CreateVectorStoreAsync(fileIds: new string[] { "" }, name: "", storeConfiguration: storeConfiguration, expiresAfter: expiresAfter, chunkingStrategy: chunkingStrategy, metadata: new Dictionary + { + ["key"] = "" + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetVectorStore_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetVectorStore("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetVectorStore_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetVectorStoreAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetVectorStore_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetVectorStore(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetVectorStore_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetVectorStoreAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetVectorStore_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetVectorStore("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("expires_after").GetProperty("anchor").ToString()); + Console.WriteLine(result.GetProperty("expires_after").GetProperty("days").ToString()); + Console.WriteLine(result.GetProperty("expires_at").ToString()); + Console.WriteLine(result.GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetVectorStore_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetVectorStoreAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("expires_after").GetProperty("anchor").ToString()); + Console.WriteLine(result.GetProperty("expires_after").GetProperty("days").ToString()); + Console.WriteLine(result.GetProperty("expires_at").ToString()); + Console.WriteLine(result.GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetVectorStore_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetVectorStore(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetVectorStore_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetVectorStoreAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_ModifyVectorStore_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = client.ModifyVectorStore("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_ModifyVectorStore_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = await client.ModifyVectorStoreAsync("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_ModifyVectorStore_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.ModifyVectorStore(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_ModifyVectorStore_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.ModifyVectorStoreAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_ModifyVectorStore_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + name = "", + expires_after = new + { + anchor = "last_active_at", + days = 1234, + }, + metadata = new + { + key = "", + }, + }); + Response response = client.ModifyVectorStore("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("expires_after").GetProperty("anchor").ToString()); + Console.WriteLine(result.GetProperty("expires_after").GetProperty("days").ToString()); + Console.WriteLine(result.GetProperty("expires_at").ToString()); + Console.WriteLine(result.GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_ModifyVectorStore_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + name = "", + expires_after = new + { + anchor = "last_active_at", + days = 1234, + }, + metadata = new + { + key = "", + }, + }); + Response response = await client.ModifyVectorStoreAsync("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("expires_after").GetProperty("anchor").ToString()); + Console.WriteLine(result.GetProperty("expires_after").GetProperty("days").ToString()); + Console.WriteLine(result.GetProperty("expires_at").ToString()); + Console.WriteLine(result.GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_ModifyVectorStore_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + VectorStoreExpirationPolicy expiresAfter = new VectorStoreExpirationPolicy(VectorStoreExpirationPolicyAnchor.LastActiveAt, 1234); + Response response = client.ModifyVectorStore("", name: "", expiresAfter: expiresAfter, metadata: new Dictionary + { + ["key"] = "" + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_ModifyVectorStore_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + VectorStoreExpirationPolicy expiresAfter = new VectorStoreExpirationPolicy(VectorStoreExpirationPolicyAnchor.LastActiveAt, 1234); + Response response = await client.ModifyVectorStoreAsync("", name: "", expiresAfter: expiresAfter, metadata: new Dictionary + { + ["key"] = "" + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_DeleteVectorStore_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.DeleteVectorStore("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("deleted").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_DeleteVectorStore_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.DeleteVectorStoreAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("deleted").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_DeleteVectorStore_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.DeleteVectorStore(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_DeleteVectorStore_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.DeleteVectorStoreAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_DeleteVectorStore_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.DeleteVectorStore("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("deleted").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_DeleteVectorStore_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.DeleteVectorStoreAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("deleted").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_DeleteVectorStore_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.DeleteVectorStore(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_DeleteVectorStore_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.DeleteVectorStoreAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetVectorStoreFiles_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetVectorStoreFiles("", null, null, null, null, null, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("chunking_strategy").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("first_id").ToString()); + Console.WriteLine(result.GetProperty("last_id").ToString()); + Console.WriteLine(result.GetProperty("has_more").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetVectorStoreFiles_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetVectorStoreFilesAsync("", null, null, null, null, null, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("chunking_strategy").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("first_id").ToString()); + Console.WriteLine(result.GetProperty("last_id").ToString()); + Console.WriteLine(result.GetProperty("has_more").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetVectorStoreFiles_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetVectorStoreFiles(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetVectorStoreFiles_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetVectorStoreFilesAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetVectorStoreFiles_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetVectorStoreFiles("", "in_progress", 1234, "asc", "", "", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("chunking_strategy").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("first_id").ToString()); + Console.WriteLine(result.GetProperty("last_id").ToString()); + Console.WriteLine(result.GetProperty("has_more").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetVectorStoreFiles_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetVectorStoreFilesAsync("", "in_progress", 1234, "asc", "", "", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("chunking_strategy").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("first_id").ToString()); + Console.WriteLine(result.GetProperty("last_id").ToString()); + Console.WriteLine(result.GetProperty("has_more").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetVectorStoreFiles_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetVectorStoreFiles("", filter: VectorStoreFileStatusFilter.InProgress, limit: 1234, order: ListSortOrder.Ascending, after: "", before: ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetVectorStoreFiles_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetVectorStoreFilesAsync("", filter: VectorStoreFileStatusFilter.InProgress, limit: 1234, order: ListSortOrder.Ascending, after: "", before: ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CreateVectorStoreFile_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = client.CreateVectorStoreFile("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CreateVectorStoreFile_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = await client.CreateVectorStoreFileAsync("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CreateVectorStoreFile_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.CreateVectorStoreFile(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CreateVectorStoreFile_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.CreateVectorStoreFileAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CreateVectorStoreFile_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + file_id = "", + data_source = new + { + uri = "", + type = "uri_asset", + }, + chunking_strategy = new + { + type = "auto", + }, + }); + Response response = client.CreateVectorStoreFile("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CreateVectorStoreFile_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + file_id = "", + data_source = new + { + uri = "", + type = "uri_asset", + }, + chunking_strategy = new + { + type = "auto", + }, + }); + Response response = await client.CreateVectorStoreFileAsync("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CreateVectorStoreFile_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + VectorStoreDataSource dataSource = new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset); + VectorStoreChunkingStrategyRequest chunkingStrategy = new VectorStoreAutoChunkingStrategyRequest(); + Response response = client.CreateVectorStoreFile("", fileId: "", dataSource: dataSource, chunkingStrategy: chunkingStrategy); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CreateVectorStoreFile_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + VectorStoreDataSource dataSource = new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset); + VectorStoreChunkingStrategyRequest chunkingStrategy = new VectorStoreAutoChunkingStrategyRequest(); + Response response = await client.CreateVectorStoreFileAsync("", fileId: "", dataSource: dataSource, chunkingStrategy: chunkingStrategy); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetVectorStoreFile_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetVectorStoreFile("", "", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetVectorStoreFile_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetVectorStoreFileAsync("", "", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetVectorStoreFile_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetVectorStoreFile("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetVectorStoreFile_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetVectorStoreFileAsync("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetVectorStoreFile_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetVectorStoreFile("", "", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetVectorStoreFile_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetVectorStoreFileAsync("", "", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetVectorStoreFile_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetVectorStoreFile("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetVectorStoreFile_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetVectorStoreFileAsync("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_DeleteVectorStoreFile_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.DeleteVectorStoreFile("", "", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("deleted").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_DeleteVectorStoreFile_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.DeleteVectorStoreFileAsync("", "", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("deleted").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_DeleteVectorStoreFile_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.DeleteVectorStoreFile("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_DeleteVectorStoreFile_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.DeleteVectorStoreFileAsync("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_DeleteVectorStoreFile_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.DeleteVectorStoreFile("", "", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("deleted").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_DeleteVectorStoreFile_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.DeleteVectorStoreFileAsync("", "", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("deleted").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_DeleteVectorStoreFile_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.DeleteVectorStoreFile("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_DeleteVectorStoreFile_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.DeleteVectorStoreFileAsync("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CreateVectorStoreFileBatch_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = client.CreateVectorStoreFileBatch("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CreateVectorStoreFileBatch_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = await client.CreateVectorStoreFileBatchAsync("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CreateVectorStoreFileBatch_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.CreateVectorStoreFileBatch(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CreateVectorStoreFileBatch_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.CreateVectorStoreFileBatchAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CreateVectorStoreFileBatch_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + file_ids = new object[] + { +"" + }, + data_sources = new object[] + { +new +{ +uri = "", +type = "uri_asset", +} + }, + chunking_strategy = new + { + type = "auto", + }, + }); + Response response = client.CreateVectorStoreFileBatch("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CreateVectorStoreFileBatch_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + file_ids = new object[] + { +"" + }, + data_sources = new object[] + { +new +{ +uri = "", +type = "uri_asset", +} + }, + chunking_strategy = new + { + type = "auto", + }, + }); + Response response = await client.CreateVectorStoreFileBatchAsync("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CreateVectorStoreFileBatch_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + VectorStoreChunkingStrategyRequest chunkingStrategy = new VectorStoreAutoChunkingStrategyRequest(); + Response response = client.CreateVectorStoreFileBatch("", fileIds: new string[] { "" }, dataSources: new VectorStoreDataSource[] + { +new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset) + }, chunkingStrategy: chunkingStrategy); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CreateVectorStoreFileBatch_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + VectorStoreChunkingStrategyRequest chunkingStrategy = new VectorStoreAutoChunkingStrategyRequest(); + Response response = await client.CreateVectorStoreFileBatchAsync("", fileIds: new string[] { "" }, dataSources: new VectorStoreDataSource[] + { +new VectorStoreDataSource("", VectorStoreDataSourceAssetType.UriAsset) + }, chunkingStrategy: chunkingStrategy); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetVectorStoreFileBatch_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetVectorStoreFileBatch("", "", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetVectorStoreFileBatch_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetVectorStoreFileBatchAsync("", "", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetVectorStoreFileBatch_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetVectorStoreFileBatch("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetVectorStoreFileBatch_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetVectorStoreFileBatchAsync("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetVectorStoreFileBatch_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetVectorStoreFileBatch("", "", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetVectorStoreFileBatch_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetVectorStoreFileBatchAsync("", "", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetVectorStoreFileBatch_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetVectorStoreFileBatch("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetVectorStoreFileBatch_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetVectorStoreFileBatchAsync("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CancelVectorStoreFileBatch_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.CancelVectorStoreFileBatch("", "", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CancelVectorStoreFileBatch_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.CancelVectorStoreFileBatchAsync("", "", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CancelVectorStoreFileBatch_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.CancelVectorStoreFileBatch("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CancelVectorStoreFileBatch_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.CancelVectorStoreFileBatchAsync("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CancelVectorStoreFileBatch_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.CancelVectorStoreFileBatch("", "", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CancelVectorStoreFileBatch_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.CancelVectorStoreFileBatchAsync("", "", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_CancelVectorStoreFileBatch_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.CancelVectorStoreFileBatch("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_CancelVectorStoreFileBatch_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.CancelVectorStoreFileBatchAsync("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetVectorStoreFileBatchFiles_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetVectorStoreFileBatchFiles("", "", null, null, null, null, null, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("chunking_strategy").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("first_id").ToString()); + Console.WriteLine(result.GetProperty("last_id").ToString()); + Console.WriteLine(result.GetProperty("has_more").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetVectorStoreFileBatchFiles_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetVectorStoreFileBatchFilesAsync("", "", null, null, null, null, null, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("chunking_strategy").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("first_id").ToString()); + Console.WriteLine(result.GetProperty("last_id").ToString()); + Console.WriteLine(result.GetProperty("has_more").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetVectorStoreFileBatchFiles_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetVectorStoreFileBatchFiles("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetVectorStoreFileBatchFiles_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetVectorStoreFileBatchFilesAsync("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetVectorStoreFileBatchFiles_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetVectorStoreFileBatchFiles("", "", "in_progress", 1234, "asc", "", "", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("chunking_strategy").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("first_id").ToString()); + Console.WriteLine(result.GetProperty("last_id").ToString()); + Console.WriteLine(result.GetProperty("has_more").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetVectorStoreFileBatchFiles_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetVectorStoreFileBatchFilesAsync("", "", "in_progress", 1234, "asc", "", "", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("data")[0].GetProperty("chunking_strategy").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("first_id").ToString()); + Console.WriteLine(result.GetProperty("last_id").ToString()); + Console.WriteLine(result.GetProperty("has_more").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Assistants_GetVectorStoreFileBatchFiles_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = client.GetVectorStoreFileBatchFiles("", "", filter: VectorStoreFileStatusFilter.InProgress, limit: 1234, order: ListSortOrder.Ascending, after: "", before: ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Assistants_GetVectorStoreFileBatchFiles_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AIAssistantClient client = new AIAssistantClient(endpoint, credential); + + Response response = await client.GetVectorStoreFileBatchFilesAsync("", "", filter: VectorStoreFileStatusFilter.InProgress, limit: 1234, order: ListSortOrder.Ascending, after: "", before: ""); + } + } +} diff --git a/sdk/ai/Azure.AI.Assistants/tsp-location.yaml b/sdk/ai/Azure.AI.Assistants/tsp-location.yaml new file mode 100644 index 000000000000..2db3adfb0473 --- /dev/null +++ b/sdk/ai/Azure.AI.Assistants/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/ai/Azure.AI.Assistants +commit: 54b1384a56710dd114569774b5f90a6b5778bd31 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/ai/Azure.AI.Projects.1DP/Azure.AI.Projects.1DP.sln b/sdk/ai/Azure.AI.Projects.1DP/Azure.AI.Projects.1DP.sln new file mode 100644 index 000000000000..a9b527f621ec --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/Azure.AI.Projects.1DP.sln @@ -0,0 +1,56 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29709.97 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.TestFramework", "..\..\core\Azure.Core.TestFramework\src\Azure.Core.TestFramework.csproj", "{ECC730C1-4AEA-420C-916A-66B19B79E4DC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.AI.Projects.1DP", "src\Azure.AI.Projects.1DP.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.AI.Projects.1DP.Tests", "tests\Azure.AI.Projects.1DP.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Release|Any CPU.Build.0 = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE} + EndGlobalSection +EndGlobal diff --git a/sdk/ai/Azure.AI.Projects.1DP/CHANGELOG.md b/sdk/ai/Azure.AI.Projects.1DP/CHANGELOG.md new file mode 100644 index 000000000000..8b33f0fedccc --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes \ No newline at end of file diff --git a/sdk/ai/Azure.AI.Projects.1DP/Directory.Build.props b/sdk/ai/Azure.AI.Projects.1DP/Directory.Build.props new file mode 100644 index 000000000000..63bd836ad44b --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/ai/Azure.AI.Projects.1DP/README.md b/sdk/ai/Azure.AI.Projects.1DP/README.md new file mode 100644 index 000000000000..c3654eada7fe --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/README.md @@ -0,0 +1,107 @@ +# Azure.AI.Projects.1DP client library for .NET + +Azure.AI.Projects.1DP is a managed service that helps developers get secret simply and securely. + +Use the client library for to: + +* [Get secret](https://docs.microsoft.com/azure) + +[Source code][source_root] | [Package (NuGet)][package] | [API reference documentation][reference_docs] | [Product documentation][azconfig_docs] | [Samples][source_samples] + + [Source code](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/ai/Azure.AI.Projects.1DP/src) | [Package (NuGet)](https://www.nuget.org/packages) | [API reference documentation](https://azure.github.io/azure-sdk-for-net) | [Product documentation](https://docs.microsoft.com/azure) + +## Getting started + +This section should include everything a developer needs to do to install and create their first client connection *very quickly*. + +### Install the package + +First, provide instruction for obtaining and installing the package or library. This section might include only a single line of code, like `dotnet add package package-name`, but should enable a developer to successfully install the package from NuGet, npm, or even cloning a GitHub repository. + +Install the client library for .NET with [NuGet](https://www.nuget.org/ ): + +```dotnetcli +dotnet add package Azure.AI.Projects.1DP --prerelease +``` + +### Prerequisites + +Include a section after the install command that details any requirements that must be satisfied before a developer can [authenticate](#authenticate-the-client) and test all of the snippets in the [Examples](#examples) section. For example, for Cosmos DB: + +> You must have an [Azure subscription](https://azure.microsoft.com/free/dotnet/) and [Cosmos DB account](https://docs.microsoft.com/azure/cosmos-db/account-overview) (SQL API). In order to take advantage of the C# 8.0 syntax, it is recommended that you compile using the [.NET Core SDK](https://dotnet.microsoft.com/download) 3.0 or higher with a [language version](https://docs.microsoft.com/dotnet/csharp/language-reference/configure-language-version#override-a-default) of `latest`. It is also possible to compile with the .NET Core SDK 2.1.x using a language version of `preview`. + +### Authenticate the client + +If your library requires authentication for use, such as for Azure services, include instructions and example code needed for initializing and authenticating. + +For example, include details on obtaining an account key and endpoint URI, setting environment variables for each, and initializing the client object. + +### Service API versions + +The client library targets the latest service API version by default. A client instance accepts an optional service API version parameter from its options to specify which API version service to communicate. + +#### Select a service API version + +You have the flexibility to explicitly select a supported service API version when instantiating a client by configuring its associated options. This ensures that the client can communicate with services using the specified API version. + +For example, + +```C# Snippet:CreateClientForSpecificApiVersion +Uri endpoint = new Uri(""); +DefaultAzureCredential credential = new DefaultAzureCredential(); +ClientOptions options = new ClientOptions(ClientOptions.ServiceVersion.) +var client = new Client(endpoint, credential, options); +``` + +When selecting an API version, it's 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. + +## Key concepts + +The *Key concepts* section should describe the functionality of the main classes. Point out the most important and useful classes in the package (with links to their reference pages) and explain how those classes work together. Feel free to use bulleted lists, tables, code blocks, or even diagrams for clarity. + +Include the *Thread safety* and *Additional concepts* sections below at the end of your *Key concepts* section. You may remove or add links depending on what your library makes use of: + +### Thread safety + +We guarantee that all client instance methods are thread-safe and independent of each other ([guideline](https://azure.github.io/azure-sdk/dotnet_introduction.html#dotnet-service-methods-thread-safety)). This ensures that the recommendation of reusing client instances is always safe, even across threads. + +### Additional concepts + +[Client options](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#configuring-service-clients-using-clientoptions) | +[Accessing the response](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#accessing-http-response-details-using-responset) | +[Long-running operations](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#consuming-long-running-operations-using-operationt) | +[Handling failures](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#reporting-errors-requestfailedexception) | +[Diagnostics](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/samples/Diagnostics.md) | +[Mocking](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#mocking) | +[Client lifetime](https://devblogs.microsoft.com/azure-sdk/lifetime-management-and-thread-safety-guarantees-of-azure-sdk-net-clients/) + + +## Examples + +You can familiarize yourself with different APIs using [Samples](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/ai/Azure.AI.Projects.1DP/samples). + +## Troubleshooting + +Describe common errors and exceptions, how to "unpack" them if necessary, and include guidance for graceful handling and recovery. + +Provide information to help developers avoid throttling or other service-enforced errors they might encounter. For example, provide guidance and examples for using retry or connection policies in the API. + +If the package or a related package supports it, include tips for logging or enabling instrumentation to help them debug their code. + +## Next steps + +* Provide a link to additional code examples, ideally to those sitting alongside the README in the package's `/samples` directory. +* If appropriate, point users to other packages that might be useful. +* If you think there's a good chance that developers might stumble across your package in error (because they're searching for specific functionality and mistakenly think the package provides that functionality), point them to the packages they might be looking for. + +## Contributing + +This is a template, but your SDK readme should include details on how to contribute code to the repo/package. + + +[style-guide-msft]: https://docs.microsoft.com/style-guide/capitalization +[style-guide-cloud]: https://aka.ms/azsdk/cloud-style-guide + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-net/sdk/ai/Azure.AI.Projects.1DP/README.png) \ No newline at end of file diff --git a/sdk/ai/Azure.AI.Projects.1DP/src/Azure.AI.Projects.1DP.csproj b/sdk/ai/Azure.AI.Projects.1DP/src/Azure.AI.Projects.1DP.csproj new file mode 100644 index 000000000000..df108e7e9fd2 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/src/Azure.AI.Projects.1DP.csproj @@ -0,0 +1,20 @@ + + + This is the Azure.AI.Projects.1DP client library for developing .NET applications with rich experience. + Azure SDK Code Generation Azure.AI.Projects.1DP for Azure Data Plane + 1.0.0-beta.1 + Azure.AI.Projects.1DP + $(RequiredTargetFrameworks) + true + + + + + + + + + + + + diff --git a/sdk/ai/Azure.AI.Projects.1DP/src/Generated/AIProjectClient.cs b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/AIProjectClient.cs new file mode 100644 index 000000000000..f4de290ee18f --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/AIProjectClient.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.Projects.1DP +{ +// Data plane generated client. +/// The AIProject service client. +public partial class AIProjectClient +{ + private const string AuthorizationHeader = "Authorization"; + private readonly AzureKeyCredential _keyCredential; + private const string AuthorizationApiKeyPrefix = "Bearer"; + private static readonly string[] AuthorizationScopes = new string[] { "https://cognitiveservices.azure.com/.default" }; + private readonly TokenCredential _tokenCredential; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline => _pipeline; + + /// Initializes a new instance of AIProjectClient for mocking. + protected AIProjectClient() + { + } + + /// Initializes a new instance of AIProjectClient. + /// Project endpoint in the form of: https://<aiservices-id>.services.ai.azure.com/api/projects/<project-name>. + /// A credential used to authenticate to an Azure Service. + /// or is null. + public AIProjectClient(Uri endpoint, AzureKeyCredential credential) : this(endpoint, credential, new Projects.1DP.AIProjectClientOptions()) + { + } + + /// Initializes a new instance of AIProjectClient. + /// Project endpoint in the form of: https://<aiservices-id>.services.ai.azure.com/api/projects/<project-name>. + /// A credential used to authenticate to an Azure Service. + /// or is null. + public AIProjectClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new Projects.1DP.AIProjectClientOptions()) + { + } + + /// Initializes a new instance of AIProjectClient. + /// Project endpoint in the form of: https://<aiservices-id>.services.ai.azure.com/api/projects/<project-name>. + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + /// or is null. + public AIProjectClient(Uri endpoint, AzureKeyCredential credential, Projects.1DP.AIProjectClientOptions options) + { + AI.Projects.1DP.Argument.AssertNotNull(endpoint, nameof(endpoint)); + AI.Projects.1DP.Argument.AssertNotNull(credential, nameof(credential)); + options ??= new Projects.1DP.AIProjectClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _keyCredential = credential; + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new AzureKeyCredentialPolicy(_keyCredential, AuthorizationHeader, AuthorizationApiKeyPrefix) }, new ResponseClassifier()); + _endpoint = endpoint; + } + + /// Initializes a new instance of AIProjectClient. + /// Project endpoint in the form of: https://<aiservices-id>.services.ai.azure.com/api/projects/<project-name>. + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + /// or is null. + public AIProjectClient(Uri endpoint, TokenCredential credential, Projects.1DP.AIProjectClientOptions options) + { + AI.Projects.1DP.Argument.AssertNotNull(endpoint, nameof(endpoint)); + AI.Projects.1DP.Argument.AssertNotNull(credential, nameof(credential)); + options ??= new Projects.1DP.AIProjectClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _tokenCredential = credential; + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + } + + private Projects.1DP.ServicePatterns _cachedServicePatterns; + + /// Initializes a new instance of ServicePatterns. + public virtual Projects.1DP.ServicePatterns GetServicePatternsClient() + { + return Volatile.Read(ref _cachedServicePatterns) ?? Interlocked.CompareExchange(ref _cachedServicePatterns, new Projects.1DP.ServicePatterns(ClientDiagnostics, _pipeline, _keyCredential, _tokenCredential, _endpoint), null) ?? _cachedServicePatterns; + } + + /// Initializes a new instance of Connections. + /// The API version to use for this operation. + /// is null. + public virtual Projects.1DP.Connections GetConnectionsClient(string apiVersion = "2025-05-15-preview") + { + AI.Projects.1DP.Argument.AssertNotNull(apiVersion, nameof(apiVersion)); + + return new Projects.1DP.Connections(ClientDiagnostics, _pipeline, _keyCredential, _tokenCredential, _endpoint, apiVersion); + } + + /// Initializes a new instance of Evaluations. + /// The API version to use for this operation. + /// is null. + public virtual Projects.1DP.Evaluations GetEvaluationsClient(string apiVersion = "2025-05-15-preview") + { + AI.Projects.1DP.Argument.AssertNotNull(apiVersion, nameof(apiVersion)); + + return new Projects.1DP.Evaluations(ClientDiagnostics, _pipeline, _keyCredential, _tokenCredential, _endpoint, apiVersion); + } + + /// Initializes a new instance of Datasets. + /// The API version to use for this operation. + /// is null. + public virtual Projects.1DP.Datasets GetDatasetsClient(string apiVersion = "2025-05-15-preview") + { + AI.Projects.1DP.Argument.AssertNotNull(apiVersion, nameof(apiVersion)); + + return new Projects.1DP.Datasets(ClientDiagnostics, _pipeline, _keyCredential, _tokenCredential, _endpoint, apiVersion); + } + + /// Initializes a new instance of Indexes. + /// The API version to use for this operation. + /// is null. + public virtual Projects.1DP.Indexes GetIndexesClient(string apiVersion = "2025-05-15-preview") + { + AI.Projects.1DP.Argument.AssertNotNull(apiVersion, nameof(apiVersion)); + + return new Projects.1DP.Indexes(ClientDiagnostics, _pipeline, _keyCredential, _tokenCredential, _endpoint, apiVersion); + } + + /// Initializes a new instance of Deployments. + /// The API version to use for this operation. + /// is null. + public virtual Projects.1DP.Deployments GetDeploymentsClient(string apiVersion = "2025-05-15-preview") + { + AI.Projects.1DP.Argument.AssertNotNull(apiVersion, nameof(apiVersion)); + + return new Projects.1DP.Deployments(ClientDiagnostics, _pipeline, _keyCredential, _tokenCredential, _endpoint, apiVersion); + } + + /// Initializes a new instance of EvaluationResults. + /// The API version to use for this operation. + /// is null. + public virtual Projects.1DP.EvaluationResults GetEvaluationResultsClient(string apiVersion = "2025-05-15-preview") + { + AI.Projects.1DP.Argument.AssertNotNull(apiVersion, nameof(apiVersion)); + + return new Projects.1DP.EvaluationResults(ClientDiagnostics, _pipeline, _keyCredential, _tokenCredential, _endpoint, apiVersion); + } + + /// Initializes a new instance of RedTeams. + /// The API version to use for this operation. + /// is null. + public virtual Projects.1DP.RedTeams GetRedTeamsClient(string apiVersion = "2025-05-15-preview") + { + AI.Projects.1DP.Argument.AssertNotNull(apiVersion, nameof(apiVersion)); + + return new Projects.1DP.RedTeams(ClientDiagnostics, _pipeline, _keyCredential, _tokenCredential, _endpoint, apiVersion); + } +} +} diff --git a/sdk/ai/Azure.AI.Projects.1DP/src/Generated/AIProjects1DPClientBuilderExtensions.cs b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/AIProjects1DPClientBuilderExtensions.cs new file mode 100644 index 000000000000..84f83dd22f2a --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/AIProjects1DPClientBuilderExtensions.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure; +using Azure.AI.Projects.1DP; +using Azure.Core.Extensions; + +namespace Microsoft.Extensions.Azure +{ + /// Extension methods to add to client builder. + public static partial class AIProjects1DPClientBuilderExtensions + { + /// Registers a instance. + /// The builder to register with. + /// Project endpoint in the form of: https://<aiservices-id>.services.ai.azure.com/api/projects/<project-name>. + /// A credential used to authenticate to an Azure Service. + public static global::Azure.Core.Extensions.IAzureClientBuilder AddAIProjectClient(this TBuilder builder, Uri endpoint, AzureKeyCredential credential) + where TBuilder : global::Azure.Core.Extensions.IAzureClientFactoryBuilder + { + return builder.RegisterClientFactory < global::Azure.AI.Projects.1DP.AIProjectClient,global::Azure.AI.Projects.1DP.AIProjectClientOptions > ((options) => new global::Azure.AI.Projects.1DP.AIProjectClient(endpoint, credential, options)); + } + + /// Registers a instance. + /// The builder to register with. + /// Project endpoint in the form of: https://<aiservices-id>.services.ai.azure.com/api/projects/<project-name>. + public static global::Azure.Core.Extensions.IAzureClientBuilder AddAIProjectClient(this TBuilder builder, Uri endpoint) + where TBuilder : global::Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential + { + return builder.RegisterClientFactory < global::Azure.AI.Projects.1DP.AIProjectClient,global::Azure.AI.Projects.1DP.AIProjectClientOptions > ((options, cred) => new global::Azure.AI.Projects.1DP.AIProjectClient(endpoint, cred, options)); + } + + /// Registers a instance. + /// The builder to register with. + /// The configuration values. + public static global::Azure.Core.Extensions.IAzureClientBuilder AddAIProjectClient(this TBuilder builder, TConfiguration configuration) + where TBuilder : global::Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration + { + return builder.RegisterClientFactory < global::Azure.AI.Projects.1DP.AIProjectClient,global::Azure.AI.Projects.1DP.AIProjectClientOptions > configuration; + } + } +} diff --git a/sdk/ai/Azure.AI.Projects.1DP/src/Generated/AIProjects1DPModelFactory.cs b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/AIProjects1DPModelFactory.cs new file mode 100644 index 000000000000..99a48936bf56 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/AIProjects1DPModelFactory.cs @@ -0,0 +1,488 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Projects.1DP +{ + +/// Initializes a new instance of . +/// Type of Evaluation result. +/// Model Name. +/// Model Version. +/// Model Asset ID. +/// Dataset Family. +/// Dataset Name. +/// Metrics. +/// Blob URI. +/// Asset stage. +/// A unique identifier for the asset, assetId probably?. +/// The name of the resource. +/// The version of the resource. +/// The asset description text. +/// Tag dictionary. Tags can be added, removed, and updated. +/// A new instance for mocking. +public static Projects.1DP.EvaluationResult EvaluationResult(Projects.1DP.ResultType? resultType = (Projects.1DP.ResultType?)null,string modelName = null,string modelVersion = null,string modelAssetId = null,string datasetFamily = null,string datasetName = null, global::System.Collections.Generic.IDictionary metrics = (IDictionary)null,string blobUri = null,string stage = null,string id = null,string name = null,string version = null,string description = null, global::System.Collections.Generic.IDictionary tags = (IDictionary)null) +{ +metrics ??= new Dictionary(); +tags ??= new Dictionary(); + +return new Projects.1DP.EvaluationResult( + resultType, + modelName, + modelVersion, + modelAssetId, + datasetFamily, + datasetName, + metrics, + blobUri, + stage, + id, + name, + version, + description, + tags, + serializedAdditionalRawData: null); +} + +/// Initializes a new instance of . +/// If PendingUploadId is not provided, a random GUID will be used. +/// Name of Azure blob storage connection to use for generating temporary SAS token. +/// TemporaryBlobReference is the only supported type. +/// A new instance for mocking. +public static Azure.AI.Projects .1DP.PendingUploadRequest PendingUploadRequest(string pendingUploadId = (string)null, string connectionName = (string)null, Azure.AI.Projects.1DP.PendingUploadType pendingUploadType = default) +{ + return new Azure.AI.Projects.1DP.PendingUploadRequest(pendingUploadId, connectionName, pendingUploadType, serializedAdditionalRawData: null); +} + +/// Initializes a new instance of . +/// Container-level read, write, list SAS. +/// ID for this upload request. +/// Version of dataset to be created if user did not specify version when initially creating upload. +/// TemporaryBlobReference is the only supported type. +/// A new instance for mocking. +public static Azure.AI.Projects .1DP.PendingUploadResponse PendingUploadResponse(Azure.AI.Projects.1DP.BlobReferenceForConsumption blobReferenceForConsumption = (Azure.AI.Projects.1DP.BlobReferenceForConsumption)null,string pendingUploadId = null,string datasetVersion = (string)null,Azure.AI.Projects.1DP.PendingUploadType pendingUploadType = default) +{ + return new Azure.AI.Projects.1DP.PendingUploadResponse(blobReferenceForConsumption, pendingUploadId, datasetVersion, pendingUploadType, serializedAdditionalRawData: null); +} + +/// Initializes a new instance of . +/// Blob URI path for client to upload data. Example: https://blob.windows.core.net/Container/Path. +/// ARM ID of the storage account to use. +/// Credential info to access the storage account. +/// A new instance for mocking. +public static Azure.AI.Projects .1DP.BlobReferenceForConsumption BlobReferenceForConsumption(string blobUri = (string)null, string storageAccountArmId = (string)null, Azure.AI.Projects.1DP.SasCredential credential = (Azure.AI.Projects.1DP.SasCredential)null) +{ + return new Azure.AI.Projects.1DP.BlobReferenceForConsumption(blobUri, storageAccountArmId, credential, serializedAdditionalRawData: null); +} + +/// Initializes a new instance of . +/// SAS Token. +/// A new instance for mocking. +public static Azure.AI.Projects .1DP.SasCredential SasCredential(string sasToken = (string)null) +{ + return new Azure.AI.Projects.1DP.SasCredential(Azure.AI.Projects.1DP.CredentialType.SAS, serializedAdditionalRawData: null, sasToken); +} + +/// Initializes a new instance of . +/// API Key. +/// A new instance for mocking. +public static Azure.AI.Projects .1DP.ApiKeyCredential ApiKeyCredential(string apiKey = (string)null) +{ + return new Azure.AI.Projects.1DP.ApiKeyCredential(Azure.AI.Projects.1DP.CredentialType.ApiKey, serializedAdditionalRawData: null, apiKey); +} + +/// Initializes a new instance of . +/// The type of the deployment. +/// Name of the deployment. +/// A new instance for mocking. +public static Azure.AI.Projects .1DP.Deployment Deployment(string type = (string)null, string name = (string)null) +{ + return new Azure.AI.Projects.1DP.UnknownDeployment(type == null ? ((Azure.AI.Projects.1DP.DeploymentType)default) : new Azure.AI.Projects.1DP.DeploymentType(type), name, serializedAdditionalRawData: null); +} + +/// Initializes a new instance of . +/// Name of the deployment. +/// Publisher-specific name of the deployed model. +/// Publisher-specific version of the deployed model. +/// Name of the deployed model's publisher. +/// Capabilities of deployed model. +/// Sku of the model deployment. +/// Name of the connection the deployment comes from. +/// A new instance for mocking. +public static Azure.AI.Projects .1DP.ModelDeployment ModelDeployment(string name = (string)null, string modelName = (string)null, string modelVersion = (string)null, string modelPublisher = (string)null, IReadOnlyDictionary capabilities = (IReadOnlyDictionary)null, Azure.AI.Projects.1DP.Sku sku = (Azure.AI.Projects.1DP.Sku)null,string connectionName = null) +{ + capabilities ??= new Dictionary(); + + return new Azure.AI.Projects.1DP.ModelDeployment( + Azure.AI.Projects.1DP.DeploymentType.ModelDeployment, + name, + serializedAdditionalRawData: null, + modelName, + modelVersion, + modelPublisher, + capabilities, + sku, + connectionName); +} + +/// Initializes a new instance of . +/// Sku capacity. +/// Sku family. +/// Sku name. +/// Sku size. +/// Sku tier. +/// A new instance for mocking. +public static Azure.AI.Projects .1DP.Sku Sku(long capacity = default, string family = (string)null, string name = (string)null, string size = (string)null, string tier = (string)null) +{ + return new Azure.AI.Projects.1DP.Sku( + capacity, + family, + name, + size, + tier, + serializedAdditionalRawData: null); +} + +/// Initializes a new instance of . +/// Type of index. +/// Asset stage. +/// A unique identifier for the asset, assetId probably?. +/// The name of the resource. +/// The version of the resource. +/// The asset description text. +/// Tag dictionary. Tags can be added, removed, and updated. +/// A new instance for mocking. +public static Azure.AI.Projects .1DP.Index Index(string type = (string)null, string stage = (string)null, string id = (string)null, string name = (string)null, string version = (string)null, string description = (string)null, IDictionary tags = (IDictionary)null) +{ + tags ??= new Dictionary(); + + return new Azure.AI.Projects.1DP.UnknownIndex( + type == null ? ((Azure.AI.Projects.1DP.IndexType)default) : new Azure.AI.Projects.1DP.IndexType(type), + stage, + id, + name, + version, + description, + tags, + serializedAdditionalRawData: null); +} + +/// Initializes a new instance of . +/// Asset stage. +/// A unique identifier for the asset, assetId probably?. +/// The name of the resource. +/// The version of the resource. +/// The asset description text. +/// Tag dictionary. Tags can be added, removed, and updated. +/// Name of connection to Azure AI Search. +/// Name of index in Azure AI Search resource to attach. +/// A new instance for mocking. +public static Azure.AI.Projects .1DP.AzureAISearchIndex AzureAISearchIndex(string stage = (string)null, string id = (string)null, string name = (string)null, string version = (string)null, string description = (string)null, IDictionary tags = (IDictionary)null, string connectionName = (string)null, string indexName = (string)null) +{ + tags ??= new Dictionary(); + + return new Azure.AI.Projects.1DP.AzureAISearchIndex( + Azure.AI.Projects.1DP.IndexType.AzureSearch, + stage, + id, + name, + version, + description, + tags, + serializedAdditionalRawData: null, + connectionName, + indexName); +} + +/// Initializes a new instance of . +/// Asset stage. +/// A unique identifier for the asset, assetId probably?. +/// The name of the resource. +/// The version of the resource. +/// The asset description text. +/// Tag dictionary. Tags can be added, removed, and updated. +/// Vector store id of managed index. +/// A new instance for mocking. +public static Azure.AI.Projects .1DP.ManagedAzureAISearchIndex ManagedAzureAISearchIndex(string stage = (string)null, string id = (string)null, string name = (string)null, string version = (string)null, string description = (string)null, IDictionary tags = (IDictionary)null, string vectorStoreId = (string)null) +{ + tags ??= new Dictionary(); + + return new Azure.AI.Projects.1DP.ManagedAzureAISearchIndex( + Azure.AI.Projects.1DP.IndexType.ManagedAzureSearch, + stage, + id, + name, + version, + description, + tags, + serializedAdditionalRawData: null, + vectorStoreId); +} + +/// Initializes a new instance of . +/// Asset stage. +/// A unique identifier for the asset, assetId probably?. +/// The name of the resource. +/// The version of the resource. +/// The asset description text. +/// Tag dictionary. Tags can be added, removed, and updated. +/// Name of connection to CosmosDB. +/// Name of the CosmosDB Database. +/// Name of CosmosDB Container. +/// Embedding model configuration. +/// A new instance for mocking. +public static Azure.AI.Projects .1DP.CosmosDBIndex CosmosDBIndex(string stage = (string)null, string id = (string)null, string name = (string)null, string version = (string)null, string description = (string)null, IDictionary tags = (IDictionary)null, string connectionName = (string)null, string databaseName = (string)null, string containerName = (string)null, Azure.AI.Projects.1DP.EmbeddingConfiguration embeddingConfiguration = (Azure.AI.Projects.1DP.EmbeddingConfiguration)null) +{ + tags ??= new Dictionary(); + + return new Azure.AI.Projects.1DP.CosmosDBIndex( + Azure.AI.Projects.1DP.IndexType.CosmosDB, + stage, + id, + name, + version, + description, + tags, + serializedAdditionalRawData: null, + connectionName, + databaseName, + containerName, + embeddingConfiguration); +} + +/// Initializes a new instance of . +/// [Required] Uri of the data. Example: https://go.microsoft.com/fwlink/?linkid=2202330. +/// Dataset type. +/// Indicates if dataset is reference only or managed by dataset service. If true, the underlying data will be deleted when the dataset version is deleted. +/// Asset stage. +/// A unique identifier for the asset, assetId probably?. +/// The name of the resource. +/// The version of the resource. +/// The asset description text. +/// Tag dictionary. Tags can be added, removed, and updated. +/// A new instance for mocking. +public static Azure.AI.Projects .1DP.DatasetVersion DatasetVersion(string datasetUri = (string)null, string type = (string)null, bool? isReference = (bool?)null, string stage = (string)null, string id = (string)null, string name = (string)null, string version = (string)null, string description = (string)null, IDictionary tags = (IDictionary)null) +{ + tags ??= new Dictionary(); + + return new Azure.AI.Projects.1DP.UnknownDatasetVersion( + datasetUri, + type == null ? ((Azure.AI.Projects.1DP.DatasetType)default) : new Azure.AI.Projects.1DP.DatasetType(type), + isReference, + stage, + id, + name, + version, + description, + tags, + serializedAdditionalRawData: null); +} + +/// Initializes a new instance of . +/// [Required] Uri of the data. Example: https://go.microsoft.com/fwlink/?linkid=2202330. +/// Indicates if dataset is reference only or managed by dataset service. If true, the underlying data will be deleted when the dataset version is deleted. +/// Asset stage. +/// A unique identifier for the asset, assetId probably?. +/// The name of the resource. +/// The version of the resource. +/// The asset description text. +/// Tag dictionary. Tags can be added, removed, and updated. +/// Indicates OpenAI Purpose. FileDatasets created with this field will be compatible with OpenAI-specific features. +/// A new instance for mocking. +public static Azure.AI.Projects .1DP.FileDatasetVersion FileDatasetVersion(string datasetUri = (string)null, bool? isReference = (bool?)null, string stage = (string)null, string id = (string)null, string name = (string)null, string version = (string)null, string description = (string)null, IDictionary tags = (IDictionary)null, string openAIPurpose = (string)null) +{ + tags ??= new Dictionary(); + + return new Azure.AI.Projects.1DP.FileDatasetVersion( + datasetUri, + Azure.AI.Projects.1DP.DatasetType.UriFile, + isReference, + stage, + id, + name, + version, + description, + tags, + serializedAdditionalRawData: null, + openAIPurpose); +} + +/// Initializes a new instance of . +/// [Required] Uri of the data. Example: https://go.microsoft.com/fwlink/?linkid=2202330. +/// Indicates if dataset is reference only or managed by dataset service. If true, the underlying data will be deleted when the dataset version is deleted. +/// Asset stage. +/// A unique identifier for the asset, assetId probably?. +/// The name of the resource. +/// The version of the resource. +/// The asset description text. +/// Tag dictionary. Tags can be added, removed, and updated. +/// A new instance for mocking. +public static Azure.AI.Projects .1DP.FolderDatasetVersion FolderDatasetVersion(string datasetUri = (string)null, bool? isReference = (bool?)null, string stage = (string)null, string id = (string)null, string name = (string)null, string version = (string)null, string description = (string)null, IDictionary tags = (IDictionary)null) +{ + tags ??= new Dictionary(); + + return new Azure.AI.Projects.1DP.FolderDatasetVersion( + datasetUri, + Azure.AI.Projects.1DP.DatasetType.UriFolder, + isReference, + stage, + id, + name, + version, + description, + tags, + serializedAdditionalRawData: null); +} + +/// Initializes a new instance of . +/// Identifier of the evaluation. +/// +/// Data for evaluation. +/// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. +/// The available derived classes include . +/// +/// Display Name for evaluation. It helps to find the evaluation easily in AI Foundry. It does not need to be unique. +/// Description of the evaluation. It can be used to store additional information about the evaluation and is mutable. +/// Status of the evaluation. It is set by service and is read-only. +/// Evaluation's tags. Unlike properties, tags are fully mutable. +/// Evaluation's properties. Unlike tags, properties are add-only. Once added, a property cannot be removed. +/// Evaluators to be used for the evaluation. +/// Read-only result outputs. Example: { 'evaluationResultId': 'azureai://accounts/{AccountName}/projects/{myproject}/evaluationresults/{name}/{version}', 'logId': 'azureai://accounts/{AccountName}/projects/{myproject}/datasets/{dataset-name}/{dataset-version}' }. +/// A new instance for mocking. +public static Azure.AI.Projects .1DP.Evaluation Evaluation(string id = (string)null, Azure.AI.Projects.1DP.InputData data = (Azure.AI.Projects.1DP.InputData)null,string displayName = null,string description = (string)null,string status = null, global::System.Collections.Generic.IDictionary tags = (global::System.Collections.Generic.IDictionary)null,IDictionary properties = null, global::System.Collections.Generic.IDictionary evaluators = (global::System.Collections.Generic.IDictionary)null,IReadOnlyDictionary outputs = null) +{ + tags ??= new Dictionary(); + properties ??= new global::System.Collections.Generic.Dictionary(); + evaluators ??= new Dictionary; + outputs ??= new global::System.Collections.Generic.Dictionary(); + + return new Azure.AI.Projects.1DP.Evaluation( + id, + data, + displayName, + description, + status, + tags, + properties, + evaluators, + outputs, + serializedAdditionalRawData: null); +} + +/// Initializes a new instance of . +/// The name of the resource. +/// Category of the connection. +/// The connection URL to be used for this service. +/// The authentication type used by the connection. +/// Metadata of the connection. +/// A new instance for mocking. +public static Azure.AI.Projects .1DP.Connection Connection(string name = (string)null, Azure.AI.Projects.1DP.ConnectionType type = default, string target = (string)null, Azure.AI.Projects.1DP.AuthenticationType authType = default, IReadOnlyDictionary metadata = (IReadOnlyDictionary)null) +{ + metadata ??= new Dictionary(); + + return new Azure.AI.Projects.1DP.Connection( + name, + type, + target, + authType, + metadata, + serializedAdditionalRawData: null); +} + +/// Initializes a new instance of . +/// The Connection items on this page. +/// The link to the next page of items. +/// A new instance for mocking. +public static Azure.AI.Projects .1DP.PagedConnection PagedConnection(System.Collections.Generic.IEnumerable value = (System.Collections.Generic.IEnumerable < Azure.AI.Projects.1DP.Connection>)null,Uri nextLink = null) +{ + value ??= new List; + + return new Azure.AI.Projects.1DP.PagedConnection(value?.ToList(), nextLink, serializedAdditionalRawData: null); +} + +/// Initializes a new instance of . +/// The Evaluation items on this page. +/// The link to the next page of items. +/// A new instance for mocking. +public static Azure.AI.Projects .1DP.PagedEvaluation PagedEvaluation(System.Collections.Generic.IEnumerable value = (System.Collections.Generic.IEnumerable < Azure.AI.Projects.1DP.Evaluation>)null,Uri nextLink = null) +{ + value ??= new List; + + return new Azure.AI.Projects.1DP.PagedEvaluation(value?.ToList(), nextLink, serializedAdditionalRawData: null); +} + +/// Initializes a new instance of . +/// +/// The DatasetVersion items on this page +/// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. +/// The available derived classes include and . +/// +/// The link to the next page of items. +/// A new instance for mocking. +public static Azure.AI.Projects .1DP.PagedDatasetVersion PagedDatasetVersion(System.Collections.Generic.IEnumerable value = (System.Collections.Generic.IEnumerable < Azure.AI.Projects.1DP.DatasetVersion>)null,Uri nextLink = null) +{ + value ??= new List; + + return new Azure.AI.Projects.1DP.PagedDatasetVersion(value?.ToList(), nextLink, serializedAdditionalRawData: null); +} + +/// Initializes a new instance of . +/// +/// The Index items on this page +/// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. +/// The available derived classes include , and . +/// +/// The link to the next page of items. +/// A new instance for mocking. +public static Azure.AI.Projects .1DP.PagedIndex PagedIndex(System.Collections.Generic.IEnumerable value = (System.Collections.Generic.IEnumerable < Azure.AI.Projects.1DP.Index>)null,Uri nextLink = null) +{ + value ??= new List; + + return new Azure.AI.Projects.1DP.PagedIndex(value?.ToList(), nextLink, serializedAdditionalRawData: null); +} + +/// Initializes a new instance of . +/// +/// The Deployment items on this page +/// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. +/// The available derived classes include . +/// +/// The link to the next page of items. +/// A new instance for mocking. +public static Azure.AI.Projects .1DP.PagedDeployment PagedDeployment(System.Collections.Generic.IEnumerable value = (System.Collections.Generic.IEnumerable < Azure.AI.Projects.1DP.Deployment>)null,Uri nextLink = null) +{ + value ??= new List; + + return new Azure.AI.Projects.1DP.PagedDeployment(value?.ToList(), nextLink, serializedAdditionalRawData: null); +} + +/// Initializes a new instance of . +/// The EvaluationResult items on this page. +/// The link to the next page of items. +/// A new instance for mocking. +public static Azure.AI.Projects .1DP.PagedEvaluationResult PagedEvaluationResult(System.Collections.Generic.IEnumerable value = (System.Collections.Generic.IEnumerable < Azure.AI.Projects.1DP.EvaluationResult>)null,Uri nextLink = null) +{ + value ??= new List; + + return new Azure.AI.Projects.1DP.PagedEvaluationResult(value?.ToList(), nextLink, serializedAdditionalRawData: null); +} + +/// Initializes a new instance of . +/// The RedTeam items on this page. +/// The link to the next page of items. +/// A new instance for mocking. +public static Azure.AI.Projects .1DP.PagedRedTeam PagedRedTeam(System.Collections.Generic.IEnumerable value = (System.Collections.Generic.IEnumerable < Azure.AI.Projects.1DP.RedTeam>)null,Uri nextLink = null) +{ + value ??= new List; + + return new Azure.AI.Projects.1DP.PagedRedTeam(value?.ToList(), nextLink, serializedAdditionalRawData: null); +} +} +} diff --git a/sdk/ai/Azure.AI.Projects.1DP/src/Generated/Connections.cs b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/Connections.cs new file mode 100644 index 000000000000..0cdf8b8ac174 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/Connections.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.Projects.1DP +{ + +/// List all connections in the project. +/// Specific type of connection to return in list. +/// The number of result items to return. +/// The number of result items to skip. +/// The maximum number of result items per page. +/// The cancellation token to use. +/// +public virtual Azure.Pageable GetConnections(Projects.1DP.ConnectionType? connectionType = (Projects.1DP.ConnectionType?)null,int? maxCount = null,int? skip = null,int? maxpagesize = null, global::System.Threading.CancellationToken cancellationToken = default) +{ +RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; +HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetConnectionsRequest(connectionType?.ToString(), maxCount, skip, pageSizeHint, context); +HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetConnectionsNextPageRequest(nextLink, connectionType?.ToString(), maxCount, skip, pageSizeHint, context); +return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => Projects.1DP.Connection.DeserializeConnection(e), ClientDiagnostics, _pipeline, "Connections.GetConnections", "value", "nextLink", maxpagesize, context); +} + +/// +/// [Protocol Method] List all connections in the project +/// +/// +/// +/// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. +/// +/// +/// +/// +/// Please try the simpler convenience overload with strongly typed models first. +/// +/// +/// +/// +/// Specific type of connection to return in list. Allowed values: "AzureOpenAI" | "AzureBlob" | "CognitiveSearch" | "CosmosDB" | "ApiKey" | "AppInsights" | "CustomKeys". +/// The number of result items to return. +/// The number of result items to skip. +/// The maximum number of result items per page. +/// The request context, which can override default behaviors of the client pipeline on a per-call basis. +/// Service returned a non-success status code. +/// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. +/// +public virtual Azure.AsyncPageable GetConnectionsAsync(string connectionType, int? maxCount, int? skip, int? maxpagesize, Azure.RequestContext context) +{ + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetConnectionsRequest(connectionType, maxCount, skip, pageSizeHint, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetConnectionsNextPageRequest(nextLink, connectionType, maxCount, skip, pageSizeHint, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Connections.GetConnections", "value", "nextLink", maxpagesize, context); +} + +/// +/// [Protocol Method] List all connections in the project +/// +/// +/// +/// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. +/// +/// +/// +/// +/// Please try the simpler convenience overload with strongly typed models first. +/// +/// +/// +/// +/// Specific type of connection to return in list. Allowed values: "AzureOpenAI" | "AzureBlob" | "CognitiveSearch" | "CosmosDB" | "ApiKey" | "AppInsights" | "CustomKeys". +/// The number of result items to return. +/// The number of result items to skip. +/// The maximum number of result items per page. +/// The request context, which can override default behaviors of the client pipeline on a per-call basis. +/// Service returned a non-success status code. +/// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. +/// +public virtual Azure.Pageable GetConnections(string connectionType, int? maxCount, int? skip, int? maxpagesize, Azure.RequestContext context) +{ + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetConnectionsRequest(connectionType, maxCount, skip, pageSizeHint, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetConnectionsNextPageRequest(nextLink, connectionType, maxCount, skip, pageSizeHint, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Connections.GetConnections", "value", "nextLink", maxpagesize, context); +} + +internal HttpMessage CreateGetConnectionRequest(string name, Azure.RequestContext context) +{ + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/connections/", false); + uri.AppendPath(name, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; +} + +internal HttpMessage CreateGetConnectionsRequest(string connectionType, int? maxCount, int? skip, int? maxpagesize, Azure.RequestContext context) +{ + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/connections", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (connectionType != null) + { + uri.AppendQuery("connectionType", connectionType, true); + } + if (maxCount != null) + { + uri.AppendQuery("top", maxCount.Value, true); + } + if (skip != null) + { + uri.AppendQuery("skip", skip.Value, true); + } + if (maxpagesize != null) + { + uri.AppendQuery("maxpagesize", maxpagesize.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; +} + +internal HttpMessage CreateGetConnectionsNextPageRequest(string nextLink, string connectionType, int? maxCount, int? skip, int? maxpagesize, Azure.RequestContext context) +{ + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; +} + +private static Azure.RequestContext DefaultRequestContext = new Azure.RequestContext(); +internal static Azure.RequestContext FromCancellationToken(CancellationToken cancellationToken = default) +{ + if (!cancellationToken.CanBeCanceled) + { + return DefaultRequestContext; + } + + return new Azure.RequestContext() { CancellationToken = cancellationToken }; +} + +private static ResponseClassifier _responseClassifier200; +private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); +} +} diff --git a/sdk/ai/Azure.AI.Projects.1DP/src/Generated/Datasets.cs b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/Datasets.cs new file mode 100644 index 000000000000..f466058d656e --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/Datasets.cs @@ -0,0 +1,415 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.Projects.1DP +{ + +/// List all versions of the given DatasetVersion. +/// The name of the resource. +/// Top count of results, top count cannot be greater than the page size. If topCount > page size, results with be default page size count will be returned. +/// Continuation token for pagination. +/// Comma-separated list of tag names (and optionally values). Example: tag1,tag2=value2. +/// [ListViewType.ActiveOnly, ListViewType.ArchivedOnly, ListViewType.All] View type for including/excluding (for example) archived entities. +/// The cancellation token to use. +/// is null. +/// is an empty string, and was expected to be non-empty. +/// +public virtual Azure.Pageable GetVersions(string name, int? maxCount = null, string skip = null, string tags = null, Projects.1DP.ListViewType? listViewType = (Projects.1DP.ListViewType?)null,CancellationToken cancellationToken = default) +{ +Projects.1DP.Argument.AssertNotNullOrEmpty(name, nameof(name)); + +RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; +HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetVersionsRequest(name, maxCount, skip, tags, listViewType?.ToString(), context); +HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetVersionsNextPageRequest(nextLink, name, maxCount, skip, tags, listViewType?.ToString(), context); +return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => Projects.1DP.DatasetVersion.DeserializeDatasetVersion(e), ClientDiagnostics, _pipeline, "Datasets.GetVersions", "value", "nextLink", context); +} + +/// +/// [Protocol Method] List all versions of the given DatasetVersion +/// +/// +/// +/// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. +/// +/// +/// +/// +/// Please try the simpler convenience overload with strongly typed models first. +/// +/// +/// +/// +/// The name of the resource. +/// Top count of results, top count cannot be greater than the page size. If topCount > page size, results with be default page size count will be returned. +/// Continuation token for pagination. +/// Comma-separated list of tag names (and optionally values). Example: tag1,tag2=value2. +/// [ListViewType.ActiveOnly, ListViewType.ArchivedOnly, ListViewType.All] View type for including/excluding (for example) archived entities. Allowed values: "ActiveOnly" | "ArchivedOnly" | "All". +/// The request context, which can override default behaviors of the client pipeline on a per-call basis. +/// is null. +/// is an empty string, and was expected to be non-empty. +/// Service returned a non-success status code. +/// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. +/// +public virtual Azure.AsyncPageable GetVersionsAsync(string name, int? maxCount, string skip, string tags, string listViewType, Azure.RequestContext context) +{ + Azure.AI.Projects.1DP.Argument.AssertNotNullOrEmpty(name, nameof(name)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetVersionsRequest(name, maxCount, skip, tags, listViewType, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetVersionsNextPageRequest(nextLink, name, maxCount, skip, tags, listViewType, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Datasets.GetVersions", "value", "nextLink", context); +} + +/// +/// [Protocol Method] List all versions of the given DatasetVersion +/// +/// +/// +/// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. +/// +/// +/// +/// +/// Please try the simpler convenience overload with strongly typed models first. +/// +/// +/// +/// +/// The name of the resource. +/// Top count of results, top count cannot be greater than the page size. If topCount > page size, results with be default page size count will be returned. +/// Continuation token for pagination. +/// Comma-separated list of tag names (and optionally values). Example: tag1,tag2=value2. +/// [ListViewType.ActiveOnly, ListViewType.ArchivedOnly, ListViewType.All] View type for including/excluding (for example) archived entities. Allowed values: "ActiveOnly" | "ArchivedOnly" | "All". +/// The request context, which can override default behaviors of the client pipeline on a per-call basis. +/// is null. +/// is an empty string, and was expected to be non-empty. +/// Service returned a non-success status code. +/// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. +/// +public virtual Azure.Pageable GetVersions(string name, int? maxCount, string skip, string tags, string listViewType, Azure.RequestContext context) +{ + Azure.AI.Projects.1DP.Argument.AssertNotNullOrEmpty(name, nameof(name)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetVersionsRequest(name, maxCount, skip, tags, listViewType, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetVersionsNextPageRequest(nextLink, name, maxCount, skip, tags, listViewType, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Datasets.GetVersions", "value", "nextLink", context); +} + +/// List the latest version of each DatasetVersion. +/// Top count of results, top count cannot be greater than the page size. If topCount > page size, results with be default page size count will be returned. +/// Continuation token for pagination. +/// Comma-separated list of tag names (and optionally values). Example: tag1,tag2=value2. +/// [ListViewType.ActiveOnly, ListViewType.ArchivedOnly, ListViewType.All] View type for including/excluding (for example) archived entities. +/// The cancellation token to use. +/// +public virtual Azure.AsyncPageable GetLatestsAsync(int? maxCount = null, string skip = null, string tags = null, Azure.AI.Projects.1DP.ListViewType? listViewType = (Azure.AI.Projects.1DP.ListViewType?)null,CancellationToken cancellationToken = default) +{ + Azure.RequestContext context = cancellationToken.CanBeCanceled ? new Azure.RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetLatestsRequest(maxCount, skip, tags, listViewType?.ToString(), context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetLatestsNextPageRequest(nextLink, maxCount, skip, tags, listViewType?.ToString(), context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => Azure.AI.Projects.1DP.DatasetVersion.DeserializeDatasetVersion(e), ClientDiagnostics, _pipeline, "Datasets.GetLatests", "value", "nextLink", context); +} + +/// List the latest version of each DatasetVersion. +/// Top count of results, top count cannot be greater than the page size. If topCount > page size, results with be default page size count will be returned. +/// Continuation token for pagination. +/// Comma-separated list of tag names (and optionally values). Example: tag1,tag2=value2. +/// [ListViewType.ActiveOnly, ListViewType.ArchivedOnly, ListViewType.All] View type for including/excluding (for example) archived entities. +/// The cancellation token to use. +/// +public virtual Azure.Pageable GetLatests(int? maxCount = null, string skip = null, string tags = null, Azure.AI.Projects.1DP.ListViewType? listViewType = (Azure.AI.Projects.1DP.ListViewType?)null,CancellationToken cancellationToken = default) +{ + Azure.RequestContext context = cancellationToken.CanBeCanceled ? new Azure.RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetLatestsRequest(maxCount, skip, tags, listViewType?.ToString(), context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetLatestsNextPageRequest(nextLink, maxCount, skip, tags, listViewType?.ToString(), context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => Azure.AI.Projects.1DP.DatasetVersion.DeserializeDatasetVersion(e), ClientDiagnostics, _pipeline, "Datasets.GetLatests", "value", "nextLink", context); +} + +/// +/// [Protocol Method] List the latest version of each DatasetVersion +/// +/// +/// +/// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. +/// +/// +/// +/// +/// Please try the simpler convenience overload with strongly typed models first. +/// +/// +/// +/// +/// Top count of results, top count cannot be greater than the page size. If topCount > page size, results with be default page size count will be returned. +/// Continuation token for pagination. +/// Comma-separated list of tag names (and optionally values). Example: tag1,tag2=value2. +/// [ListViewType.ActiveOnly, ListViewType.ArchivedOnly, ListViewType.All] View type for including/excluding (for example) archived entities. Allowed values: "ActiveOnly" | "ArchivedOnly" | "All". +/// The request context, which can override default behaviors of the client pipeline on a per-call basis. +/// Service returned a non-success status code. +/// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. +/// +public virtual Azure.AsyncPageable GetLatestsAsync(int? maxCount, string skip, string tags, string listViewType, Azure.RequestContext context) +{ + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetLatestsRequest(maxCount, skip, tags, listViewType, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetLatestsNextPageRequest(nextLink, maxCount, skip, tags, listViewType, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Datasets.GetLatests", "value", "nextLink", context); +} + +/// +/// [Protocol Method] List the latest version of each DatasetVersion +/// +/// +/// +/// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. +/// +/// +/// +/// +/// Please try the simpler convenience overload with strongly typed models first. +/// +/// +/// +/// +/// Top count of results, top count cannot be greater than the page size. If topCount > page size, results with be default page size count will be returned. +/// Continuation token for pagination. +/// Comma-separated list of tag names (and optionally values). Example: tag1,tag2=value2. +/// [ListViewType.ActiveOnly, ListViewType.ArchivedOnly, ListViewType.All] View type for including/excluding (for example) archived entities. Allowed values: "ActiveOnly" | "ArchivedOnly" | "All". +/// The request context, which can override default behaviors of the client pipeline on a per-call basis. +/// Service returned a non-success status code. +/// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. +/// +public virtual Azure.Pageable GetLatests(int? maxCount, string skip, string tags, string listViewType, Azure.RequestContext context) +{ + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetLatestsRequest(maxCount, skip, tags, listViewType, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetLatestsNextPageRequest(nextLink, maxCount, skip, tags, listViewType, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Datasets.GetLatests", "value", "nextLink", context); +} + +internal HttpMessage CreateGetVersionsRequest(string name, int? maxCount, string skip, string tags, string listViewType, Azure.RequestContext context) +{ + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/datasets/", false); + uri.AppendPath(name, true); + uri.AppendPath("/versions", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (maxCount != null) + { + uri.AppendQuery("top", maxCount.Value, true); + } + if (skip != null) + { + uri.AppendQuery("skip", skip, true); + } + if (tags != null) + { + uri.AppendQuery("tags", tags, true); + } + if (listViewType != null) + { + uri.AppendQuery("listViewType", listViewType, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; +} + +internal HttpMessage CreateGetLatestsRequest(int? maxCount, string skip, string tags, string listViewType, Azure.RequestContext context) +{ + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/datasets", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (maxCount != null) + { + uri.AppendQuery("top", maxCount.Value, true); + } + if (skip != null) + { + uri.AppendQuery("skip", skip, true); + } + if (tags != null) + { + uri.AppendQuery("tags", tags, true); + } + if (listViewType != null) + { + uri.AppendQuery("listViewType", listViewType, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; +} + +internal HttpMessage CreateGetVersionRequest(string name, string version, Azure.RequestContext context) +{ + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/datasets/", false); + uri.AppendPath(name, true); + uri.AppendPath("/versions/", false); + uri.AppendPath(version, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; +} + +internal HttpMessage CreateDeleteVersionRequest(string name, string version, Azure.RequestContext context) +{ + var message = _pipeline.CreateMessage(context, ResponseClassifier204); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/datasets/", false); + uri.AppendPath(name, true); + uri.AppendPath("/versions/", false); + uri.AppendPath(version, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; +} + +internal HttpMessage CreateCreateRequest(string name, RequestContent content, Azure.RequestContext context) +{ + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/datasets/", false); + uri.AppendPath(name, true); + uri.AppendPath("/versions", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Repeatability-Request-ID", Guid.NewGuid()); + request.Headers.Add("Repeatability-First-Sent", DateTimeOffset.Now, "R"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; +} + +internal HttpMessage CreateCreateVersionRequest(string name, string version, RequestContent content, Azure.RequestContext context) +{ + var message = _pipeline.CreateMessage(context, ResponseClassifier200201); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/datasets/", false); + uri.AppendPath(name, true); + uri.AppendPath("/versions/", false); + uri.AppendPath(version, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; +} + +internal HttpMessage CreateStartPendingUploadVersionRequest(string name, string version, RequestContent content, Azure.RequestContext context) +{ + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/datasets/", false); + uri.AppendPath(name, true); + uri.AppendPath("/versions/", false); + uri.AppendPath(version, true); + uri.AppendPath("/startPendingUploadVersion", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; +} + +internal HttpMessage CreateStartPendingUploadRequest(string name, RequestContent content, Azure.RequestContext context) +{ + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/datasets/", false); + uri.AppendPath(name, true); + uri.AppendPath("/startPendingUpload", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; +} + +internal HttpMessage CreateGetVersionsNextPageRequest(string nextLink, string name, int? maxCount, string skip, string tags, string listViewType, Azure.RequestContext context) +{ + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; +} + +internal HttpMessage CreateGetLatestsNextPageRequest(string nextLink, int? maxCount, string skip, string tags, string listViewType, Azure.RequestContext context) +{ + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; +} + +private static Azure.RequestContext DefaultRequestContext = new Azure.RequestContext(); +internal static Azure.RequestContext FromCancellationToken(CancellationToken cancellationToken = default) +{ + if (!cancellationToken.CanBeCanceled) + { + return DefaultRequestContext; + } + + return new Azure.RequestContext() { CancellationToken = cancellationToken }; +} + +private static ResponseClassifier _responseClassifier200; +private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); +private static ResponseClassifier _responseClassifier204; +private static ResponseClassifier ResponseClassifier204 => _responseClassifier204 ??= new StatusCodeClassifier(stackalloc ushort[] { 204 }); +private static ResponseClassifier _responseClassifier200201; +private static ResponseClassifier ResponseClassifier200201 => _responseClassifier200201 ??= new StatusCodeClassifier(stackalloc ushort[] { 200, 201 }); +} +} diff --git a/sdk/ai/Azure.AI.Projects.1DP/src/Generated/Docs/Connections.xml b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/Docs/Connections.xml new file mode 100644 index 000000000000..a27f30ed7a64 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/Docs/Connections.xml @@ -0,0 +1,225 @@ + + + + + +This sample shows how to call GetConnectionAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Connections client = new Projects.1DP.AIProjectClient(endpoint, credential).GetConnectionsClient(apiVersion: "2025-05-15-preview"); + +Azure.Response < AI.Projects.1DP.Connection > response = await client.GetConnectionAsync(""); +]]> +This sample shows how to call GetConnectionAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Connections client = new Projects.1DP.AIProjectClient(endpoint, credential).GetConnectionsClient(apiVersion: "2025-05-15-preview"); + +Azure.Response < AI.Projects.1DP.Connection > response = await client.GetConnectionAsync(""); +]]> + + + +This sample shows how to call GetConnection. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Connections client = new Projects.1DP.AIProjectClient(endpoint, credential).GetConnectionsClient(apiVersion: "2025-05-15-preview"); + +Azure.Response < AI.Projects.1DP.Connection > response = client.GetConnection(""); +]]> +This sample shows how to call GetConnection with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Connections client = new Projects.1DP.AIProjectClient(endpoint, credential).GetConnectionsClient(apiVersion: "2025-05-15-preview"); + +Azure.Response < AI.Projects.1DP.Connection > response = client.GetConnection(""); +]]> + + + +This sample shows how to call GetConnectionAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Connections client = new Projects.1DP.AIProjectClient(endpoint, credential).GetConnectionsClient(apiVersion: "2025-05-15-preview"); + +Response response = await client.GetConnectionAsync("", (RequestContext)null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("authType").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> +This sample shows how to call GetConnectionAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Connections client = new Projects.1DP.AIProjectClient(endpoint, credential).GetConnectionsClient(apiVersion: "2025-05-15-preview"); + +Response response = await client.GetConnectionAsync("", (RequestContext)null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("authType").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call GetConnection and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Connections client = new Projects.1DP.AIProjectClient(endpoint, credential).GetConnectionsClient(apiVersion: "2025-05-15-preview"); + +Response response = client.GetConnection("", (RequestContext)null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("authType").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> +This sample shows how to call GetConnection with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Connections client = new Projects.1DP.AIProjectClient(endpoint, credential).GetConnectionsClient(apiVersion: "2025-05-15-preview"); + +Response response = client.GetConnection("", (RequestContext)null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("authType").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call GetConnectionsAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Connections client = new Projects.1DP.AIProjectClient(endpoint, credential).GetConnectionsClient(apiVersion: "2025-05-15-preview"); + +await foreach (Projects.1DP.Connection item in client.GetConnectionsAsync()) +{ +} +]]> +This sample shows how to call GetConnectionsAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Connections client = new Projects.1DP.AIProjectClient(endpoint, credential).GetConnectionsClient(apiVersion: "2025-05-15-preview"); + +await foreach (Projects.1DP.Connection item in client.GetConnectionsAsync(connectionType: AI.Projects.1DP.ConnectionType.AzureOpenAI, maxCount: 1234, skip: 1234, maxpagesize: 1234)) +{ +} +]]> + + + +This sample shows how to call GetConnections. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Connections client = new Projects.1DP.AIProjectClient(endpoint, credential).GetConnectionsClient(apiVersion: "2025-05-15-preview"); + +foreach (Projects.1DP.Connection item in client.GetConnections()) +{ +} +]]> +This sample shows how to call GetConnections with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Connections client = new Projects.1DP.AIProjectClient(endpoint, credential).GetConnectionsClient(apiVersion: "2025-05-15-preview"); + +foreach (Projects.1DP.Connection item in client.GetConnections(connectionType: AI.Projects.1DP.ConnectionType.AzureOpenAI, maxCount: 1234, skip: 1234, maxpagesize: 1234)) +{ +} +]]> + + + +This sample shows how to call GetConnectionsAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Connections client = new Projects.1DP.AIProjectClient(endpoint, credential).GetConnectionsClient(apiVersion: "2025-05-15-preview"); + +await foreach (BinaryData item in client.GetConnectionsAsync((string)null, (int?)null, (int?)null, (int?)null, (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("authType").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +} +]]> +This sample shows how to call GetConnectionsAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Connections client = new Projects.1DP.AIProjectClient(endpoint, credential).GetConnectionsClient(apiVersion: "2025-05-15-preview"); + +await foreach (BinaryData item in client.GetConnectionsAsync("AzureOpenAI", 1234, 1234, 1234, (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("authType").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +} +]]> + + + +This sample shows how to call GetConnections and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Connections client = new Projects.1DP.AIProjectClient(endpoint, credential).GetConnectionsClient(apiVersion: "2025-05-15-preview"); + +foreach (BinaryData item in client.GetConnections((string)null, (int?)null, (int?)null, (int?)null, (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("authType").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +} +]]> +This sample shows how to call GetConnections with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Connections client = new Projects.1DP.AIProjectClient(endpoint, credential).GetConnectionsClient(apiVersion: "2025-05-15-preview"); + +foreach (BinaryData item in client.GetConnections("AzureOpenAI", 1234, 1234, 1234, (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("authType").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +} +]]> + + + \ No newline at end of file diff --git a/sdk/ai/Azure.AI.Projects.1DP/src/Generated/Docs/Datasets.xml b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/Docs/Datasets.xml new file mode 100644 index 000000000000..545d6114756c --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/Docs/Datasets.xml @@ -0,0 +1,1029 @@ + + + + + +This sample shows how to call GetVersionAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +Azure.Response < AI.Projects.1DP.DatasetVersion > response = await client.GetVersionAsync("", ""); +]]> +This sample shows how to call GetVersionAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +Azure.Response < AI.Projects.1DP.DatasetVersion > response = await client.GetVersionAsync("", ""); +]]> + + + +This sample shows how to call GetVersion. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +Azure.Response < AI.Projects.1DP.DatasetVersion > response = client.GetVersion("", ""); +]]> +This sample shows how to call GetVersion with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +Azure.Response < AI.Projects.1DP.DatasetVersion > response = client.GetVersion("", ""); +]]> + + + +This sample shows how to call GetVersionAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +Response response = await client.GetVersionAsync("", "", (RequestContext)null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("datasetUri").ToString()); +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +]]> +This sample shows how to call GetVersionAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +Response response = await client.GetVersionAsync("", "", (RequestContext)null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("datasetUri").ToString()); +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("isReference").ToString()); +Console.WriteLine(result.GetProperty("stage").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +]]> + + + +This sample shows how to call GetVersion and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +Response response = client.GetVersion("", "", (RequestContext)null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("datasetUri").ToString()); +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +]]> +This sample shows how to call GetVersion with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +Response response = client.GetVersion("", "", (RequestContext)null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("datasetUri").ToString()); +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("isReference").ToString()); +Console.WriteLine(result.GetProperty("stage").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +]]> + + + +This sample shows how to call DeleteVersionAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +Response response = await client.DeleteVersionAsync("", ""); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call DeleteVersionAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +Response response = await client.DeleteVersionAsync("", ""); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call DeleteVersion. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +Response response = client.DeleteVersion("", ""); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call DeleteVersion with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +Response response = client.DeleteVersion("", ""); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call CreateAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.DatasetVersion body = new Projects.1DP.FileDatasetVersion("", ""); +Azure.Response < AI.Projects.1DP.DatasetVersion > response = await client.CreateAsync("", body); +]]> +This sample shows how to call CreateAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.DatasetVersion body = new Projects.1DP.FileDatasetVersion("", "") +{ + Stage = "", + Description = "", + Tags = + { + ["key"] = "" + }, +}; +Azure.Response < AI.Projects.1DP.DatasetVersion > response = await client.CreateAsync("", body); +]]> + + + +This sample shows how to call Create. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.DatasetVersion body = new Projects.1DP.FileDatasetVersion("", ""); +Azure.Response < AI.Projects.1DP.DatasetVersion > response = client.Create("", body); +]]> +This sample shows how to call Create with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.DatasetVersion body = new Projects.1DP.FileDatasetVersion("", "") +{ + Stage = "", + Description = "", + Tags = + { + ["key"] = "" + }, +}; +Azure.Response < AI.Projects.1DP.DatasetVersion > response = client.Create("", body); +]]> + + + +This sample shows how to call CreateAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + type = "uri_file", + openAIPurpose = "", + datasetUri = "", +}); +Response response = await client.CreateAsync("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("datasetUri").ToString()); +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +]]> +This sample shows how to call CreateAsync with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + type = "uri_file", + openAIPurpose = "", + datasetUri = "", + stage = "", + description = "", + tags = new + { + key = "", + }, +}); +Response response = await client.CreateAsync("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("datasetUri").ToString()); +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("isReference").ToString()); +Console.WriteLine(result.GetProperty("stage").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +]]> + + + +This sample shows how to call Create and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + type = "uri_file", + openAIPurpose = "", + datasetUri = "", +}); +Response response = client.Create("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("datasetUri").ToString()); +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +]]> +This sample shows how to call Create with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + type = "uri_file", + openAIPurpose = "", + datasetUri = "", + stage = "", + description = "", + tags = new + { + key = "", + }, +}); +Response response = client.Create("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("datasetUri").ToString()); +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("isReference").ToString()); +Console.WriteLine(result.GetProperty("stage").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +]]> + + + +This sample shows how to call CreateVersionAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.DatasetVersion body = new Projects.1DP.FileDatasetVersion("", ""); +Azure.Response < AI.Projects.1DP.DatasetVersion > response = await client.CreateVersionAsync("", "", body); +]]> +This sample shows how to call CreateVersionAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.DatasetVersion body = new Projects.1DP.FileDatasetVersion("", "") +{ + Stage = "", + Description = "", + Tags = + { + ["key"] = "" + }, +}; +Azure.Response < AI.Projects.1DP.DatasetVersion > response = await client.CreateVersionAsync("", "", body); +]]> + + + +This sample shows how to call CreateVersion. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.DatasetVersion body = new Projects.1DP.FileDatasetVersion("", ""); +Azure.Response < AI.Projects.1DP.DatasetVersion > response = client.CreateVersion("", "", body); +]]> +This sample shows how to call CreateVersion with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.DatasetVersion body = new Projects.1DP.FileDatasetVersion("", "") +{ + Stage = "", + Description = "", + Tags = + { + ["key"] = "" + }, +}; +Azure.Response < AI.Projects.1DP.DatasetVersion > response = client.CreateVersion("", "", body); +]]> + + + +This sample shows how to call CreateVersionAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + type = "uri_file", + openAIPurpose = "", + datasetUri = "", +}); +Response response = await client.CreateVersionAsync("", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("datasetUri").ToString()); +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +]]> +This sample shows how to call CreateVersionAsync with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + type = "uri_file", + openAIPurpose = "", + datasetUri = "", + stage = "", + description = "", + tags = new + { + key = "", + }, +}); +Response response = await client.CreateVersionAsync("", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("datasetUri").ToString()); +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("isReference").ToString()); +Console.WriteLine(result.GetProperty("stage").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +]]> + + + +This sample shows how to call CreateVersion and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + type = "uri_file", + openAIPurpose = "", + datasetUri = "", +}); +Response response = client.CreateVersion("", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("datasetUri").ToString()); +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +]]> +This sample shows how to call CreateVersion with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + type = "uri_file", + openAIPurpose = "", + datasetUri = "", + stage = "", + description = "", + tags = new + { + key = "", + }, +}); +Response response = client.CreateVersion("", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("datasetUri").ToString()); +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("isReference").ToString()); +Console.WriteLine(result.GetProperty("stage").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +]]> + + + +This sample shows how to call StartPendingUploadVersionAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.PendingUploadRequest body = new Projects.1DP.PendingUploadRequest(); +Azure.Response < AI.Projects.1DP.PendingUploadResponse > response = await client.StartPendingUploadVersionAsync("", "", body); +]]> +This sample shows how to call StartPendingUploadVersionAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.PendingUploadRequest body = new Projects.1DP.PendingUploadRequest +{ + PendingUploadId = "", + ConnectionName = "", +}; +Azure.Response < AI.Projects.1DP.PendingUploadResponse > response = await client.StartPendingUploadVersionAsync("", "", body); +]]> + + + +This sample shows how to call StartPendingUploadVersion. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.PendingUploadRequest body = new Projects.1DP.PendingUploadRequest(); +Azure.Response < AI.Projects.1DP.PendingUploadResponse > response = client.StartPendingUploadVersion("", "", body); +]]> +This sample shows how to call StartPendingUploadVersion with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.PendingUploadRequest body = new Projects.1DP.PendingUploadRequest +{ + PendingUploadId = "", + ConnectionName = "", +}; +Azure.Response < AI.Projects.1DP.PendingUploadResponse > response = client.StartPendingUploadVersion("", "", body); +]]> + + + +This sample shows how to call StartPendingUploadVersionAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + pendingUploadType = "TemporaryBlobReference", +}); +Response response = await client.StartPendingUploadVersionAsync("", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("blobUri").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("storageAccountArmId").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("sasToken").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("pendingUploadId").ToString()); +Console.WriteLine(result.GetProperty("pendingUploadType").ToString()); +]]> +This sample shows how to call StartPendingUploadVersionAsync with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + pendingUploadId = "", + connectionName = "", + pendingUploadType = "TemporaryBlobReference", +}); +Response response = await client.StartPendingUploadVersionAsync("", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("blobUri").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("storageAccountArmId").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("sasToken").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("pendingUploadId").ToString()); +Console.WriteLine(result.GetProperty("datasetVersion").ToString()); +Console.WriteLine(result.GetProperty("pendingUploadType").ToString()); +]]> + + + +This sample shows how to call StartPendingUploadVersion and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + pendingUploadType = "TemporaryBlobReference", +}); +Response response = client.StartPendingUploadVersion("", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("blobUri").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("storageAccountArmId").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("sasToken").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("pendingUploadId").ToString()); +Console.WriteLine(result.GetProperty("pendingUploadType").ToString()); +]]> +This sample shows how to call StartPendingUploadVersion with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + pendingUploadId = "", + connectionName = "", + pendingUploadType = "TemporaryBlobReference", +}); +Response response = client.StartPendingUploadVersion("", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("blobUri").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("storageAccountArmId").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("sasToken").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("pendingUploadId").ToString()); +Console.WriteLine(result.GetProperty("datasetVersion").ToString()); +Console.WriteLine(result.GetProperty("pendingUploadType").ToString()); +]]> + + + +This sample shows how to call StartPendingUploadAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.PendingUploadRequest body = new Projects.1DP.PendingUploadRequest(); +Azure.Response < AI.Projects.1DP.PendingUploadResponse > response = await client.StartPendingUploadAsync("", body); +]]> +This sample shows how to call StartPendingUploadAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.PendingUploadRequest body = new Projects.1DP.PendingUploadRequest +{ + PendingUploadId = "", + ConnectionName = "", +}; +Azure.Response < AI.Projects.1DP.PendingUploadResponse > response = await client.StartPendingUploadAsync("", body); +]]> + + + +This sample shows how to call StartPendingUpload. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.PendingUploadRequest body = new Projects.1DP.PendingUploadRequest(); +Azure.Response < AI.Projects.1DP.PendingUploadResponse > response = client.StartPendingUpload("", body); +]]> +This sample shows how to call StartPendingUpload with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.PendingUploadRequest body = new Projects.1DP.PendingUploadRequest +{ + PendingUploadId = "", + ConnectionName = "", +}; +Azure.Response < AI.Projects.1DP.PendingUploadResponse > response = client.StartPendingUpload("", body); +]]> + + + +This sample shows how to call StartPendingUploadAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + pendingUploadType = "TemporaryBlobReference", +}); +Response response = await client.StartPendingUploadAsync("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("blobUri").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("storageAccountArmId").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("sasToken").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("pendingUploadId").ToString()); +Console.WriteLine(result.GetProperty("pendingUploadType").ToString()); +]]> +This sample shows how to call StartPendingUploadAsync with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + pendingUploadId = "", + connectionName = "", + pendingUploadType = "TemporaryBlobReference", +}); +Response response = await client.StartPendingUploadAsync("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("blobUri").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("storageAccountArmId").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("sasToken").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("pendingUploadId").ToString()); +Console.WriteLine(result.GetProperty("datasetVersion").ToString()); +Console.WriteLine(result.GetProperty("pendingUploadType").ToString()); +]]> + + + +This sample shows how to call StartPendingUpload and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + pendingUploadType = "TemporaryBlobReference", +}); +Response response = client.StartPendingUpload("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("blobUri").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("storageAccountArmId").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("sasToken").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("pendingUploadId").ToString()); +Console.WriteLine(result.GetProperty("pendingUploadType").ToString()); +]]> +This sample shows how to call StartPendingUpload with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + pendingUploadId = "", + connectionName = "", + pendingUploadType = "TemporaryBlobReference", +}); +Response response = client.StartPendingUpload("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("blobUri").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("storageAccountArmId").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("sasToken").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("pendingUploadId").ToString()); +Console.WriteLine(result.GetProperty("datasetVersion").ToString()); +Console.WriteLine(result.GetProperty("pendingUploadType").ToString()); +]]> + + + +This sample shows how to call GetVersionsAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +await foreach (Projects.1DP.DatasetVersion item in client.GetVersionsAsync("")) +{ +} +]]> +This sample shows how to call GetVersionsAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +await foreach (Projects.1DP.DatasetVersion item in client.GetVersionsAsync("", maxCount: 1234, skip: "", tags: "", listViewType: AI.Projects.1DP.ListViewType.ActiveOnly)) +{ +} +]]> + + + +This sample shows how to call GetVersions. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +foreach (Projects.1DP.DatasetVersion item in client.GetVersions("")) +{ +} +]]> +This sample shows how to call GetVersions with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +foreach (Projects.1DP.DatasetVersion item in client.GetVersions("", maxCount: 1234, skip: "", tags: "", listViewType: AI.Projects.1DP.ListViewType.ActiveOnly)) +{ +} +]]> + + + +This sample shows how to call GetVersionsAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +await foreach (BinaryData item in client.GetVersionsAsync("", (int?)null, (string)null, (string)null, (string)null, (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("datasetUri").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); +} +]]> +This sample shows how to call GetVersionsAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +await foreach (BinaryData item in client.GetVersionsAsync("", 1234, "", "", "ActiveOnly", (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("datasetUri").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("isReference").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +} +]]> + + + +This sample shows how to call GetVersions and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +foreach (BinaryData item in client.GetVersions("", (int?)null, (string)null, (string)null, (string)null, (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("datasetUri").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); +} +]]> +This sample shows how to call GetVersions with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +foreach (BinaryData item in client.GetVersions("", 1234, "", "", "ActiveOnly", (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("datasetUri").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("isReference").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +} +]]> + + + +This sample shows how to call GetLatestsAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +await foreach (Projects.1DP.DatasetVersion item in client.GetLatestsAsync()) +{ +} +]]> +This sample shows how to call GetLatestsAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +await foreach (Projects.1DP.DatasetVersion item in client.GetLatestsAsync(maxCount: 1234, skip: "", tags: "", listViewType: AI.Projects.1DP.ListViewType.ActiveOnly)) +{ +} +]]> + + + +This sample shows how to call GetLatests. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +foreach (Projects.1DP.DatasetVersion item in client.GetLatests()) +{ +} +]]> +This sample shows how to call GetLatests with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +foreach (Projects.1DP.DatasetVersion item in client.GetLatests(maxCount: 1234, skip: "", tags: "", listViewType: AI.Projects.1DP.ListViewType.ActiveOnly)) +{ +} +]]> + + + +This sample shows how to call GetLatestsAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +await foreach (BinaryData item in client.GetLatestsAsync((int?)null, (string)null, (string)null, (string)null, (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("datasetUri").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); +} +]]> +This sample shows how to call GetLatestsAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +await foreach (BinaryData item in client.GetLatestsAsync(1234, "", "", "ActiveOnly", (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("datasetUri").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("isReference").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +} +]]> + + + +This sample shows how to call GetLatests and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +foreach (BinaryData item in client.GetLatests((int?)null, (string)null, (string)null, (string)null, (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("datasetUri").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); +} +]]> +This sample shows how to call GetLatests with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + +foreach (BinaryData item in client.GetLatests(1234, "", "", "ActiveOnly", (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("datasetUri").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("isReference").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +} +]]> + + + \ No newline at end of file diff --git a/sdk/ai/Azure.AI.Projects.1DP/src/Generated/Docs/Deployments.xml b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/Docs/Deployments.xml new file mode 100644 index 000000000000..94c8a4018a79 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/Docs/Deployments.xml @@ -0,0 +1,201 @@ + + + + + +This sample shows how to call GetDeploymentAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Deployments client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDeploymentsClient(apiVersion: "2025-05-15-preview"); + +Azure.Response < AI.Projects.1DP.Deployment > response = await client.GetDeploymentAsync(""); +]]> +This sample shows how to call GetDeploymentAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Deployments client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDeploymentsClient(apiVersion: "2025-05-15-preview"); + +Azure.Response < AI.Projects.1DP.Deployment > response = await client.GetDeploymentAsync(""); +]]> + + + +This sample shows how to call GetDeployment. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Deployments client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDeploymentsClient(apiVersion: "2025-05-15-preview"); + +Azure.Response < AI.Projects.1DP.Deployment > response = client.GetDeployment(""); +]]> +This sample shows how to call GetDeployment with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Deployments client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDeploymentsClient(apiVersion: "2025-05-15-preview"); + +Azure.Response < AI.Projects.1DP.Deployment > response = client.GetDeployment(""); +]]> + + + +This sample shows how to call GetDeploymentAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Deployments client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDeploymentsClient(apiVersion: "2025-05-15-preview"); + +Response response = await client.GetDeploymentAsync("", (RequestContext)null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +]]> +This sample shows how to call GetDeploymentAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Deployments client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDeploymentsClient(apiVersion: "2025-05-15-preview"); + +Response response = await client.GetDeploymentAsync("", (RequestContext)null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +]]> + + + +This sample shows how to call GetDeployment and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Deployments client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDeploymentsClient(apiVersion: "2025-05-15-preview"); + +Response response = client.GetDeployment("", (RequestContext)null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +]]> +This sample shows how to call GetDeployment with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Deployments client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDeploymentsClient(apiVersion: "2025-05-15-preview"); + +Response response = client.GetDeployment("", (RequestContext)null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +]]> + + + +This sample shows how to call GetDeploymentsAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Deployments client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDeploymentsClient(apiVersion: "2025-05-15-preview"); + +await foreach (Projects.1DP.Deployment item in client.GetDeploymentsAsync()) +{ +} +]]> +This sample shows how to call GetDeploymentsAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Deployments client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDeploymentsClient(apiVersion: "2025-05-15-preview"); + +await foreach (Projects.1DP.Deployment item in client.GetDeploymentsAsync(modelPublisher: "", modelName: "", maxCount: 1234, skip: 1234, maxpagesize: 1234)) +{ +} +]]> + + + +This sample shows how to call GetDeployments. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Deployments client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDeploymentsClient(apiVersion: "2025-05-15-preview"); + +foreach (Projects.1DP.Deployment item in client.GetDeployments()) +{ +} +]]> +This sample shows how to call GetDeployments with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Deployments client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDeploymentsClient(apiVersion: "2025-05-15-preview"); + +foreach (Projects.1DP.Deployment item in client.GetDeployments(modelPublisher: "", modelName: "", maxCount: 1234, skip: 1234, maxpagesize: 1234)) +{ +} +]]> + + + +This sample shows how to call GetDeploymentsAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Deployments client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDeploymentsClient(apiVersion: "2025-05-15-preview"); + +await foreach (BinaryData item in client.GetDeploymentsAsync((string)null, (string)null, (int?)null, (int?)null, (int?)null, (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); +} +]]> +This sample shows how to call GetDeploymentsAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Deployments client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDeploymentsClient(apiVersion: "2025-05-15-preview"); + +await foreach (BinaryData item in client.GetDeploymentsAsync("", "", 1234, 1234, 1234, (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); +} +]]> + + + +This sample shows how to call GetDeployments and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Deployments client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDeploymentsClient(apiVersion: "2025-05-15-preview"); + +foreach (BinaryData item in client.GetDeployments((string)null, (string)null, (int?)null, (int?)null, (int?)null, (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); +} +]]> +This sample shows how to call GetDeployments with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Deployments client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDeploymentsClient(apiVersion: "2025-05-15-preview"); + +foreach (BinaryData item in client.GetDeployments("", "", 1234, 1234, 1234, (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); +} +]]> + + + \ No newline at end of file diff --git a/sdk/ai/Azure.AI.Projects.1DP/src/Generated/Docs/EvaluationResults.xml b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/Docs/EvaluationResults.xml new file mode 100644 index 000000000000..8ba786cf4ec7 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/Docs/EvaluationResults.xml @@ -0,0 +1,969 @@ + + + + + +This sample shows how to call GetVersionAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +Azure.Response < AI.Projects.1DP.EvaluationResult > response = await client.GetVersionAsync("", ""); +]]> +This sample shows how to call GetVersionAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +Azure.Response < AI.Projects.1DP.EvaluationResult > response = await client.GetVersionAsync("", ""); +]]> + + + +This sample shows how to call GetVersion. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +Azure.Response < AI.Projects.1DP.EvaluationResult > response = client.GetVersion("", ""); +]]> +This sample shows how to call GetVersion with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +Azure.Response < AI.Projects.1DP.EvaluationResult > response = client.GetVersion("", ""); +]]> + + + +This sample shows how to call GetVersionAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +Response response = await client.GetVersionAsync("", "", (RequestContext)null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +]]> +This sample shows how to call GetVersionAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +Response response = await client.GetVersionAsync("", "", (RequestContext)null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("ResultType").ToString()); +Console.WriteLine(result.GetProperty("ModelName").ToString()); +Console.WriteLine(result.GetProperty("ModelVersion").ToString()); +Console.WriteLine(result.GetProperty("ModelAssetId").ToString()); +Console.WriteLine(result.GetProperty("DatasetFamily").ToString()); +Console.WriteLine(result.GetProperty("DatasetName").ToString()); +Console.WriteLine(result.GetProperty("Metrics").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("BlobUri").ToString()); +Console.WriteLine(result.GetProperty("stage").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +]]> + + + +This sample shows how to call GetVersion and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +Response response = client.GetVersion("", "", (RequestContext)null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +]]> +This sample shows how to call GetVersion with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +Response response = client.GetVersion("", "", (RequestContext)null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("ResultType").ToString()); +Console.WriteLine(result.GetProperty("ModelName").ToString()); +Console.WriteLine(result.GetProperty("ModelVersion").ToString()); +Console.WriteLine(result.GetProperty("ModelAssetId").ToString()); +Console.WriteLine(result.GetProperty("DatasetFamily").ToString()); +Console.WriteLine(result.GetProperty("DatasetName").ToString()); +Console.WriteLine(result.GetProperty("Metrics").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("BlobUri").ToString()); +Console.WriteLine(result.GetProperty("stage").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +]]> + + + +This sample shows how to call DeleteVersionAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +Response response = await client.DeleteVersionAsync("", ""); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call DeleteVersionAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +Response response = await client.DeleteVersionAsync("", ""); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call DeleteVersion. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +Response response = client.DeleteVersion("", ""); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call DeleteVersion with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +Response response = client.DeleteVersion("", ""); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call CreateAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.EvaluationResult body = new Projects.1DP.EvaluationResult(); +Azure.Response < AI.Projects.1DP.EvaluationResult > response = await client.CreateAsync("", body); +]]> +This sample shows how to call CreateAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.EvaluationResult body = new Projects.1DP.EvaluationResult +{ + ResultType = AI.Projects.1DP.ResultType.Benchmark, + ModelName = "", + ModelVersion = "", + ModelAssetId = "", + DatasetFamily = "", + DatasetName = "", + Metrics = + { + ["key"] = 123.45 + }, + BlobUri = "", + Stage = "", + Description = "", + Tags = + { + ["key"] = "" + }, +}; +Azure.Response < AI.Projects.1DP.EvaluationResult > response = await client.CreateAsync("", body); +]]> + + + +This sample shows how to call Create. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.EvaluationResult body = new Projects.1DP.EvaluationResult(); +Azure.Response < AI.Projects.1DP.EvaluationResult > response = client.Create("", body); +]]> +This sample shows how to call Create with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.EvaluationResult body = new Projects.1DP.EvaluationResult +{ + ResultType = AI.Projects.1DP.ResultType.Benchmark, + ModelName = "", + ModelVersion = "", + ModelAssetId = "", + DatasetFamily = "", + DatasetName = "", + Metrics = + { + ["key"] = 123.45 + }, + BlobUri = "", + Stage = "", + Description = "", + Tags = + { + ["key"] = "" + }, +}; +Azure.Response < AI.Projects.1DP.EvaluationResult > response = client.Create("", body); +]]> + + + +This sample shows how to call CreateAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new object()); +Response response = await client.CreateAsync("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +]]> +This sample shows how to call CreateAsync with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + ResultType = "Benchmark", + ModelName = "", + ModelVersion = "", + ModelAssetId = "", + DatasetFamily = "", + DatasetName = "", + Metrics = new + { + key = 123.45, + }, + BlobUri = "", + stage = "", + description = "", + tags = new + { + key = "", + }, +}); +Response response = await client.CreateAsync("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("ResultType").ToString()); +Console.WriteLine(result.GetProperty("ModelName").ToString()); +Console.WriteLine(result.GetProperty("ModelVersion").ToString()); +Console.WriteLine(result.GetProperty("ModelAssetId").ToString()); +Console.WriteLine(result.GetProperty("DatasetFamily").ToString()); +Console.WriteLine(result.GetProperty("DatasetName").ToString()); +Console.WriteLine(result.GetProperty("Metrics").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("BlobUri").ToString()); +Console.WriteLine(result.GetProperty("stage").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +]]> + + + +This sample shows how to call Create and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new object()); +Response response = client.Create("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +]]> +This sample shows how to call Create with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + ResultType = "Benchmark", + ModelName = "", + ModelVersion = "", + ModelAssetId = "", + DatasetFamily = "", + DatasetName = "", + Metrics = new + { + key = 123.45, + }, + BlobUri = "", + stage = "", + description = "", + tags = new + { + key = "", + }, +}); +Response response = client.Create("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("ResultType").ToString()); +Console.WriteLine(result.GetProperty("ModelName").ToString()); +Console.WriteLine(result.GetProperty("ModelVersion").ToString()); +Console.WriteLine(result.GetProperty("ModelAssetId").ToString()); +Console.WriteLine(result.GetProperty("DatasetFamily").ToString()); +Console.WriteLine(result.GetProperty("DatasetName").ToString()); +Console.WriteLine(result.GetProperty("Metrics").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("BlobUri").ToString()); +Console.WriteLine(result.GetProperty("stage").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +]]> + + + +This sample shows how to call CreateVersionAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.EvaluationResult body = new Projects.1DP.EvaluationResult(); +Azure.Response < AI.Projects.1DP.EvaluationResult > response = await client.CreateVersionAsync("", "", body); +]]> +This sample shows how to call CreateVersionAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.EvaluationResult body = new Projects.1DP.EvaluationResult +{ + ResultType = AI.Projects.1DP.ResultType.Benchmark, + ModelName = "", + ModelVersion = "", + ModelAssetId = "", + DatasetFamily = "", + DatasetName = "", + Metrics = + { + ["key"] = 123.45 + }, + BlobUri = "", + Stage = "", + Description = "", + Tags = + { + ["key"] = "" + }, +}; +Azure.Response < AI.Projects.1DP.EvaluationResult > response = await client.CreateVersionAsync("", "", body); +]]> + + + +This sample shows how to call CreateVersion. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.EvaluationResult body = new Projects.1DP.EvaluationResult(); +Azure.Response < AI.Projects.1DP.EvaluationResult > response = client.CreateVersion("", "", body); +]]> +This sample shows how to call CreateVersion with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.EvaluationResult body = new Projects.1DP.EvaluationResult +{ + ResultType = AI.Projects.1DP.ResultType.Benchmark, + ModelName = "", + ModelVersion = "", + ModelAssetId = "", + DatasetFamily = "", + DatasetName = "", + Metrics = + { + ["key"] = 123.45 + }, + BlobUri = "", + Stage = "", + Description = "", + Tags = + { + ["key"] = "" + }, +}; +Azure.Response < AI.Projects.1DP.EvaluationResult > response = client.CreateVersion("", "", body); +]]> + + + +This sample shows how to call CreateVersionAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new object()); +Response response = await client.CreateVersionAsync("", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +]]> +This sample shows how to call CreateVersionAsync with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + ResultType = "Benchmark", + ModelName = "", + ModelVersion = "", + ModelAssetId = "", + DatasetFamily = "", + DatasetName = "", + Metrics = new + { + key = 123.45, + }, + BlobUri = "", + stage = "", + description = "", + tags = new + { + key = "", + }, +}); +Response response = await client.CreateVersionAsync("", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("ResultType").ToString()); +Console.WriteLine(result.GetProperty("ModelName").ToString()); +Console.WriteLine(result.GetProperty("ModelVersion").ToString()); +Console.WriteLine(result.GetProperty("ModelAssetId").ToString()); +Console.WriteLine(result.GetProperty("DatasetFamily").ToString()); +Console.WriteLine(result.GetProperty("DatasetName").ToString()); +Console.WriteLine(result.GetProperty("Metrics").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("BlobUri").ToString()); +Console.WriteLine(result.GetProperty("stage").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +]]> + + + +This sample shows how to call CreateVersion and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new object()); +Response response = client.CreateVersion("", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +]]> +This sample shows how to call CreateVersion with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + ResultType = "Benchmark", + ModelName = "", + ModelVersion = "", + ModelAssetId = "", + DatasetFamily = "", + DatasetName = "", + Metrics = new + { + key = 123.45, + }, + BlobUri = "", + stage = "", + description = "", + tags = new + { + key = "", + }, +}); +Response response = client.CreateVersion("", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("ResultType").ToString()); +Console.WriteLine(result.GetProperty("ModelName").ToString()); +Console.WriteLine(result.GetProperty("ModelVersion").ToString()); +Console.WriteLine(result.GetProperty("ModelAssetId").ToString()); +Console.WriteLine(result.GetProperty("DatasetFamily").ToString()); +Console.WriteLine(result.GetProperty("DatasetName").ToString()); +Console.WriteLine(result.GetProperty("Metrics").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("BlobUri").ToString()); +Console.WriteLine(result.GetProperty("stage").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +]]> + + + +This sample shows how to call StartPendingUploadAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.PendingUploadRequest body = new Projects.1DP.PendingUploadRequest(); +Azure.Response < AI.Projects.1DP.PendingUploadResponse > response = await client.StartPendingUploadAsync("", "", body); +]]> +This sample shows how to call StartPendingUploadAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.PendingUploadRequest body = new Projects.1DP.PendingUploadRequest +{ + PendingUploadId = "", + ConnectionName = "", +}; +Azure.Response < AI.Projects.1DP.PendingUploadResponse > response = await client.StartPendingUploadAsync("", "", body); +]]> + + + +This sample shows how to call StartPendingUpload. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.PendingUploadRequest body = new Projects.1DP.PendingUploadRequest(); +Azure.Response < AI.Projects.1DP.PendingUploadResponse > response = client.StartPendingUpload("", "", body); +]]> +This sample shows how to call StartPendingUpload with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.PendingUploadRequest body = new Projects.1DP.PendingUploadRequest +{ + PendingUploadId = "", + ConnectionName = "", +}; +Azure.Response < AI.Projects.1DP.PendingUploadResponse > response = client.StartPendingUpload("", "", body); +]]> + + + +This sample shows how to call StartPendingUploadAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + pendingUploadType = "TemporaryBlobReference", +}); +Response response = await client.StartPendingUploadAsync("", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("blobUri").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("storageAccountArmId").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("sasToken").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("pendingUploadId").ToString()); +Console.WriteLine(result.GetProperty("pendingUploadType").ToString()); +]]> +This sample shows how to call StartPendingUploadAsync with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + pendingUploadId = "", + connectionName = "", + pendingUploadType = "TemporaryBlobReference", +}); +Response response = await client.StartPendingUploadAsync("", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("blobUri").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("storageAccountArmId").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("sasToken").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("pendingUploadId").ToString()); +Console.WriteLine(result.GetProperty("datasetVersion").ToString()); +Console.WriteLine(result.GetProperty("pendingUploadType").ToString()); +]]> + + + +This sample shows how to call StartPendingUpload and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + pendingUploadType = "TemporaryBlobReference", +}); +Response response = client.StartPendingUpload("", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("blobUri").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("storageAccountArmId").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("sasToken").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("pendingUploadId").ToString()); +Console.WriteLine(result.GetProperty("pendingUploadType").ToString()); +]]> +This sample shows how to call StartPendingUpload with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + pendingUploadId = "", + connectionName = "", + pendingUploadType = "TemporaryBlobReference", +}); +Response response = client.StartPendingUpload("", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("blobUri").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("storageAccountArmId").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("sasToken").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("pendingUploadId").ToString()); +Console.WriteLine(result.GetProperty("datasetVersion").ToString()); +Console.WriteLine(result.GetProperty("pendingUploadType").ToString()); +]]> + + + +This sample shows how to call GetVersionsAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +await foreach (Projects.1DP.EvaluationResult item in client.GetVersionsAsync("")) +{ +} +]]> +This sample shows how to call GetVersionsAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +await foreach (Projects.1DP.EvaluationResult item in client.GetVersionsAsync("", maxCount: 1234, skip: "", tags: "", listViewType: AI.Projects.1DP.ListViewType.ActiveOnly)) +{ +} +]]> + + + +This sample shows how to call GetVersions. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +foreach (Projects.1DP.EvaluationResult item in client.GetVersions("")) +{ +} +]]> +This sample shows how to call GetVersions with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +foreach (Projects.1DP.EvaluationResult item in client.GetVersions("", maxCount: 1234, skip: "", tags: "", listViewType: AI.Projects.1DP.ListViewType.ActiveOnly)) +{ +} +]]> + + + +This sample shows how to call GetVersionsAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +await foreach (BinaryData item in client.GetVersionsAsync("", (int?)null, (string)null, (string)null, (string)null, (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); +} +]]> +This sample shows how to call GetVersionsAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +await foreach (BinaryData item in client.GetVersionsAsync("", 1234, "", "", "ActiveOnly", (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("ResultType").ToString()); + Console.WriteLine(result.GetProperty("ModelName").ToString()); + Console.WriteLine(result.GetProperty("ModelVersion").ToString()); + Console.WriteLine(result.GetProperty("ModelAssetId").ToString()); + Console.WriteLine(result.GetProperty("DatasetFamily").ToString()); + Console.WriteLine(result.GetProperty("DatasetName").ToString()); + Console.WriteLine(result.GetProperty("Metrics").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("BlobUri").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +} +]]> + + + +This sample shows how to call GetVersions and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +foreach (BinaryData item in client.GetVersions("", (int?)null, (string)null, (string)null, (string)null, (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); +} +]]> +This sample shows how to call GetVersions with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +foreach (BinaryData item in client.GetVersions("", 1234, "", "", "ActiveOnly", (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("ResultType").ToString()); + Console.WriteLine(result.GetProperty("ModelName").ToString()); + Console.WriteLine(result.GetProperty("ModelVersion").ToString()); + Console.WriteLine(result.GetProperty("ModelAssetId").ToString()); + Console.WriteLine(result.GetProperty("DatasetFamily").ToString()); + Console.WriteLine(result.GetProperty("DatasetName").ToString()); + Console.WriteLine(result.GetProperty("Metrics").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("BlobUri").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +} +]]> + + + +This sample shows how to call GetLatestsAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +await foreach (Projects.1DP.EvaluationResult item in client.GetLatestsAsync()) +{ +} +]]> +This sample shows how to call GetLatestsAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +await foreach (Projects.1DP.EvaluationResult item in client.GetLatestsAsync(maxCount: 1234, skip: "", tags: "", listViewType: AI.Projects.1DP.ListViewType.ActiveOnly)) +{ +} +]]> + + + +This sample shows how to call GetLatests. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +foreach (Projects.1DP.EvaluationResult item in client.GetLatests()) +{ +} +]]> +This sample shows how to call GetLatests with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +foreach (Projects.1DP.EvaluationResult item in client.GetLatests(maxCount: 1234, skip: "", tags: "", listViewType: AI.Projects.1DP.ListViewType.ActiveOnly)) +{ +} +]]> + + + +This sample shows how to call GetLatestsAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +await foreach (BinaryData item in client.GetLatestsAsync((int?)null, (string)null, (string)null, (string)null, (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); +} +]]> +This sample shows how to call GetLatestsAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +await foreach (BinaryData item in client.GetLatestsAsync(1234, "", "", "ActiveOnly", (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("ResultType").ToString()); + Console.WriteLine(result.GetProperty("ModelName").ToString()); + Console.WriteLine(result.GetProperty("ModelVersion").ToString()); + Console.WriteLine(result.GetProperty("ModelAssetId").ToString()); + Console.WriteLine(result.GetProperty("DatasetFamily").ToString()); + Console.WriteLine(result.GetProperty("DatasetName").ToString()); + Console.WriteLine(result.GetProperty("Metrics").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("BlobUri").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +} +]]> + + + +This sample shows how to call GetLatests and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +foreach (BinaryData item in client.GetLatests((int?)null, (string)null, (string)null, (string)null, (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); +} +]]> +This sample shows how to call GetLatests with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + +foreach (BinaryData item in client.GetLatests(1234, "", "", "ActiveOnly", (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("ResultType").ToString()); + Console.WriteLine(result.GetProperty("ModelName").ToString()); + Console.WriteLine(result.GetProperty("ModelVersion").ToString()); + Console.WriteLine(result.GetProperty("ModelAssetId").ToString()); + Console.WriteLine(result.GetProperty("DatasetFamily").ToString()); + Console.WriteLine(result.GetProperty("DatasetName").ToString()); + Console.WriteLine(result.GetProperty("Metrics").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("BlobUri").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +} +]]> + + + \ No newline at end of file diff --git a/sdk/ai/Azure.AI.Projects.1DP/src/Generated/Docs/Evaluations.xml b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/Docs/Evaluations.xml new file mode 100644 index 000000000000..924d18a8deaf --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/Docs/Evaluations.xml @@ -0,0 +1,515 @@ + + + + + +This sample shows how to call GetEvaluationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + +Azure.Response < AI.Projects.1DP.Evaluation > response = await client.GetEvaluationAsync(""); +]]> +This sample shows how to call GetEvaluationAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + +Azure.Response < AI.Projects.1DP.Evaluation > response = await client.GetEvaluationAsync(""); +]]> + + + +This sample shows how to call GetEvaluation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + +Azure.Response < AI.Projects.1DP.Evaluation > response = client.GetEvaluation(""); +]]> +This sample shows how to call GetEvaluation with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + +Azure.Response < AI.Projects.1DP.Evaluation > response = client.GetEvaluation(""); +]]> + + + +This sample shows how to call GetEvaluationAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + +Response response = await client.GetEvaluationAsync("", (RequestContext)null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("data").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); +]]> +This sample shows how to call GetEvaluationAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + +Response response = await client.GetEvaluationAsync("", (RequestContext)null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("data").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("properties").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("initParams").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("dataMapping").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); +]]> + + + +This sample shows how to call GetEvaluation and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + +Response response = client.GetEvaluation("", (RequestContext)null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("data").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); +]]> +This sample shows how to call GetEvaluation with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + +Response response = client.GetEvaluation("", (RequestContext)null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("data").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("properties").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("initParams").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("dataMapping").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); +]]> + + + +This sample shows how to call CreateRunAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.Evaluation evaluation = new Projects.1DP.Evaluation(new Projects.1DP.InputDataset(""), new Dictionary +{ + ["key"] = new Projects.1DP.EvaluatorConfiguration("") +}); +Azure.Response < AI.Projects.1DP.Evaluation > response = await client.CreateRunAsync(evaluation); +]]> +This sample shows how to call CreateRunAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.Evaluation evaluation = new Projects.1DP.Evaluation(new Projects.1DP.InputDataset(""), new Dictionary +{ + ["key"] = new Projects.1DP.EvaluatorConfiguration("") + { + InitParams = + { + ["key"] = BinaryData.FromObjectAsJson(new object()) + }, + DataMapping = + { + ["key"] = "" + }, + } +}) +{ + DisplayName = "", + Description = "", + Tags = + { + ["key"] = "" + }, + Properties = + { + ["key"] = "" + }, +}; +Azure.Response < AI.Projects.1DP.Evaluation > response = await client.CreateRunAsync(evaluation); +]]> + + + +This sample shows how to call CreateRun. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.Evaluation evaluation = new Projects.1DP.Evaluation(new Projects.1DP.InputDataset(""), new Dictionary +{ + ["key"] = new Projects.1DP.EvaluatorConfiguration("") +}); +Azure.Response < AI.Projects.1DP.Evaluation > response = client.CreateRun(evaluation); +]]> +This sample shows how to call CreateRun with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.Evaluation evaluation = new Projects.1DP.Evaluation(new Projects.1DP.InputDataset(""), new Dictionary +{ + ["key"] = new Projects.1DP.EvaluatorConfiguration("") + { + InitParams = + { + ["key"] = BinaryData.FromObjectAsJson(new object()) + }, + DataMapping = + { + ["key"] = "" + }, + } +}) +{ + DisplayName = "", + Description = "", + Tags = + { + ["key"] = "" + }, + Properties = + { + ["key"] = "" + }, +}; +Azure.Response < AI.Projects.1DP.Evaluation > response = client.CreateRun(evaluation); +]]> + + + +This sample shows how to call CreateRunAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + data = new + { + type = "dataset", + id = "", + }, + evaluators = new + { + key = new + { + id = "", + }, + }, +}); +Response response = await client.CreateRunAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("data").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); +]]> +This sample shows how to call CreateRunAsync with all request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + data = new + { + type = "dataset", + id = "", + }, + displayName = "", + description = "", + tags = new + { + key = "", + }, + properties = new + { + key = "", + }, + evaluators = new + { + key = new + { + id = "", + initParams = new + { + key = new object(), + }, + dataMapping = new + { + key = "", + }, + }, + }, +}); +Response response = await client.CreateRunAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("data").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("properties").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("initParams").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("dataMapping").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); +]]> + + + +This sample shows how to call CreateRun and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + data = new + { + type = "dataset", + id = "", + }, + evaluators = new + { + key = new + { + id = "", + }, + }, +}); +Response response = client.CreateRun(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("data").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); +]]> +This sample shows how to call CreateRun with all request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + data = new + { + type = "dataset", + id = "", + }, + displayName = "", + description = "", + tags = new + { + key = "", + }, + properties = new + { + key = "", + }, + evaluators = new + { + key = new + { + id = "", + initParams = new + { + key = new object(), + }, + dataMapping = new + { + key = "", + }, + }, + }, +}); +Response response = client.CreateRun(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("data").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("properties").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("initParams").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("dataMapping").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); +]]> + + + +This sample shows how to call GetEvaluationsAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + +await foreach (Projects.1DP.Evaluation item in client.GetEvaluationsAsync()) +{ +} +]]> +This sample shows how to call GetEvaluationsAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + +await foreach (Projects.1DP.Evaluation item in client.GetEvaluationsAsync(maxCount: 1234, skip: 1234, maxpagesize: 1234)) +{ +} +]]> + + + +This sample shows how to call GetEvaluations. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + +foreach (Projects.1DP.Evaluation item in client.GetEvaluations()) +{ +} +]]> +This sample shows how to call GetEvaluations with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + +foreach (Projects.1DP.Evaluation item in client.GetEvaluations(maxCount: 1234, skip: 1234, maxpagesize: 1234)) +{ +} +]]> + + + +This sample shows how to call GetEvaluationsAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + +await foreach (BinaryData item in client.GetEvaluationsAsync((int?)null, (int?)null, (int?)null, (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("data").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); +} +]]> +This sample shows how to call GetEvaluationsAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + +await foreach (BinaryData item in client.GetEvaluationsAsync(1234, 1234, 1234, (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("data").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("properties").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("initParams").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("dataMapping").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); +} +]]> + + + +This sample shows how to call GetEvaluations and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + +foreach (BinaryData item in client.GetEvaluations((int?)null, (int?)null, (int?)null, (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("data").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); +} +]]> +This sample shows how to call GetEvaluations with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + +foreach (BinaryData item in client.GetEvaluations(1234, 1234, 1234, (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("data").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("properties").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("initParams").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("dataMapping").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); +} +]]> + + + \ No newline at end of file diff --git a/sdk/ai/Azure.AI.Projects.1DP/src/Generated/Docs/Indexes.xml b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/Docs/Indexes.xml new file mode 100644 index 000000000000..c5b10446bcb9 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/Docs/Indexes.xml @@ -0,0 +1,707 @@ + + + + + +This sample shows how to call GetVersionAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +Azure.Response < AI.Projects.1DP.Index > response = await client.GetVersionAsync("", ""); +]]> +This sample shows how to call GetVersionAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +Azure.Response < AI.Projects.1DP.Index > response = await client.GetVersionAsync("", ""); +]]> + + + +This sample shows how to call GetVersion. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +Azure.Response < AI.Projects.1DP.Index > response = client.GetVersion("", ""); +]]> +This sample shows how to call GetVersion with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +Azure.Response < AI.Projects.1DP.Index > response = client.GetVersion("", ""); +]]> + + + +This sample shows how to call GetVersionAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +Response response = await client.GetVersionAsync("", "", (RequestContext)null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +]]> +This sample shows how to call GetVersionAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +Response response = await client.GetVersionAsync("", "", (RequestContext)null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("stage").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +]]> + + + +This sample shows how to call GetVersion and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +Response response = client.GetVersion("", "", (RequestContext)null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +]]> +This sample shows how to call GetVersion with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +Response response = client.GetVersion("", "", (RequestContext)null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("stage").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +]]> + + + +This sample shows how to call DeleteVersionAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +Response response = await client.DeleteVersionAsync("", ""); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call DeleteVersionAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +Response response = await client.DeleteVersionAsync("", ""); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call DeleteVersion. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +Response response = client.DeleteVersion("", ""); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call DeleteVersion with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +Response response = client.DeleteVersion("", ""); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call CreateAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.Index body = new Projects.1DP.AzureAISearchIndex("", ""); +Azure.Response < AI.Projects.1DP.Index > response = await client.CreateAsync("", body); +]]> +This sample shows how to call CreateAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.Index body = new Projects.1DP.AzureAISearchIndex("", "") +{ + Stage = "", + Description = "", + Tags = + { + ["key"] = "" + }, +}; +Azure.Response < AI.Projects.1DP.Index > response = await client.CreateAsync("", body); +]]> + + + +This sample shows how to call Create. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.Index body = new Projects.1DP.AzureAISearchIndex("", ""); +Azure.Response < AI.Projects.1DP.Index > response = client.Create("", body); +]]> +This sample shows how to call Create with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.Index body = new Projects.1DP.AzureAISearchIndex("", "") +{ + Stage = "", + Description = "", + Tags = + { + ["key"] = "" + }, +}; +Azure.Response < AI.Projects.1DP.Index > response = client.Create("", body); +]]> + + + +This sample shows how to call CreateAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + type = "AzureSearch", + connectionName = "", + indexName = "", +}); +Response response = await client.CreateAsync("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +]]> +This sample shows how to call CreateAsync with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + type = "AzureSearch", + connectionName = "", + indexName = "", + stage = "", + description = "", + tags = new + { + key = "", + }, +}); +Response response = await client.CreateAsync("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("stage").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +]]> + + + +This sample shows how to call Create and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + type = "AzureSearch", + connectionName = "", + indexName = "", +}); +Response response = client.Create("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +]]> +This sample shows how to call Create with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + type = "AzureSearch", + connectionName = "", + indexName = "", + stage = "", + description = "", + tags = new + { + key = "", + }, +}); +Response response = client.Create("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("stage").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +]]> + + + +This sample shows how to call CreateVersionAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.Index body = new Projects.1DP.AzureAISearchIndex("", ""); +Azure.Response < AI.Projects.1DP.Index > response = await client.CreateVersionAsync("", "", body); +]]> +This sample shows how to call CreateVersionAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.Index body = new Projects.1DP.AzureAISearchIndex("", "") +{ + Stage = "", + Description = "", + Tags = + { + ["key"] = "" + }, +}; +Azure.Response < AI.Projects.1DP.Index > response = await client.CreateVersionAsync("", "", body); +]]> + + + +This sample shows how to call CreateVersion. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.Index body = new Projects.1DP.AzureAISearchIndex("", ""); +Azure.Response < AI.Projects.1DP.Index > response = client.CreateVersion("", "", body); +]]> +This sample shows how to call CreateVersion with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.Index body = new Projects.1DP.AzureAISearchIndex("", "") +{ + Stage = "", + Description = "", + Tags = + { + ["key"] = "" + }, +}; +Azure.Response < AI.Projects.1DP.Index > response = client.CreateVersion("", "", body); +]]> + + + +This sample shows how to call CreateVersionAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + type = "AzureSearch", + connectionName = "", + indexName = "", +}); +Response response = await client.CreateVersionAsync("", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +]]> +This sample shows how to call CreateVersionAsync with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + type = "AzureSearch", + connectionName = "", + indexName = "", + stage = "", + description = "", + tags = new + { + key = "", + }, +}); +Response response = await client.CreateVersionAsync("", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("stage").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +]]> + + + +This sample shows how to call CreateVersion and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + type = "AzureSearch", + connectionName = "", + indexName = "", +}); +Response response = client.CreateVersion("", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +]]> +This sample shows how to call CreateVersion with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + type = "AzureSearch", + connectionName = "", + indexName = "", + stage = "", + description = "", + tags = new + { + key = "", + }, +}); +Response response = client.CreateVersion("", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("stage").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("version").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +]]> + + + +This sample shows how to call GetVersionsAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +await foreach (Projects.1DP.Index item in client.GetVersionsAsync("")) +{ +} +]]> +This sample shows how to call GetVersionsAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +await foreach (Projects.1DP.Index item in client.GetVersionsAsync("", maxCount: 1234, skip: "", tags: "", listViewType: AI.Projects.1DP.ListViewType.ActiveOnly)) +{ +} +]]> + + + +This sample shows how to call GetVersions. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +foreach (Projects.1DP.Index item in client.GetVersions("")) +{ +} +]]> +This sample shows how to call GetVersions with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +foreach (Projects.1DP.Index item in client.GetVersions("", maxCount: 1234, skip: "", tags: "", listViewType: AI.Projects.1DP.ListViewType.ActiveOnly)) +{ +} +]]> + + + +This sample shows how to call GetVersionsAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +await foreach (BinaryData item in client.GetVersionsAsync("", (int?)null, (string)null, (string)null, (string)null, (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); +} +]]> +This sample shows how to call GetVersionsAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +await foreach (BinaryData item in client.GetVersionsAsync("", 1234, "", "", "ActiveOnly", (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +} +]]> + + + +This sample shows how to call GetVersions and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +foreach (BinaryData item in client.GetVersions("", (int?)null, (string)null, (string)null, (string)null, (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); +} +]]> +This sample shows how to call GetVersions with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +foreach (BinaryData item in client.GetVersions("", 1234, "", "", "ActiveOnly", (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +} +]]> + + + +This sample shows how to call GetLatestsAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +await foreach (Projects.1DP.Index item in client.GetLatestsAsync()) +{ +} +]]> +This sample shows how to call GetLatestsAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +await foreach (Projects.1DP.Index item in client.GetLatestsAsync(maxCount: 1234, skip: "", tags: "", listViewType: AI.Projects.1DP.ListViewType.ActiveOnly)) +{ +} +]]> + + + +This sample shows how to call GetLatests. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +foreach (Projects.1DP.Index item in client.GetLatests()) +{ +} +]]> +This sample shows how to call GetLatests with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +foreach (Projects.1DP.Index item in client.GetLatests(maxCount: 1234, skip: "", tags: "", listViewType: AI.Projects.1DP.ListViewType.ActiveOnly)) +{ +} +]]> + + + +This sample shows how to call GetLatestsAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +await foreach (BinaryData item in client.GetLatestsAsync((int?)null, (string)null, (string)null, (string)null, (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); +} +]]> +This sample shows how to call GetLatestsAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +await foreach (BinaryData item in client.GetLatestsAsync(1234, "", "", "ActiveOnly", (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +} +]]> + + + +This sample shows how to call GetLatests and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +foreach (BinaryData item in client.GetLatests((int?)null, (string)null, (string)null, (string)null, (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); +} +]]> +This sample shows how to call GetLatests with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + +foreach (BinaryData item in client.GetLatests(1234, "", "", "ActiveOnly", (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +} +]]> + + + \ No newline at end of file diff --git a/sdk/ai/Azure.AI.Projects.1DP/src/Generated/Docs/RedTeams.xml b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/Docs/RedTeams.xml new file mode 100644 index 000000000000..f47e1633935e --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/Docs/RedTeams.xml @@ -0,0 +1,477 @@ + + + + + +This sample shows how to call GetRedTeamAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + +Azure.Response < AI.Projects.1DP.RedTeam > response = await client.GetRedTeamAsync(""); +]]> +This sample shows how to call GetRedTeamAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + +Azure.Response < AI.Projects.1DP.RedTeam > response = await client.GetRedTeamAsync(""); +]]> + + + +This sample shows how to call GetRedTeam. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + +Azure.Response < AI.Projects.1DP.RedTeam > response = client.GetRedTeam(""); +]]> +This sample shows how to call GetRedTeam with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + +Azure.Response < AI.Projects.1DP.RedTeam > response = client.GetRedTeam(""); +]]> + + + +This sample shows how to call GetRedTeamAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + +Response response = await client.GetRedTeamAsync("", (RequestContext)null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("scanName").ToString()); +Console.WriteLine(result.GetProperty("numTurns").ToString()); +Console.WriteLine(result.GetProperty("attackStrategy")[0].ToString()); +Console.WriteLine(result.GetProperty("simulationOnly").ToString()); +Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("riskCategories")[0].ToString()); +]]> +This sample shows how to call GetRedTeamAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + +Response response = await client.GetRedTeamAsync("", (RequestContext)null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("scanName").ToString()); +Console.WriteLine(result.GetProperty("numTurns").ToString()); +Console.WriteLine(result.GetProperty("attackStrategy")[0].ToString()); +Console.WriteLine(result.GetProperty("simulationOnly").ToString()); +Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("riskCategories")[0].ToString()); +Console.WriteLine(result.GetProperty("applicationScenario").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("properties").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +]]> + + + +This sample shows how to call GetRedTeam and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + +Response response = client.GetRedTeam("", (RequestContext)null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("scanName").ToString()); +Console.WriteLine(result.GetProperty("numTurns").ToString()); +Console.WriteLine(result.GetProperty("attackStrategy")[0].ToString()); +Console.WriteLine(result.GetProperty("simulationOnly").ToString()); +Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("riskCategories")[0].ToString()); +]]> +This sample shows how to call GetRedTeam with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + +Response response = client.GetRedTeam("", (RequestContext)null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("scanName").ToString()); +Console.WriteLine(result.GetProperty("numTurns").ToString()); +Console.WriteLine(result.GetProperty("attackStrategy")[0].ToString()); +Console.WriteLine(result.GetProperty("simulationOnly").ToString()); +Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("riskCategories")[0].ToString()); +Console.WriteLine(result.GetProperty("applicationScenario").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("properties").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +]]> + + + +This sample shows how to call CreateRunAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.RedTeam redTeam = new Projects.1DP.RedTeam("", 1234, new Projects.1DP.AttackStrategy[]{ AI.Projects.1DP.AttackStrategy.Easy}, true, new Projects.1DP.RiskCategory[]{ AI.Projects.1DP.RiskCategory.HateUnfairness}); +Azure.Response < AI.Projects.1DP.RedTeam > response = await client.CreateRunAsync(redTeam); +]]> +This sample shows how to call CreateRunAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.RedTeam redTeam = new Projects.1DP.RedTeam("", 1234, new Projects.1DP.AttackStrategy[]{ AI.Projects.1DP.AttackStrategy.Easy}, true, new Projects.1DP.RiskCategory[]{ AI.Projects.1DP.RiskCategory.HateUnfairness}) +{ + ApplicationScenario = "", + Tags = + { + ["key"] = "" + }, + Properties = + { + ["key"] = "" + }, +}; +Azure.Response < AI.Projects.1DP.RedTeam > response = await client.CreateRunAsync(redTeam); +]]> + + + +This sample shows how to call CreateRun. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.RedTeam redTeam = new Projects.1DP.RedTeam("", 1234, new Projects.1DP.AttackStrategy[]{ AI.Projects.1DP.AttackStrategy.Easy}, true, new Projects.1DP.RiskCategory[]{ AI.Projects.1DP.RiskCategory.HateUnfairness}); +Azure.Response < AI.Projects.1DP.RedTeam > response = client.CreateRun(redTeam); +]]> +This sample shows how to call CreateRun with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + +AI.Projects.1DP.RedTeam redTeam = new Projects.1DP.RedTeam("", 1234, new Projects.1DP.AttackStrategy[]{ AI.Projects.1DP.AttackStrategy.Easy}, true, new Projects.1DP.RiskCategory[]{ AI.Projects.1DP.RiskCategory.HateUnfairness}) +{ + ApplicationScenario = "", + Tags = + { + ["key"] = "" + }, + Properties = + { + ["key"] = "" + }, +}; +Azure.Response < AI.Projects.1DP.RedTeam > response = client.CreateRun(redTeam); +]]> + + + +This sample shows how to call CreateRunAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + scanName = "", + numTurns = 1234, + attackStrategy = new object[] + { + "easy" + }, + simulationOnly = true, + riskCategories = new object[] + { + "HateUnfairness" + }, +}); +Response response = await client.CreateRunAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("scanName").ToString()); +Console.WriteLine(result.GetProperty("numTurns").ToString()); +Console.WriteLine(result.GetProperty("attackStrategy")[0].ToString()); +Console.WriteLine(result.GetProperty("simulationOnly").ToString()); +Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("riskCategories")[0].ToString()); +]]> +This sample shows how to call CreateRunAsync with all request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + scanName = "", + numTurns = 1234, + attackStrategy = new object[] + { + "easy" + }, + simulationOnly = true, + riskCategories = new object[] + { + "HateUnfairness" + }, + applicationScenario = "", + tags = new + { + key = "", + }, + properties = new + { + key = "", + }, +}); +Response response = await client.CreateRunAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("scanName").ToString()); +Console.WriteLine(result.GetProperty("numTurns").ToString()); +Console.WriteLine(result.GetProperty("attackStrategy")[0].ToString()); +Console.WriteLine(result.GetProperty("simulationOnly").ToString()); +Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("riskCategories")[0].ToString()); +Console.WriteLine(result.GetProperty("applicationScenario").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("properties").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +]]> + + + +This sample shows how to call CreateRun and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + scanName = "", + numTurns = 1234, + attackStrategy = new object[] + { + "easy" + }, + simulationOnly = true, + riskCategories = new object[] + { + "HateUnfairness" + }, +}); +Response response = client.CreateRun(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("scanName").ToString()); +Console.WriteLine(result.GetProperty("numTurns").ToString()); +Console.WriteLine(result.GetProperty("attackStrategy")[0].ToString()); +Console.WriteLine(result.GetProperty("simulationOnly").ToString()); +Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("riskCategories")[0].ToString()); +]]> +This sample shows how to call CreateRun with all request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + +using RequestContent content = RequestContent.Create(new +{ + scanName = "", + numTurns = 1234, + attackStrategy = new object[] + { + "easy" + }, + simulationOnly = true, + riskCategories = new object[] + { + "HateUnfairness" + }, + applicationScenario = "", + tags = new + { + key = "", + }, + properties = new + { + key = "", + }, +}); +Response response = client.CreateRun(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("scanName").ToString()); +Console.WriteLine(result.GetProperty("numTurns").ToString()); +Console.WriteLine(result.GetProperty("attackStrategy")[0].ToString()); +Console.WriteLine(result.GetProperty("simulationOnly").ToString()); +Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("riskCategories")[0].ToString()); +Console.WriteLine(result.GetProperty("applicationScenario").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("properties").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +]]> + + + +This sample shows how to call GetRedTeamsAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + +await foreach (Projects.1DP.RedTeam item in client.GetRedTeamsAsync()) +{ +} +]]> +This sample shows how to call GetRedTeamsAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + +await foreach (Projects.1DP.RedTeam item in client.GetRedTeamsAsync(maxCount: 1234, skip: 1234, maxpagesize: 1234)) +{ +} +]]> + + + +This sample shows how to call GetRedTeams. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + +foreach (Projects.1DP.RedTeam item in client.GetRedTeams()) +{ +} +]]> +This sample shows how to call GetRedTeams with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + +foreach (Projects.1DP.RedTeam item in client.GetRedTeams(maxCount: 1234, skip: 1234, maxpagesize: 1234)) +{ +} +]]> + + + +This sample shows how to call GetRedTeamsAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + +await foreach (BinaryData item in client.GetRedTeamsAsync((int?)null, (int?)null, (int?)null, (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("scanName").ToString()); + Console.WriteLine(result.GetProperty("numTurns").ToString()); + Console.WriteLine(result.GetProperty("attackStrategy")[0].ToString()); + Console.WriteLine(result.GetProperty("simulationOnly").ToString()); + Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("riskCategories")[0].ToString()); +} +]]> +This sample shows how to call GetRedTeamsAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + +await foreach (BinaryData item in client.GetRedTeamsAsync(1234, 1234, 1234, (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("scanName").ToString()); + Console.WriteLine(result.GetProperty("numTurns").ToString()); + Console.WriteLine(result.GetProperty("attackStrategy")[0].ToString()); + Console.WriteLine(result.GetProperty("simulationOnly").ToString()); + Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("riskCategories")[0].ToString()); + Console.WriteLine(result.GetProperty("applicationScenario").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("properties").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); +} +]]> + + + +This sample shows how to call GetRedTeams and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + +foreach (BinaryData item in client.GetRedTeams((int?)null, (int?)null, (int?)null, (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("scanName").ToString()); + Console.WriteLine(result.GetProperty("numTurns").ToString()); + Console.WriteLine(result.GetProperty("attackStrategy")[0].ToString()); + Console.WriteLine(result.GetProperty("simulationOnly").ToString()); + Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("riskCategories")[0].ToString()); +} +]]> +This sample shows how to call GetRedTeams with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + +foreach (BinaryData item in client.GetRedTeams(1234, 1234, 1234, (RequestContext)null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("scanName").ToString()); + Console.WriteLine(result.GetProperty("numTurns").ToString()); + Console.WriteLine(result.GetProperty("attackStrategy")[0].ToString()); + Console.WriteLine(result.GetProperty("simulationOnly").ToString()); + Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("riskCategories")[0].ToString()); + Console.WriteLine(result.GetProperty("applicationScenario").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("properties").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); +} +]]> + + + \ No newline at end of file diff --git a/sdk/ai/Azure.AI.Projects.1DP/src/Generated/EvaluationResults.cs b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/EvaluationResults.cs new file mode 100644 index 000000000000..47b67940d544 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/EvaluationResults.cs @@ -0,0 +1,397 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.Projects.1DP +{ + +/// List all versions of the given EvaluationResult. +/// The name of the resource. +/// Top count of results, top count cannot be greater than the page size. If topCount > page size, results with be default page size count will be returned. +/// Continuation token for pagination. +/// Comma-separated list of tag names (and optionally values). Example: tag1,tag2=value2. +/// [ListViewType.ActiveOnly, ListViewType.ArchivedOnly, ListViewType.All] View type for including/excluding (for example) archived entities. +/// The cancellation token to use. +/// is null. +/// is an empty string, and was expected to be non-empty. +/// +public virtual Azure.Pageable GetVersions(string name, int? maxCount = null, string skip = null, string tags = null, Projects.1DP.ListViewType? listViewType = (Projects.1DP.ListViewType?)null,CancellationToken cancellationToken = default) +{ +Projects.1DP.Argument.AssertNotNullOrEmpty(name, nameof(name)); + +RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; +HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetVersionsRequest(name, maxCount, skip, tags, listViewType?.ToString(), context); +HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetVersionsNextPageRequest(nextLink, name, maxCount, skip, tags, listViewType?.ToString(), context); +return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => Projects.1DP.EvaluationResult.DeserializeEvaluationResult(e), ClientDiagnostics, _pipeline, "EvaluationResults.GetVersions", "value", "nextLink", context); +} + +/// +/// [Protocol Method] List all versions of the given EvaluationResult +/// +/// +/// +/// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. +/// +/// +/// +/// +/// Please try the simpler convenience overload with strongly typed models first. +/// +/// +/// +/// +/// The name of the resource. +/// Top count of results, top count cannot be greater than the page size. If topCount > page size, results with be default page size count will be returned. +/// Continuation token for pagination. +/// Comma-separated list of tag names (and optionally values). Example: tag1,tag2=value2. +/// [ListViewType.ActiveOnly, ListViewType.ArchivedOnly, ListViewType.All] View type for including/excluding (for example) archived entities. Allowed values: "ActiveOnly" | "ArchivedOnly" | "All". +/// The request context, which can override default behaviors of the client pipeline on a per-call basis. +/// is null. +/// is an empty string, and was expected to be non-empty. +/// Service returned a non-success status code. +/// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. +/// +public virtual Azure.AsyncPageable GetVersionsAsync(string name, int? maxCount, string skip, string tags, string listViewType, Azure.RequestContext context) +{ + Azure.AI.Projects.1DP.Argument.AssertNotNullOrEmpty(name, nameof(name)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetVersionsRequest(name, maxCount, skip, tags, listViewType, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetVersionsNextPageRequest(nextLink, name, maxCount, skip, tags, listViewType, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EvaluationResults.GetVersions", "value", "nextLink", context); +} + +/// +/// [Protocol Method] List all versions of the given EvaluationResult +/// +/// +/// +/// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. +/// +/// +/// +/// +/// Please try the simpler convenience overload with strongly typed models first. +/// +/// +/// +/// +/// The name of the resource. +/// Top count of results, top count cannot be greater than the page size. If topCount > page size, results with be default page size count will be returned. +/// Continuation token for pagination. +/// Comma-separated list of tag names (and optionally values). Example: tag1,tag2=value2. +/// [ListViewType.ActiveOnly, ListViewType.ArchivedOnly, ListViewType.All] View type for including/excluding (for example) archived entities. Allowed values: "ActiveOnly" | "ArchivedOnly" | "All". +/// The request context, which can override default behaviors of the client pipeline on a per-call basis. +/// is null. +/// is an empty string, and was expected to be non-empty. +/// Service returned a non-success status code. +/// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. +/// +public virtual Azure.Pageable GetVersions(string name, int? maxCount, string skip, string tags, string listViewType, Azure.RequestContext context) +{ + Azure.AI.Projects.1DP.Argument.AssertNotNullOrEmpty(name, nameof(name)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetVersionsRequest(name, maxCount, skip, tags, listViewType, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetVersionsNextPageRequest(nextLink, name, maxCount, skip, tags, listViewType, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EvaluationResults.GetVersions", "value", "nextLink", context); +} + +/// List the latest version of each EvaluationResult. +/// Top count of results, top count cannot be greater than the page size. If topCount > page size, results with be default page size count will be returned. +/// Continuation token for pagination. +/// Comma-separated list of tag names (and optionally values). Example: tag1,tag2=value2. +/// [ListViewType.ActiveOnly, ListViewType.ArchivedOnly, ListViewType.All] View type for including/excluding (for example) archived entities. +/// The cancellation token to use. +/// +public virtual Azure.AsyncPageable GetLatestsAsync(int? maxCount = null, string skip = null, string tags = null, Azure.AI.Projects.1DP.ListViewType? listViewType = (Azure.AI.Projects.1DP.ListViewType?)null,CancellationToken cancellationToken = default) +{ + Azure.RequestContext context = cancellationToken.CanBeCanceled ? new Azure.RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetLatestsRequest(maxCount, skip, tags, listViewType?.ToString(), context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetLatestsNextPageRequest(nextLink, maxCount, skip, tags, listViewType?.ToString(), context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => Azure.AI.Projects.1DP.EvaluationResult.DeserializeEvaluationResult(e), ClientDiagnostics, _pipeline, "EvaluationResults.GetLatests", "value", "nextLink", context); +} + +/// List the latest version of each EvaluationResult. +/// Top count of results, top count cannot be greater than the page size. If topCount > page size, results with be default page size count will be returned. +/// Continuation token for pagination. +/// Comma-separated list of tag names (and optionally values). Example: tag1,tag2=value2. +/// [ListViewType.ActiveOnly, ListViewType.ArchivedOnly, ListViewType.All] View type for including/excluding (for example) archived entities. +/// The cancellation token to use. +/// +public virtual Azure.Pageable GetLatests(int? maxCount = null, string skip = null, string tags = null, Azure.AI.Projects.1DP.ListViewType? listViewType = (Azure.AI.Projects.1DP.ListViewType?)null,CancellationToken cancellationToken = default) +{ + Azure.RequestContext context = cancellationToken.CanBeCanceled ? new Azure.RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetLatestsRequest(maxCount, skip, tags, listViewType?.ToString(), context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetLatestsNextPageRequest(nextLink, maxCount, skip, tags, listViewType?.ToString(), context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => Azure.AI.Projects.1DP.EvaluationResult.DeserializeEvaluationResult(e), ClientDiagnostics, _pipeline, "EvaluationResults.GetLatests", "value", "nextLink", context); +} + +/// +/// [Protocol Method] List the latest version of each EvaluationResult +/// +/// +/// +/// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. +/// +/// +/// +/// +/// Please try the simpler convenience overload with strongly typed models first. +/// +/// +/// +/// +/// Top count of results, top count cannot be greater than the page size. If topCount > page size, results with be default page size count will be returned. +/// Continuation token for pagination. +/// Comma-separated list of tag names (and optionally values). Example: tag1,tag2=value2. +/// [ListViewType.ActiveOnly, ListViewType.ArchivedOnly, ListViewType.All] View type for including/excluding (for example) archived entities. Allowed values: "ActiveOnly" | "ArchivedOnly" | "All". +/// The request context, which can override default behaviors of the client pipeline on a per-call basis. +/// Service returned a non-success status code. +/// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. +/// +public virtual Azure.AsyncPageable GetLatestsAsync(int? maxCount, string skip, string tags, string listViewType, Azure.RequestContext context) +{ + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetLatestsRequest(maxCount, skip, tags, listViewType, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetLatestsNextPageRequest(nextLink, maxCount, skip, tags, listViewType, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EvaluationResults.GetLatests", "value", "nextLink", context); +} + +/// +/// [Protocol Method] List the latest version of each EvaluationResult +/// +/// +/// +/// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. +/// +/// +/// +/// +/// Please try the simpler convenience overload with strongly typed models first. +/// +/// +/// +/// +/// Top count of results, top count cannot be greater than the page size. If topCount > page size, results with be default page size count will be returned. +/// Continuation token for pagination. +/// Comma-separated list of tag names (and optionally values). Example: tag1,tag2=value2. +/// [ListViewType.ActiveOnly, ListViewType.ArchivedOnly, ListViewType.All] View type for including/excluding (for example) archived entities. Allowed values: "ActiveOnly" | "ArchivedOnly" | "All". +/// The request context, which can override default behaviors of the client pipeline on a per-call basis. +/// Service returned a non-success status code. +/// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. +/// +public virtual Azure.Pageable GetLatests(int? maxCount, string skip, string tags, string listViewType, Azure.RequestContext context) +{ + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetLatestsRequest(maxCount, skip, tags, listViewType, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetLatestsNextPageRequest(nextLink, maxCount, skip, tags, listViewType, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EvaluationResults.GetLatests", "value", "nextLink", context); +} + +internal HttpMessage CreateGetVersionsRequest(string name, int? maxCount, string skip, string tags, string listViewType, Azure.RequestContext context) +{ + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/evaluationResult/", false); + uri.AppendPath(name, true); + uri.AppendPath("/versions", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (maxCount != null) + { + uri.AppendQuery("top", maxCount.Value, true); + } + if (skip != null) + { + uri.AppendQuery("skip", skip, true); + } + if (tags != null) + { + uri.AppendQuery("tags", tags, true); + } + if (listViewType != null) + { + uri.AppendQuery("listViewType", listViewType, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; +} + +internal HttpMessage CreateGetLatestsRequest(int? maxCount, string skip, string tags, string listViewType, Azure.RequestContext context) +{ + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/evaluationResult", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (maxCount != null) + { + uri.AppendQuery("top", maxCount.Value, true); + } + if (skip != null) + { + uri.AppendQuery("skip", skip, true); + } + if (tags != null) + { + uri.AppendQuery("tags", tags, true); + } + if (listViewType != null) + { + uri.AppendQuery("listViewType", listViewType, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; +} + +internal HttpMessage CreateGetVersionRequest(string name, string version, Azure.RequestContext context) +{ + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/evaluationResult/", false); + uri.AppendPath(name, true); + uri.AppendPath("/versions/", false); + uri.AppendPath(version, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; +} + +internal HttpMessage CreateDeleteVersionRequest(string name, string version, Azure.RequestContext context) +{ + var message = _pipeline.CreateMessage(context, ResponseClassifier204); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/evaluationResult/", false); + uri.AppendPath(name, true); + uri.AppendPath("/versions/", false); + uri.AppendPath(version, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; +} + +internal HttpMessage CreateCreateRequest(string name, RequestContent content, Azure.RequestContext context) +{ + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/evaluationResult/", false); + uri.AppendPath(name, true); + uri.AppendPath("/versions", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Repeatability-Request-ID", Guid.NewGuid()); + request.Headers.Add("Repeatability-First-Sent", DateTimeOffset.Now, "R"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; +} + +internal HttpMessage CreateCreateVersionRequest(string name, string version, RequestContent content, Azure.RequestContext context) +{ + var message = _pipeline.CreateMessage(context, ResponseClassifier200201); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/evaluationResult/", false); + uri.AppendPath(name, true); + uri.AppendPath("/versions/", false); + uri.AppendPath(version, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; +} + +internal HttpMessage CreateStartPendingUploadRequest(string name, string version, RequestContent content, Azure.RequestContext context) +{ + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/evaluationResult/", false); + uri.AppendPath(name, true); + uri.AppendPath("/versions/", false); + uri.AppendPath(version, true); + uri.AppendPath("/startPendingUpload", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; +} + +internal HttpMessage CreateGetVersionsNextPageRequest(string nextLink, string name, int? maxCount, string skip, string tags, string listViewType, Azure.RequestContext context) +{ + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; +} + +internal HttpMessage CreateGetLatestsNextPageRequest(string nextLink, int? maxCount, string skip, string tags, string listViewType, Azure.RequestContext context) +{ + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; +} + +private static Azure.RequestContext DefaultRequestContext = new Azure.RequestContext(); +internal static Azure.RequestContext FromCancellationToken(CancellationToken cancellationToken = default) +{ + if (!cancellationToken.CanBeCanceled) + { + return DefaultRequestContext; + } + + return new Azure.RequestContext() { CancellationToken = cancellationToken }; +} + +private static ResponseClassifier _responseClassifier200; +private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); +private static ResponseClassifier _responseClassifier204; +private static ResponseClassifier ResponseClassifier204 => _responseClassifier204 ??= new StatusCodeClassifier(stackalloc ushort[] { 204 }); +private static ResponseClassifier _responseClassifier200201; +private static ResponseClassifier ResponseClassifier200201 => _responseClassifier200201 ??= new StatusCodeClassifier(stackalloc ushort[] { 200, 201 }); +} +} diff --git a/sdk/ai/Azure.AI.Projects.1DP/src/Generated/Indexes.cs b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/Indexes.cs new file mode 100644 index 000000000000..78d7f904c51d --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/Indexes.cs @@ -0,0 +1,377 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.Projects.1DP +{ + +/// List all versions of the given Index. +/// The name of the resource. +/// Top count of results, top count cannot be greater than the page size. If topCount > page size, results with be default page size count will be returned. +/// Continuation token for pagination. +/// Comma-separated list of tag names (and optionally values). Example: tag1,tag2=value2. +/// [ListViewType.ActiveOnly, ListViewType.ArchivedOnly, ListViewType.All] View type for including/excluding (for example) archived entities. +/// The cancellation token to use. +/// is null. +/// is an empty string, and was expected to be non-empty. +/// +public virtual Azure.Pageable GetVersions(string name, int? maxCount = null, string skip = null, string tags = null, Projects.1DP.ListViewType? listViewType = (Projects.1DP.ListViewType?)null,CancellationToken cancellationToken = default) +{ +Projects.1DP.Argument.AssertNotNullOrEmpty(name, nameof(name)); + +RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; +HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetVersionsRequest(name, maxCount, skip, tags, listViewType?.ToString(), context); +HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetVersionsNextPageRequest(nextLink, name, maxCount, skip, tags, listViewType?.ToString(), context); +return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => Projects.1DP.Index.DeserializeIndex(e), ClientDiagnostics, _pipeline, "Indexes.GetVersions", "value", "nextLink", context); +} + +/// +/// [Protocol Method] List all versions of the given Index +/// +/// +/// +/// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. +/// +/// +/// +/// +/// Please try the simpler convenience overload with strongly typed models first. +/// +/// +/// +/// +/// The name of the resource. +/// Top count of results, top count cannot be greater than the page size. If topCount > page size, results with be default page size count will be returned. +/// Continuation token for pagination. +/// Comma-separated list of tag names (and optionally values). Example: tag1,tag2=value2. +/// [ListViewType.ActiveOnly, ListViewType.ArchivedOnly, ListViewType.All] View type for including/excluding (for example) archived entities. Allowed values: "ActiveOnly" | "ArchivedOnly" | "All". +/// The request context, which can override default behaviors of the client pipeline on a per-call basis. +/// is null. +/// is an empty string, and was expected to be non-empty. +/// Service returned a non-success status code. +/// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. +/// +public virtual Azure.AsyncPageable GetVersionsAsync(string name, int? maxCount, string skip, string tags, string listViewType, Azure.RequestContext context) +{ + Azure.AI.Projects.1DP.Argument.AssertNotNullOrEmpty(name, nameof(name)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetVersionsRequest(name, maxCount, skip, tags, listViewType, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetVersionsNextPageRequest(nextLink, name, maxCount, skip, tags, listViewType, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Indexes.GetVersions", "value", "nextLink", context); +} + +/// +/// [Protocol Method] List all versions of the given Index +/// +/// +/// +/// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. +/// +/// +/// +/// +/// Please try the simpler convenience overload with strongly typed models first. +/// +/// +/// +/// +/// The name of the resource. +/// Top count of results, top count cannot be greater than the page size. If topCount > page size, results with be default page size count will be returned. +/// Continuation token for pagination. +/// Comma-separated list of tag names (and optionally values). Example: tag1,tag2=value2. +/// [ListViewType.ActiveOnly, ListViewType.ArchivedOnly, ListViewType.All] View type for including/excluding (for example) archived entities. Allowed values: "ActiveOnly" | "ArchivedOnly" | "All". +/// The request context, which can override default behaviors of the client pipeline on a per-call basis. +/// is null. +/// is an empty string, and was expected to be non-empty. +/// Service returned a non-success status code. +/// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. +/// +public virtual Azure.Pageable GetVersions(string name, int? maxCount, string skip, string tags, string listViewType, Azure.RequestContext context) +{ + Azure.AI.Projects.1DP.Argument.AssertNotNullOrEmpty(name, nameof(name)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetVersionsRequest(name, maxCount, skip, tags, listViewType, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetVersionsNextPageRequest(nextLink, name, maxCount, skip, tags, listViewType, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Indexes.GetVersions", "value", "nextLink", context); +} + +/// List the latest version of each Index. +/// Top count of results, top count cannot be greater than the page size. If topCount > page size, results with be default page size count will be returned. +/// Continuation token for pagination. +/// Comma-separated list of tag names (and optionally values). Example: tag1,tag2=value2. +/// [ListViewType.ActiveOnly, ListViewType.ArchivedOnly, ListViewType.All] View type for including/excluding (for example) archived entities. +/// The cancellation token to use. +/// +public virtual Azure.AsyncPageable GetLatestsAsync(int? maxCount = null, string skip = null, string tags = null, Azure.AI.Projects.1DP.ListViewType? listViewType = (Azure.AI.Projects.1DP.ListViewType?)null,CancellationToken cancellationToken = default) +{ + Azure.RequestContext context = cancellationToken.CanBeCanceled ? new Azure.RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetLatestsRequest(maxCount, skip, tags, listViewType?.ToString(), context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetLatestsNextPageRequest(nextLink, maxCount, skip, tags, listViewType?.ToString(), context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => Azure.AI.Projects.1DP.Index.DeserializeIndex(e), ClientDiagnostics, _pipeline, "Indexes.GetLatests", "value", "nextLink", context); +} + +/// List the latest version of each Index. +/// Top count of results, top count cannot be greater than the page size. If topCount > page size, results with be default page size count will be returned. +/// Continuation token for pagination. +/// Comma-separated list of tag names (and optionally values). Example: tag1,tag2=value2. +/// [ListViewType.ActiveOnly, ListViewType.ArchivedOnly, ListViewType.All] View type for including/excluding (for example) archived entities. +/// The cancellation token to use. +/// +public virtual Azure.Pageable GetLatests(int? maxCount = null, string skip = null, string tags = null, Azure.AI.Projects.1DP.ListViewType? listViewType = (Azure.AI.Projects.1DP.ListViewType?)null,CancellationToken cancellationToken = default) +{ + Azure.RequestContext context = cancellationToken.CanBeCanceled ? new Azure.RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetLatestsRequest(maxCount, skip, tags, listViewType?.ToString(), context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetLatestsNextPageRequest(nextLink, maxCount, skip, tags, listViewType?.ToString(), context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => Azure.AI.Projects.1DP.Index.DeserializeIndex(e), ClientDiagnostics, _pipeline, "Indexes.GetLatests", "value", "nextLink", context); +} + +/// +/// [Protocol Method] List the latest version of each Index +/// +/// +/// +/// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. +/// +/// +/// +/// +/// Please try the simpler convenience overload with strongly typed models first. +/// +/// +/// +/// +/// Top count of results, top count cannot be greater than the page size. If topCount > page size, results with be default page size count will be returned. +/// Continuation token for pagination. +/// Comma-separated list of tag names (and optionally values). Example: tag1,tag2=value2. +/// [ListViewType.ActiveOnly, ListViewType.ArchivedOnly, ListViewType.All] View type for including/excluding (for example) archived entities. Allowed values: "ActiveOnly" | "ArchivedOnly" | "All". +/// The request context, which can override default behaviors of the client pipeline on a per-call basis. +/// Service returned a non-success status code. +/// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. +/// +public virtual Azure.AsyncPageable GetLatestsAsync(int? maxCount, string skip, string tags, string listViewType, Azure.RequestContext context) +{ + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetLatestsRequest(maxCount, skip, tags, listViewType, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetLatestsNextPageRequest(nextLink, maxCount, skip, tags, listViewType, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Indexes.GetLatests", "value", "nextLink", context); +} + +/// +/// [Protocol Method] List the latest version of each Index +/// +/// +/// +/// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. +/// +/// +/// +/// +/// Please try the simpler convenience overload with strongly typed models first. +/// +/// +/// +/// +/// Top count of results, top count cannot be greater than the page size. If topCount > page size, results with be default page size count will be returned. +/// Continuation token for pagination. +/// Comma-separated list of tag names (and optionally values). Example: tag1,tag2=value2. +/// [ListViewType.ActiveOnly, ListViewType.ArchivedOnly, ListViewType.All] View type for including/excluding (for example) archived entities. Allowed values: "ActiveOnly" | "ArchivedOnly" | "All". +/// The request context, which can override default behaviors of the client pipeline on a per-call basis. +/// Service returned a non-success status code. +/// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. +/// +public virtual Azure.Pageable GetLatests(int? maxCount, string skip, string tags, string listViewType, Azure.RequestContext context) +{ + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetLatestsRequest(maxCount, skip, tags, listViewType, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetLatestsNextPageRequest(nextLink, maxCount, skip, tags, listViewType, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Indexes.GetLatests", "value", "nextLink", context); +} + +internal HttpMessage CreateGetVersionsRequest(string name, int? maxCount, string skip, string tags, string listViewType, Azure.RequestContext context) +{ + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/indexes/", false); + uri.AppendPath(name, true); + uri.AppendPath("/versions", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (maxCount != null) + { + uri.AppendQuery("top", maxCount.Value, true); + } + if (skip != null) + { + uri.AppendQuery("skip", skip, true); + } + if (tags != null) + { + uri.AppendQuery("tags", tags, true); + } + if (listViewType != null) + { + uri.AppendQuery("listViewType", listViewType, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; +} + +internal HttpMessage CreateGetLatestsRequest(int? maxCount, string skip, string tags, string listViewType, Azure.RequestContext context) +{ + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/indexes", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (maxCount != null) + { + uri.AppendQuery("top", maxCount.Value, true); + } + if (skip != null) + { + uri.AppendQuery("skip", skip, true); + } + if (tags != null) + { + uri.AppendQuery("tags", tags, true); + } + if (listViewType != null) + { + uri.AppendQuery("listViewType", listViewType, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; +} + +internal HttpMessage CreateGetVersionRequest(string name, string version, Azure.RequestContext context) +{ + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/indexes/", false); + uri.AppendPath(name, true); + uri.AppendPath("/versions/", false); + uri.AppendPath(version, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; +} + +internal HttpMessage CreateDeleteVersionRequest(string name, string version, Azure.RequestContext context) +{ + var message = _pipeline.CreateMessage(context, ResponseClassifier204); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/indexes/", false); + uri.AppendPath(name, true); + uri.AppendPath("/versions/", false); + uri.AppendPath(version, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; +} + +internal HttpMessage CreateCreateRequest(string name, RequestContent content, Azure.RequestContext context) +{ + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/indexes/", false); + uri.AppendPath(name, true); + uri.AppendPath("/versions", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Repeatability-Request-ID", Guid.NewGuid()); + request.Headers.Add("Repeatability-First-Sent", DateTimeOffset.Now, "R"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; +} + +internal HttpMessage CreateCreateVersionRequest(string name, string version, RequestContent content, Azure.RequestContext context) +{ + var message = _pipeline.CreateMessage(context, ResponseClassifier200201); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/indexes/", false); + uri.AppendPath(name, true); + uri.AppendPath("/versions/", false); + uri.AppendPath(version, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; +} + +internal HttpMessage CreateGetVersionsNextPageRequest(string nextLink, string name, int? maxCount, string skip, string tags, string listViewType, Azure.RequestContext context) +{ + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; +} + +internal HttpMessage CreateGetLatestsNextPageRequest(string nextLink, int? maxCount, string skip, string tags, string listViewType, Azure.RequestContext context) +{ + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; +} + +private static Azure.RequestContext DefaultRequestContext = new Azure.RequestContext(); +internal static Azure.RequestContext FromCancellationToken(CancellationToken cancellationToken = default) +{ + if (!cancellationToken.CanBeCanceled) + { + return DefaultRequestContext; + } + + return new Azure.RequestContext() { CancellationToken = cancellationToken }; +} + +private static ResponseClassifier _responseClassifier200; +private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); +private static ResponseClassifier _responseClassifier204; +private static ResponseClassifier ResponseClassifier204 => _responseClassifier204 ??= new StatusCodeClassifier(stackalloc ushort[] { 204 }); +private static ResponseClassifier _responseClassifier200201; +private static ResponseClassifier ResponseClassifier200201 => _responseClassifier200201 ??= new StatusCodeClassifier(stackalloc ushort[] { 200, 201 }); +} +} diff --git a/sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownBaseCredential.Serialization.cs b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownBaseCredential.Serialization.cs new file mode 100644 index 000000000000..045daa4b5f29 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownBaseCredential.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Projects.1DP +{ +internal partial class UnknownBaseCredential : IUtf8JsonSerializable, System.ClientModel.Primitives.IJsonModel +{ + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((System.ClientModel.Primitives.IJsonModel < AI.Projects.1DP.BaseCredential>)this).Write(writer, Projects.1DP.ModelSerializationExtensions.WireOptions); + + void System.ClientModel.Primitives.IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + this.JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((System.ClientModel.Primitives.IPersistableModel < AI.Projects.1DP.BaseCredential >)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AI.Projects.1DP.BaseCredential)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + Projects.1DP.BaseCredential System.ClientModel.Primitives.IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((System.ClientModel.Primitives.IPersistableModel < AI.Projects.1DP.BaseCredential >)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AI.Projects.1DP.BaseCredential)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return AI.Projects.1DP.BaseCredential.DeserializeBaseCredential(document.RootElement, options); + } + + internal static Projects.1DP.UnknownBaseCredential DeserializeUnknownBaseCredential(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= AI.Projects.1DP.ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AI.Projects.1DP.CredentialType type = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new Projects.1DP.CredentialType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Projects.1DP.UnknownBaseCredential(type, serializedAdditionalRawData); + } + + BinaryData System.ClientModel.Primitives.IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((System.ClientModel.Primitives.IPersistableModel < AI.Projects.1DP.BaseCredential >)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AI.Projects.1DP.BaseCredential)} does not support writing '{options.Format}' format."); + } + } + + Projects.1DP.BaseCredential System.ClientModel.Primitives.IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((System.ClientModel.Primitives.IPersistableModel < AI.Projects.1DP.BaseCredential >)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, AI.Projects.1DP.ModelSerializationExtensions.JsonDocumentOptions); + return AI.Projects.1DP.BaseCredential.DeserializeBaseCredential(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AI.Projects.1DP.BaseCredential)} does not support reading '{options.Format}' format."); + } + } + + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new Projects.1DP.UnknownBaseCredential FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, AI.Projects.1DP.ModelSerializationExtensions.JsonDocumentOptions); + return AI.Projects.1DP.UnknownBaseCredential.DeserializeUnknownBaseCredential(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Projects.1DP.Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue < AI.Projects.1DP.BaseCredential > (this, AI.Projects.1DP.ModelSerializationExtensions.WireOptions); + return content; + } +} +} diff --git a/sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownBaseCredential.cs b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownBaseCredential.cs new file mode 100644 index 000000000000..1147e9fb1b0e --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownBaseCredential.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Projects.1DP +{ +/// Unknown version of BaseCredential. +internal partial class UnknownBaseCredential : Projects.1DP.BaseCredential +{ + /// Initializes a new instance of . + /// Type of credential. Possible values are: AAD, SAS, ApiKey. + /// Keeps track of any properties unknown to the library. + internal UnknownBaseCredential(Projects.1DP.CredentialType type, IDictionary serializedAdditionalRawData) : base(type, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownBaseCredential() + { + } +} +} diff --git a/sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownDatasetVersion.Serialization.cs b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownDatasetVersion.Serialization.cs new file mode 100644 index 000000000000..fb420ac3abf4 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownDatasetVersion.Serialization.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Projects.1DP +{ +internal partial class UnknownDatasetVersion : IUtf8JsonSerializable, System.ClientModel.Primitives.IJsonModel +{ + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((System.ClientModel.Primitives.IJsonModel < AI.Projects.1DP.DatasetVersion>)this).Write(writer, Projects.1DP.ModelSerializationExtensions.WireOptions); + + void System.ClientModel.Primitives.IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + this.JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((System.ClientModel.Primitives.IPersistableModel < AI.Projects.1DP.DatasetVersion >)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AI.Projects.1DP.DatasetVersion)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + Projects.1DP.DatasetVersion System.ClientModel.Primitives.IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((System.ClientModel.Primitives.IPersistableModel < AI.Projects.1DP.DatasetVersion >)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AI.Projects.1DP.DatasetVersion)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return AI.Projects.1DP.DatasetVersion.DeserializeDatasetVersion(document.RootElement, options); + } + + internal static Projects.1DP.UnknownDatasetVersion DeserializeUnknownDatasetVersion(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= AI.Projects.1DP.ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string datasetUri = default; + AI.Projects.1DP.DatasetType type = "Unknown"; + bool? isReference = default; + string stage = default; + string id = default; + string name = default; + string version = default; + string description = default; + IDictionary tags = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("datasetUri"u8)) + { + datasetUri = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new Projects.1DP.DatasetType(property.Value.GetString()); + continue; + } + if (property.NameEquals("isReference"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isReference = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("stage"u8)) + { + stage = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("version"u8)) + { + version = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Projects.1DP.UnknownDatasetVersion( + datasetUri, + type, + isReference, + stage, + id, + name, + version, + description, + (tags ?? new Projects.1DP.ChangeTrackingDictionary()), + serializedAdditionalRawData); + } + + BinaryData System.ClientModel.Primitives.IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((System.ClientModel.Primitives.IPersistableModel < AI.Projects.1DP.DatasetVersion >)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AI.Projects.1DP.DatasetVersion)} does not support writing '{options.Format}' format."); + } + } + + Projects.1DP.DatasetVersion System.ClientModel.Primitives.IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((System.ClientModel.Primitives.IPersistableModel < AI.Projects.1DP.DatasetVersion >)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, AI.Projects.1DP.ModelSerializationExtensions.JsonDocumentOptions); + return AI.Projects.1DP.DatasetVersion.DeserializeDatasetVersion(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AI.Projects.1DP.DatasetVersion)} does not support reading '{options.Format}' format."); + } + } + + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new Projects.1DP.UnknownDatasetVersion FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, AI.Projects.1DP.ModelSerializationExtensions.JsonDocumentOptions); + return AI.Projects.1DP.UnknownDatasetVersion.DeserializeUnknownDatasetVersion(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Projects.1DP.Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue < AI.Projects.1DP.DatasetVersion > (this, AI.Projects.1DP.ModelSerializationExtensions.WireOptions); + return content; + } +} +} diff --git a/sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownDatasetVersion.cs b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownDatasetVersion.cs new file mode 100644 index 000000000000..8fd8d0c3b3fd --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownDatasetVersion.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Projects.1DP +{ +/// Unknown version of DatasetVersion. +internal partial class UnknownDatasetVersion : Projects.1DP.DatasetVersion +{ + /// Initializes a new instance of . + /// [Required] Uri of the data. Example: https://go.microsoft.com/fwlink/?linkid=2202330. + /// Dataset type. + /// Indicates if dataset is reference only or managed by dataset service. If true, the underlying data will be deleted when the dataset version is deleted. + /// Asset stage. + /// A unique identifier for the asset, assetId probably?. + /// The name of the resource. + /// The version of the resource. + /// The asset description text. + /// Tag dictionary. Tags can be added, removed, and updated. + /// Keeps track of any properties unknown to the library. + internal UnknownDatasetVersion(string datasetUri, Projects.1DP.DatasetType type, bool? isReference, string stage, string id, string name, string version, string description, IDictionary tags, IDictionary serializedAdditionalRawData) : base(datasetUri, type, isReference, stage, id, name, version, description, tags, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownDatasetVersion() + { + } +} +} diff --git a/sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownDeployment.Serialization.cs b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownDeployment.Serialization.cs new file mode 100644 index 000000000000..c0e745bcabdb --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownDeployment.Serialization.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Projects.1DP +{ +internal partial class UnknownDeployment : IUtf8JsonSerializable, System.ClientModel.Primitives.IJsonModel +{ + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((System.ClientModel.Primitives.IJsonModel < AI.Projects.1DP.Deployment>)this).Write(writer, Projects.1DP.ModelSerializationExtensions.WireOptions); + + void System.ClientModel.Primitives.IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + this.JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((System.ClientModel.Primitives.IPersistableModel < AI.Projects.1DP.Deployment >)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AI.Projects.1DP.Deployment)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + Projects.1DP.Deployment System.ClientModel.Primitives.IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((System.ClientModel.Primitives.IPersistableModel < AI.Projects.1DP.Deployment >)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AI.Projects.1DP.Deployment)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return AI.Projects.1DP.Deployment.DeserializeDeployment(document.RootElement, options); + } + + internal static Projects.1DP.UnknownDeployment DeserializeUnknownDeployment(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= AI.Projects.1DP.ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AI.Projects.1DP.DeploymentType type = "Unknown"; + string name = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new Projects.1DP.DeploymentType(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Projects.1DP.UnknownDeployment(type, name, serializedAdditionalRawData); + } + + BinaryData System.ClientModel.Primitives.IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((System.ClientModel.Primitives.IPersistableModel < AI.Projects.1DP.Deployment >)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AI.Projects.1DP.Deployment)} does not support writing '{options.Format}' format."); + } + } + + Projects.1DP.Deployment System.ClientModel.Primitives.IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((System.ClientModel.Primitives.IPersistableModel < AI.Projects.1DP.Deployment >)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, AI.Projects.1DP.ModelSerializationExtensions.JsonDocumentOptions); + return AI.Projects.1DP.Deployment.DeserializeDeployment(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AI.Projects.1DP.Deployment)} does not support reading '{options.Format}' format."); + } + } + + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new Projects.1DP.UnknownDeployment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, AI.Projects.1DP.ModelSerializationExtensions.JsonDocumentOptions); + return AI.Projects.1DP.UnknownDeployment.DeserializeUnknownDeployment(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Projects.1DP.Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue < AI.Projects.1DP.Deployment > (this, AI.Projects.1DP.ModelSerializationExtensions.WireOptions); + return content; + } +} +} diff --git a/sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownDeployment.cs b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownDeployment.cs new file mode 100644 index 000000000000..77d9dbf60a50 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownDeployment.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Projects.1DP +{ +/// Unknown version of Deployment. +internal partial class UnknownDeployment : Projects.1DP.Deployment +{ + /// Initializes a new instance of . + /// The type of the deployment. + /// Name of the deployment. + /// Keeps track of any properties unknown to the library. + internal UnknownDeployment(Projects.1DP.DeploymentType type, string name, IDictionary serializedAdditionalRawData) : base(type, name, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownDeployment() + { + } +} +} diff --git a/sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownIndex.Serialization.cs b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownIndex.Serialization.cs new file mode 100644 index 000000000000..1706c8d5caf1 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownIndex.Serialization.cs @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Projects.1DP +{ +internal partial class UnknownIndex : IUtf8JsonSerializable, System.ClientModel.Primitives.IJsonModel +{ + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((System.ClientModel.Primitives.IJsonModel < AI.Projects.1DP.Index>)this).Write(writer, Projects.1DP.ModelSerializationExtensions.WireOptions); + + void System.ClientModel.Primitives.IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + this.JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((System.ClientModel.Primitives.IPersistableModel < AI.Projects.1DP.Index >)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AI.Projects.1DP.Index)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + Projects.1DP.Index System.ClientModel.Primitives.IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((System.ClientModel.Primitives.IPersistableModel < AI.Projects.1DP.Index >)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AI.Projects.1DP.Index)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return AI.Projects.1DP.Index.DeserializeIndex(document.RootElement, options); + } + + internal static Projects.1DP.UnknownIndex DeserializeUnknownIndex(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= AI.Projects.1DP.ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AI.Projects.1DP.IndexType type = "Unknown"; + string stage = default; + string id = default; + string name = default; + string version = default; + string description = default; + IDictionary tags = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new Projects.1DP.IndexType(property.Value.GetString()); + continue; + } + if (property.NameEquals("stage"u8)) + { + stage = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("version"u8)) + { + version = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Projects.1DP.UnknownIndex( + type, + stage, + id, + name, + version, + description, + (tags ?? new Projects.1DP.ChangeTrackingDictionary()), + serializedAdditionalRawData); + } + + BinaryData System.ClientModel.Primitives.IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((System.ClientModel.Primitives.IPersistableModel < AI.Projects.1DP.Index >)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AI.Projects.1DP.Index)} does not support writing '{options.Format}' format."); + } + } + + Projects.1DP.Index System.ClientModel.Primitives.IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((System.ClientModel.Primitives.IPersistableModel < AI.Projects.1DP.Index >)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, AI.Projects.1DP.ModelSerializationExtensions.JsonDocumentOptions); + return AI.Projects.1DP.Index.DeserializeIndex(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AI.Projects.1DP.Index)} does not support reading '{options.Format}' format."); + } + } + + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new Projects.1DP.UnknownIndex FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, AI.Projects.1DP.ModelSerializationExtensions.JsonDocumentOptions); + return AI.Projects.1DP.UnknownIndex.DeserializeUnknownIndex(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Projects.1DP.Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue < AI.Projects.1DP.Index > (this, AI.Projects.1DP.ModelSerializationExtensions.WireOptions); + return content; + } +} +} diff --git a/sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownIndex.cs b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownIndex.cs new file mode 100644 index 000000000000..d20a830000ea --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownIndex.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Projects.1DP +{ +/// Unknown version of Index. +internal partial class UnknownIndex : Projects.1DP.Index +{ + /// Initializes a new instance of . + /// Type of index. + /// Asset stage. + /// A unique identifier for the asset, assetId probably?. + /// The name of the resource. + /// The version of the resource. + /// The asset description text. + /// Tag dictionary. Tags can be added, removed, and updated. + /// Keeps track of any properties unknown to the library. + internal UnknownIndex(Projects.1DP.IndexType type, string stage, string id, string name, string version, string description, IDictionary tags, IDictionary serializedAdditionalRawData) : base(type, stage, id, name, version, description, tags, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownIndex() + { + } +} +} diff --git a/sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownInputData.Serialization.cs b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownInputData.Serialization.cs new file mode 100644 index 000000000000..6aa4e290534e --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownInputData.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Projects.1DP +{ +internal partial class UnknownInputData : IUtf8JsonSerializable, System.ClientModel.Primitives.IJsonModel +{ + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((System.ClientModel.Primitives.IJsonModel < AI.Projects.1DP.InputData>)this).Write(writer, Projects.1DP.ModelSerializationExtensions.WireOptions); + + void System.ClientModel.Primitives.IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + this.JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((System.ClientModel.Primitives.IPersistableModel < AI.Projects.1DP.InputData >)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AI.Projects.1DP.InputData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + Projects.1DP.InputData System.ClientModel.Primitives.IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((System.ClientModel.Primitives.IPersistableModel < AI.Projects.1DP.InputData >)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AI.Projects.1DP.InputData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return AI.Projects.1DP.InputData.DeserializeInputData(document.RootElement, options); + } + + internal static Projects.1DP.UnknownInputData DeserializeUnknownInputData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= AI.Projects.1DP.ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string type = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Projects.1DP.UnknownInputData(type, serializedAdditionalRawData); + } + + BinaryData System.ClientModel.Primitives.IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((System.ClientModel.Primitives.IPersistableModel < AI.Projects.1DP.InputData >)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AI.Projects.1DP.InputData)} does not support writing '{options.Format}' format."); + } + } + + Projects.1DP.InputData System.ClientModel.Primitives.IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((System.ClientModel.Primitives.IPersistableModel < AI.Projects.1DP.InputData >)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, AI.Projects.1DP.ModelSerializationExtensions.JsonDocumentOptions); + return AI.Projects.1DP.InputData.DeserializeInputData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AI.Projects.1DP.InputData)} does not support reading '{options.Format}' format."); + } + } + + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new Projects.1DP.UnknownInputData FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, AI.Projects.1DP.ModelSerializationExtensions.JsonDocumentOptions); + return AI.Projects.1DP.UnknownInputData.DeserializeUnknownInputData(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Projects.1DP.Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue < AI.Projects.1DP.InputData > (this, AI.Projects.1DP.ModelSerializationExtensions.WireOptions); + return content; + } +} +} diff --git a/sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownInputData.cs b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownInputData.cs new file mode 100644 index 000000000000..47c75d22404c --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/src/Generated/UnknownInputData.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Projects.1DP +{ +/// Unknown version of InputData. +internal partial class UnknownInputData : Projects.1DP.InputData +{ + /// Initializes a new instance of . + /// Type of the data. + /// Keeps track of any properties unknown to the library. + internal UnknownInputData(string type, IDictionary serializedAdditionalRawData) : base(type, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownInputData() + { + } +} +} diff --git a/sdk/ai/Azure.AI.Projects.1DP/src/Properties/AssemblyInfo.cs b/sdk/ai/Azure.AI.Projects.1DP/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..7d2f0243085a --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/src/Properties/AssemblyInfo.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Azure.AI.Projects.1DP.Tests, PublicKey = 0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] + +// Replace Microsoft.Test with the correct resource provider namepace for your service and uncomment. +// See https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-services-resource-providers +// for the list of possible values. +[assembly: Azure.Core.AzureResourceProviderNamespace("Microsoft.Template")] diff --git a/sdk/ai/Azure.AI.Projects.1DP/tests/Azure.AI.Projects.1DP.Tests.csproj b/sdk/ai/Azure.AI.Projects.1DP/tests/Azure.AI.Projects.1DP.Tests.csproj new file mode 100644 index 000000000000..ac4b04509d6d --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/tests/Azure.AI.Projects.1DP.Tests.csproj @@ -0,0 +1,20 @@ + + + $(RequiredTargetFrameworks) + + $(NoWarn);CS1591 + + + + + + + + + + + + + + + diff --git a/sdk/ai/Azure.AI.Projects.1DP/tests/Generated/Samples/Samples_Connections.cs b/sdk/ai/Azure.AI.Projects.1DP/tests/Generated/Samples/Samples_Connections.cs new file mode 100644 index 000000000000..b1aa1b2995df --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/tests/Generated/Samples/Samples_Connections.cs @@ -0,0 +1,262 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading.Tasks; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.AI.Projects.1DP.Samples +{ +public partial class Samples_Connections +{ + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Connection_GetConnection_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Connections client = new Projects.1DP.AIProjectClient(endpoint, credential).GetConnectionsClient(apiVersion: "2025-05-15-preview"); + + Response response = client.GetConnection("", (RequestContext)null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("authType").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Connection_GetConnection_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Connections client = new Projects.1DP.AIProjectClient(endpoint, credential).GetConnectionsClient(apiVersion: "2025-05-15-preview"); + + Response response = await client.GetConnectionAsync("", (RequestContext)null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("authType").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Connection_GetConnection_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Connections client = new Projects.1DP.AIProjectClient(endpoint, credential).GetConnectionsClient(apiVersion: "2025-05-15-preview"); + + Azure.Response < AI.Projects.1DP.Connection > response = client.GetConnection(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Connection_GetConnection_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Connections client = new Projects.1DP.AIProjectClient(endpoint, credential).GetConnectionsClient(apiVersion: "2025-05-15-preview"); + + Azure.Response < AI.Projects.1DP.Connection > response = await client.GetConnectionAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Connection_GetConnection_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Connections client = new Projects.1DP.AIProjectClient(endpoint, credential).GetConnectionsClient(apiVersion: "2025-05-15-preview"); + + Response response = client.GetConnection("", (RequestContext)null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("authType").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Connection_GetConnection_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Connections client = new Projects.1DP.AIProjectClient(endpoint, credential).GetConnectionsClient(apiVersion: "2025-05-15-preview"); + + Response response = await client.GetConnectionAsync("", (RequestContext)null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("authType").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Connection_GetConnection_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Connections client = new Projects.1DP.AIProjectClient(endpoint, credential).GetConnectionsClient(apiVersion: "2025-05-15-preview"); + + Azure.Response < AI.Projects.1DP.Connection > response = client.GetConnection(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Connection_GetConnection_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Connections client = new Projects.1DP.AIProjectClient(endpoint, credential).GetConnectionsClient(apiVersion: "2025-05-15-preview"); + + Azure.Response < AI.Projects.1DP.Connection > response = await client.GetConnectionAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Connection_GetConnections_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Connections client = new Projects.1DP.AIProjectClient(endpoint, credential).GetConnectionsClient(apiVersion: "2025-05-15-preview"); + + foreach (BinaryData item in client.GetConnections((string)null, (int?)null, (int?)null, (int?)null, (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("authType").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Connection_GetConnections_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Connections client = new Projects.1DP.AIProjectClient(endpoint, credential).GetConnectionsClient(apiVersion: "2025-05-15-preview"); + + await foreach (BinaryData item in client.GetConnectionsAsync((string)null, (int?)null, (int?)null, (int?)null, (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("authType").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Connection_GetConnections_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Connections client = new Projects.1DP.AIProjectClient(endpoint, credential).GetConnectionsClient(apiVersion: "2025-05-15-preview"); + + foreach (Projects.1DP.Connection item in client.GetConnections()) +{ + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Connection_GetConnections_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Connections client = new Projects.1DP.AIProjectClient(endpoint, credential).GetConnectionsClient(apiVersion: "2025-05-15-preview"); + + await foreach (Projects.1DP.Connection item in client.GetConnectionsAsync()) +{ + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Connection_GetConnections_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Connections client = new Projects.1DP.AIProjectClient(endpoint, credential).GetConnectionsClient(apiVersion: "2025-05-15-preview"); + + foreach (BinaryData item in client.GetConnections("AzureOpenAI", 1234, 1234, 1234, (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("authType").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Connection_GetConnections_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Connections client = new Projects.1DP.AIProjectClient(endpoint, credential).GetConnectionsClient(apiVersion: "2025-05-15-preview"); + + await foreach (BinaryData item in client.GetConnectionsAsync("AzureOpenAI", 1234, 1234, 1234, (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("authType").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Connection_GetConnections_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Connections client = new Projects.1DP.AIProjectClient(endpoint, credential).GetConnectionsClient(apiVersion: "2025-05-15-preview"); + + foreach (Projects.1DP.Connection item in client.GetConnections(connectionType: AI.Projects.1DP.ConnectionType.AzureOpenAI, maxCount: 1234, skip: 1234, maxpagesize: 1234)) +{ + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Connection_GetConnections_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Connections client = new Projects.1DP.AIProjectClient(endpoint, credential).GetConnectionsClient(apiVersion: "2025-05-15-preview"); + + await foreach (Projects.1DP.Connection item in client.GetConnectionsAsync(connectionType: AI.Projects.1DP.ConnectionType.AzureOpenAI, maxCount: 1234, skip: 1234, maxpagesize: 1234)) +{ + } + } +} +} diff --git a/sdk/ai/Azure.AI.Projects.1DP/tests/Generated/Samples/Samples_Datasets.cs b/sdk/ai/Azure.AI.Projects.1DP/tests/Generated/Samples/Samples_Datasets.cs new file mode 100644 index 000000000000..56f5c2673b1c --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/tests/Generated/Samples/Samples_Datasets.cs @@ -0,0 +1,1133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.AI.Projects.1DP.Samples +{ +public partial class Samples_Datasets +{ + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Datasets_GetVersion_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + Response response = client.GetVersion("", "", (RequestContext)null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("datasetUri").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Datasets_GetVersion_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + Response response = await client.GetVersionAsync("", "", (RequestContext)null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("datasetUri").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Datasets_GetVersion_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + Azure.Response < AI.Projects.1DP.DatasetVersion > response = client.GetVersion("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Datasets_GetVersion_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + Azure.Response < AI.Projects.1DP.DatasetVersion > response = await client.GetVersionAsync("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Datasets_GetVersion_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + Response response = client.GetVersion("", "", (RequestContext)null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("datasetUri").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("isReference").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Datasets_GetVersion_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + Response response = await client.GetVersionAsync("", "", (RequestContext)null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("datasetUri").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("isReference").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Datasets_GetVersion_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + Azure.Response < AI.Projects.1DP.DatasetVersion > response = client.GetVersion("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Datasets_GetVersion_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + Azure.Response < AI.Projects.1DP.DatasetVersion > response = await client.GetVersionAsync("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Datasets_DeleteVersion_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + Response response = client.DeleteVersion("", ""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Datasets_DeleteVersion_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + Response response = await client.DeleteVersionAsync("", ""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Datasets_DeleteVersion_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + Response response = client.DeleteVersion("", ""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Datasets_DeleteVersion_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + Response response = await client.DeleteVersionAsync("", ""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Datasets_Create_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + type = "uri_file", + openAIPurpose = "", + datasetUri = "", + }); + Response response = client.Create("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("datasetUri").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Datasets_Create_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + type = "uri_file", + openAIPurpose = "", + datasetUri = "", + }); + Response response = await client.CreateAsync("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("datasetUri").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Datasets_Create_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.DatasetVersion body = new Projects.1DP.FileDatasetVersion("", ""); + Azure.Response < AI.Projects.1DP.DatasetVersion > response = client.Create("", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Datasets_Create_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.DatasetVersion body = new Projects.1DP.FileDatasetVersion("", ""); + Azure.Response < AI.Projects.1DP.DatasetVersion > response = await client.CreateAsync("", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Datasets_Create_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + type = "uri_file", + openAIPurpose = "", + datasetUri = "", + stage = "", + description = "", + tags = new + { + key = "", + }, + }); + Response response = client.Create("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("datasetUri").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("isReference").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Datasets_Create_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + type = "uri_file", + openAIPurpose = "", + datasetUri = "", + stage = "", + description = "", + tags = new + { + key = "", + }, + }); + Response response = await client.CreateAsync("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("datasetUri").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("isReference").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Datasets_Create_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.DatasetVersion body = new Projects.1DP.FileDatasetVersion("", "") + { + Stage = "", +Description = "", +Tags = + { + ["key"] = "" + }, +}; + Azure.Response < AI.Projects.1DP.DatasetVersion > response = client.Create("", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Datasets_Create_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.DatasetVersion body = new Projects.1DP.FileDatasetVersion("", "") + { + Stage = "", +Description = "", +Tags = + { + ["key"] = "" + }, +}; + Azure.Response < AI.Projects.1DP.DatasetVersion > response = await client.CreateAsync("", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Datasets_CreateVersion_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + type = "uri_file", + openAIPurpose = "", + datasetUri = "", + }); + Response response = client.CreateVersion("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("datasetUri").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Datasets_CreateVersion_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + type = "uri_file", + openAIPurpose = "", + datasetUri = "", + }); + Response response = await client.CreateVersionAsync("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("datasetUri").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Datasets_CreateVersion_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.DatasetVersion body = new Projects.1DP.FileDatasetVersion("", ""); + Azure.Response < AI.Projects.1DP.DatasetVersion > response = client.CreateVersion("", "", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Datasets_CreateVersion_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.DatasetVersion body = new Projects.1DP.FileDatasetVersion("", ""); + Azure.Response < AI.Projects.1DP.DatasetVersion > response = await client.CreateVersionAsync("", "", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Datasets_CreateVersion_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + type = "uri_file", + openAIPurpose = "", + datasetUri = "", + stage = "", + description = "", + tags = new + { + key = "", + }, + }); + Response response = client.CreateVersion("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("datasetUri").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("isReference").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Datasets_CreateVersion_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + type = "uri_file", + openAIPurpose = "", + datasetUri = "", + stage = "", + description = "", + tags = new + { + key = "", + }, + }); + Response response = await client.CreateVersionAsync("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("datasetUri").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("isReference").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Datasets_CreateVersion_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.DatasetVersion body = new Projects.1DP.FileDatasetVersion("", "") + { + Stage = "", +Description = "", +Tags = + { + ["key"] = "" + }, +}; + Azure.Response < AI.Projects.1DP.DatasetVersion > response = client.CreateVersion("", "", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Datasets_CreateVersion_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.DatasetVersion body = new Projects.1DP.FileDatasetVersion("", "") + { + Stage = "", +Description = "", +Tags = + { + ["key"] = "" + }, +}; + Azure.Response < AI.Projects.1DP.DatasetVersion > response = await client.CreateVersionAsync("", "", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Datasets_StartPendingUploadVersion_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + pendingUploadType = "TemporaryBlobReference", + }); + Response response = client.StartPendingUploadVersion("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("blobUri").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("storageAccountArmId").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("sasToken").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("pendingUploadId").ToString()); + Console.WriteLine(result.GetProperty("pendingUploadType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Datasets_StartPendingUploadVersion_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + pendingUploadType = "TemporaryBlobReference", + }); + Response response = await client.StartPendingUploadVersionAsync("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("blobUri").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("storageAccountArmId").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("sasToken").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("pendingUploadId").ToString()); + Console.WriteLine(result.GetProperty("pendingUploadType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Datasets_StartPendingUploadVersion_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.PendingUploadRequest body = new Projects.1DP.PendingUploadRequest(); + Azure.Response < AI.Projects.1DP.PendingUploadResponse > response = client.StartPendingUploadVersion("", "", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Datasets_StartPendingUploadVersion_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.PendingUploadRequest body = new Projects.1DP.PendingUploadRequest(); + Azure.Response < AI.Projects.1DP.PendingUploadResponse > response = await client.StartPendingUploadVersionAsync("", "", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Datasets_StartPendingUploadVersion_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + pendingUploadId = "", + connectionName = "", + pendingUploadType = "TemporaryBlobReference", + }); + Response response = client.StartPendingUploadVersion("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("blobUri").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("storageAccountArmId").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("sasToken").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("pendingUploadId").ToString()); + Console.WriteLine(result.GetProperty("datasetVersion").ToString()); + Console.WriteLine(result.GetProperty("pendingUploadType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Datasets_StartPendingUploadVersion_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + pendingUploadId = "", + connectionName = "", + pendingUploadType = "TemporaryBlobReference", + }); + Response response = await client.StartPendingUploadVersionAsync("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("blobUri").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("storageAccountArmId").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("sasToken").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("pendingUploadId").ToString()); + Console.WriteLine(result.GetProperty("datasetVersion").ToString()); + Console.WriteLine(result.GetProperty("pendingUploadType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Datasets_StartPendingUploadVersion_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.PendingUploadRequest body = new Projects.1DP.PendingUploadRequest + { + PendingUploadId = "", +ConnectionName = "", +}; + Azure.Response < AI.Projects.1DP.PendingUploadResponse > response = client.StartPendingUploadVersion("", "", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Datasets_StartPendingUploadVersion_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.PendingUploadRequest body = new Projects.1DP.PendingUploadRequest + { + PendingUploadId = "", +ConnectionName = "", +}; + Azure.Response < AI.Projects.1DP.PendingUploadResponse > response = await client.StartPendingUploadVersionAsync("", "", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Datasets_StartPendingUpload_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + pendingUploadType = "TemporaryBlobReference", + }); + Response response = client.StartPendingUpload("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("blobUri").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("storageAccountArmId").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("sasToken").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("pendingUploadId").ToString()); + Console.WriteLine(result.GetProperty("pendingUploadType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Datasets_StartPendingUpload_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + pendingUploadType = "TemporaryBlobReference", + }); + Response response = await client.StartPendingUploadAsync("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("blobUri").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("storageAccountArmId").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("sasToken").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("pendingUploadId").ToString()); + Console.WriteLine(result.GetProperty("pendingUploadType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Datasets_StartPendingUpload_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.PendingUploadRequest body = new Projects.1DP.PendingUploadRequest(); + Azure.Response < AI.Projects.1DP.PendingUploadResponse > response = client.StartPendingUpload("", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Datasets_StartPendingUpload_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.PendingUploadRequest body = new Projects.1DP.PendingUploadRequest(); + Azure.Response < AI.Projects.1DP.PendingUploadResponse > response = await client.StartPendingUploadAsync("", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Datasets_StartPendingUpload_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + pendingUploadId = "", + connectionName = "", + pendingUploadType = "TemporaryBlobReference", + }); + Response response = client.StartPendingUpload("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("blobUri").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("storageAccountArmId").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("sasToken").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("pendingUploadId").ToString()); + Console.WriteLine(result.GetProperty("datasetVersion").ToString()); + Console.WriteLine(result.GetProperty("pendingUploadType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Datasets_StartPendingUpload_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + pendingUploadId = "", + connectionName = "", + pendingUploadType = "TemporaryBlobReference", + }); + Response response = await client.StartPendingUploadAsync("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("blobUri").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("storageAccountArmId").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("sasToken").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("pendingUploadId").ToString()); + Console.WriteLine(result.GetProperty("datasetVersion").ToString()); + Console.WriteLine(result.GetProperty("pendingUploadType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Datasets_StartPendingUpload_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.PendingUploadRequest body = new Projects.1DP.PendingUploadRequest + { + PendingUploadId = "", +ConnectionName = "", +}; + Azure.Response < AI.Projects.1DP.PendingUploadResponse > response = client.StartPendingUpload("", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Datasets_StartPendingUpload_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.PendingUploadRequest body = new Projects.1DP.PendingUploadRequest + { + PendingUploadId = "", +ConnectionName = "", +}; + Azure.Response < AI.Projects.1DP.PendingUploadResponse > response = await client.StartPendingUploadAsync("", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Datasets_GetVersions_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + foreach (BinaryData item in client.GetVersions("", (int?)null, (string)null, (string)null, (string)null, (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("datasetUri").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Datasets_GetVersions_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + await foreach (BinaryData item in client.GetVersionsAsync("", (int?)null, (string)null, (string)null, (string)null, (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("datasetUri").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Datasets_GetVersions_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + foreach (Projects.1DP.DatasetVersion item in client.GetVersions("")) +{ + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Datasets_GetVersions_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + await foreach (Projects.1DP.DatasetVersion item in client.GetVersionsAsync("")) +{ + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Datasets_GetVersions_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + foreach (BinaryData item in client.GetVersions("", 1234, "", "", "ActiveOnly", (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("datasetUri").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("isReference").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Datasets_GetVersions_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + await foreach (BinaryData item in client.GetVersionsAsync("", 1234, "", "", "ActiveOnly", (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("datasetUri").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("isReference").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Datasets_GetVersions_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + foreach (Projects.1DP.DatasetVersion item in client.GetVersions("", maxCount: 1234, skip: "", tags: "", listViewType: AI.Projects.1DP.ListViewType.ActiveOnly)) +{ + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Datasets_GetVersions_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + await foreach (Projects.1DP.DatasetVersion item in client.GetVersionsAsync("", maxCount: 1234, skip: "", tags: "", listViewType: AI.Projects.1DP.ListViewType.ActiveOnly)) +{ + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DatasetVersion_GetLatests_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + foreach (BinaryData item in client.GetLatests((int?)null, (string)null, (string)null, (string)null, (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("datasetUri").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DatasetVersion_GetLatests_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + await foreach (BinaryData item in client.GetLatestsAsync((int?)null, (string)null, (string)null, (string)null, (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("datasetUri").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DatasetVersion_GetLatests_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + foreach (Projects.1DP.DatasetVersion item in client.GetLatests()) +{ + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DatasetVersion_GetLatests_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + await foreach (Projects.1DP.DatasetVersion item in client.GetLatestsAsync()) +{ + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DatasetVersion_GetLatests_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + foreach (BinaryData item in client.GetLatests(1234, "", "", "ActiveOnly", (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("datasetUri").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("isReference").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DatasetVersion_GetLatests_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + await foreach (BinaryData item in client.GetLatestsAsync(1234, "", "", "ActiveOnly", (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("datasetUri").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("isReference").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DatasetVersion_GetLatests_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + foreach (Projects.1DP.DatasetVersion item in client.GetLatests(maxCount: 1234, skip: "", tags: "", listViewType: AI.Projects.1DP.ListViewType.ActiveOnly)) +{ + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DatasetVersion_GetLatests_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Datasets client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDatasetsClient(apiVersion: "2025-05-15-preview"); + + await foreach (Projects.1DP.DatasetVersion item in client.GetLatestsAsync(maxCount: 1234, skip: "", tags: "", listViewType: AI.Projects.1DP.ListViewType.ActiveOnly)) +{ + } + } +} +} diff --git a/sdk/ai/Azure.AI.Projects.1DP/tests/Generated/Samples/Samples_Deployments.cs b/sdk/ai/Azure.AI.Projects.1DP/tests/Generated/Samples/Samples_Deployments.cs new file mode 100644 index 000000000000..9c0358146713 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/tests/Generated/Samples/Samples_Deployments.cs @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading.Tasks; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.AI.Projects.1DP.Samples +{ +public partial class Samples_Deployments +{ + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Deployment_GetDeployment_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Deployments client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDeploymentsClient(apiVersion: "2025-05-15-preview"); + + Response response = client.GetDeployment("", (RequestContext)null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Deployment_GetDeployment_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Deployments client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDeploymentsClient(apiVersion: "2025-05-15-preview"); + + Response response = await client.GetDeploymentAsync("", (RequestContext)null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Deployment_GetDeployment_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Deployments client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDeploymentsClient(apiVersion: "2025-05-15-preview"); + + Azure.Response < AI.Projects.1DP.Deployment > response = client.GetDeployment(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Deployment_GetDeployment_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Deployments client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDeploymentsClient(apiVersion: "2025-05-15-preview"); + + Azure.Response < AI.Projects.1DP.Deployment > response = await client.GetDeploymentAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Deployment_GetDeployment_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Deployments client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDeploymentsClient(apiVersion: "2025-05-15-preview"); + + Response response = client.GetDeployment("", (RequestContext)null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Deployment_GetDeployment_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Deployments client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDeploymentsClient(apiVersion: "2025-05-15-preview"); + + Response response = await client.GetDeploymentAsync("", (RequestContext)null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Deployment_GetDeployment_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Deployments client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDeploymentsClient(apiVersion: "2025-05-15-preview"); + + Azure.Response < AI.Projects.1DP.Deployment > response = client.GetDeployment(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Deployment_GetDeployment_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Deployments client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDeploymentsClient(apiVersion: "2025-05-15-preview"); + + Azure.Response < AI.Projects.1DP.Deployment > response = await client.GetDeploymentAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Deployment_GetDeployments_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Deployments client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDeploymentsClient(apiVersion: "2025-05-15-preview"); + + foreach (BinaryData item in client.GetDeployments((string)null, (string)null, (int?)null, (int?)null, (int?)null, (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Deployment_GetDeployments_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Deployments client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDeploymentsClient(apiVersion: "2025-05-15-preview"); + + await foreach (BinaryData item in client.GetDeploymentsAsync((string)null, (string)null, (int?)null, (int?)null, (int?)null, (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Deployment_GetDeployments_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Deployments client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDeploymentsClient(apiVersion: "2025-05-15-preview"); + + foreach (Projects.1DP.Deployment item in client.GetDeployments()) +{ + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Deployment_GetDeployments_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Deployments client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDeploymentsClient(apiVersion: "2025-05-15-preview"); + + await foreach (Projects.1DP.Deployment item in client.GetDeploymentsAsync()) +{ + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Deployment_GetDeployments_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Deployments client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDeploymentsClient(apiVersion: "2025-05-15-preview"); + + foreach (BinaryData item in client.GetDeployments("", "", 1234, 1234, 1234, (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Deployment_GetDeployments_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Deployments client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDeploymentsClient(apiVersion: "2025-05-15-preview"); + + await foreach (BinaryData item in client.GetDeploymentsAsync("", "", 1234, 1234, 1234, (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Deployment_GetDeployments_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Deployments client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDeploymentsClient(apiVersion: "2025-05-15-preview"); + + foreach (Projects.1DP.Deployment item in client.GetDeployments(modelPublisher: "", modelName: "", maxCount: 1234, skip: 1234, maxpagesize: 1234)) +{ + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Deployment_GetDeployments_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Deployments client = new Projects.1DP.AIProjectClient(endpoint, credential).GetDeploymentsClient(apiVersion: "2025-05-15-preview"); + + await foreach (Projects.1DP.Deployment item in client.GetDeploymentsAsync(modelPublisher: "", modelName: "", maxCount: 1234, skip: 1234, maxpagesize: 1234)) +{ + } + } +} +} diff --git a/sdk/ai/Azure.AI.Projects.1DP/tests/Generated/Samples/Samples_EvaluationResults.cs b/sdk/ai/Azure.AI.Projects.1DP/tests/Generated/Samples/Samples_EvaluationResults.cs new file mode 100644 index 000000000000..6e72a7f62c89 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/tests/Generated/Samples/Samples_EvaluationResults.cs @@ -0,0 +1,1061 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.AI.Projects.1DP.Samples +{ +public partial class Samples_EvaluationResults +{ + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EvaluationResults_GetVersion_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + Response response = client.GetVersion("", "", (RequestContext)null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EvaluationResults_GetVersion_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + Response response = await client.GetVersionAsync("", "", (RequestContext)null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EvaluationResults_GetVersion_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + Azure.Response < AI.Projects.1DP.EvaluationResult > response = client.GetVersion("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EvaluationResults_GetVersion_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + Azure.Response < AI.Projects.1DP.EvaluationResult > response = await client.GetVersionAsync("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EvaluationResults_GetVersion_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + Response response = client.GetVersion("", "", (RequestContext)null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("ResultType").ToString()); + Console.WriteLine(result.GetProperty("ModelName").ToString()); + Console.WriteLine(result.GetProperty("ModelVersion").ToString()); + Console.WriteLine(result.GetProperty("ModelAssetId").ToString()); + Console.WriteLine(result.GetProperty("DatasetFamily").ToString()); + Console.WriteLine(result.GetProperty("DatasetName").ToString()); + Console.WriteLine(result.GetProperty("Metrics").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("BlobUri").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EvaluationResults_GetVersion_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + Response response = await client.GetVersionAsync("", "", (RequestContext)null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("ResultType").ToString()); + Console.WriteLine(result.GetProperty("ModelName").ToString()); + Console.WriteLine(result.GetProperty("ModelVersion").ToString()); + Console.WriteLine(result.GetProperty("ModelAssetId").ToString()); + Console.WriteLine(result.GetProperty("DatasetFamily").ToString()); + Console.WriteLine(result.GetProperty("DatasetName").ToString()); + Console.WriteLine(result.GetProperty("Metrics").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("BlobUri").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EvaluationResults_GetVersion_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + Azure.Response < AI.Projects.1DP.EvaluationResult > response = client.GetVersion("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EvaluationResults_GetVersion_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + Azure.Response < AI.Projects.1DP.EvaluationResult > response = await client.GetVersionAsync("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EvaluationResults_DeleteVersion_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + Response response = client.DeleteVersion("", ""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EvaluationResults_DeleteVersion_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + Response response = await client.DeleteVersionAsync("", ""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EvaluationResults_DeleteVersion_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + Response response = client.DeleteVersion("", ""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EvaluationResults_DeleteVersion_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + Response response = await client.DeleteVersionAsync("", ""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EvaluationResults_Create_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new object()); + Response response = client.Create("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EvaluationResults_Create_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new object()); + Response response = await client.CreateAsync("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EvaluationResults_Create_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.EvaluationResult body = new Projects.1DP.EvaluationResult(); + Azure.Response < AI.Projects.1DP.EvaluationResult > response = client.Create("", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EvaluationResults_Create_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.EvaluationResult body = new Projects.1DP.EvaluationResult(); + Azure.Response < AI.Projects.1DP.EvaluationResult > response = await client.CreateAsync("", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EvaluationResults_Create_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + ResultType = "Benchmark", + ModelName = "", + ModelVersion = "", + ModelAssetId = "", + DatasetFamily = "", + DatasetName = "", + Metrics = new + { + key = 123.45, + }, + BlobUri = "", + stage = "", + description = "", + tags = new + { + key = "", + }, + }); + Response response = client.Create("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("ResultType").ToString()); + Console.WriteLine(result.GetProperty("ModelName").ToString()); + Console.WriteLine(result.GetProperty("ModelVersion").ToString()); + Console.WriteLine(result.GetProperty("ModelAssetId").ToString()); + Console.WriteLine(result.GetProperty("DatasetFamily").ToString()); + Console.WriteLine(result.GetProperty("DatasetName").ToString()); + Console.WriteLine(result.GetProperty("Metrics").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("BlobUri").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EvaluationResults_Create_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + ResultType = "Benchmark", + ModelName = "", + ModelVersion = "", + ModelAssetId = "", + DatasetFamily = "", + DatasetName = "", + Metrics = new + { + key = 123.45, + }, + BlobUri = "", + stage = "", + description = "", + tags = new + { + key = "", + }, + }); + Response response = await client.CreateAsync("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("ResultType").ToString()); + Console.WriteLine(result.GetProperty("ModelName").ToString()); + Console.WriteLine(result.GetProperty("ModelVersion").ToString()); + Console.WriteLine(result.GetProperty("ModelAssetId").ToString()); + Console.WriteLine(result.GetProperty("DatasetFamily").ToString()); + Console.WriteLine(result.GetProperty("DatasetName").ToString()); + Console.WriteLine(result.GetProperty("Metrics").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("BlobUri").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EvaluationResults_Create_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.EvaluationResult body = new Projects.1DP.EvaluationResult + { + ResultType = AI.Projects.1DP.ResultType.Benchmark, +ModelName = "", +ModelVersion = "", +ModelAssetId = "", +DatasetFamily = "", +DatasetName = "", +Metrics = + { + ["key"] = 123.45 + }, +BlobUri = "", +Stage = "", +Description = "", +Tags = + { + ["key"] = "" + }, +}; + Azure.Response < AI.Projects.1DP.EvaluationResult > response = client.Create("", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EvaluationResults_Create_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.EvaluationResult body = new Projects.1DP.EvaluationResult + { + ResultType = AI.Projects.1DP.ResultType.Benchmark, +ModelName = "", +ModelVersion = "", +ModelAssetId = "", +DatasetFamily = "", +DatasetName = "", +Metrics = + { + ["key"] = 123.45 + }, +BlobUri = "", +Stage = "", +Description = "", +Tags = + { + ["key"] = "" + }, +}; + Azure.Response < AI.Projects.1DP.EvaluationResult > response = await client.CreateAsync("", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EvaluationResults_CreateVersion_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new object()); + Response response = client.CreateVersion("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EvaluationResults_CreateVersion_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new object()); + Response response = await client.CreateVersionAsync("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EvaluationResults_CreateVersion_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.EvaluationResult body = new Projects.1DP.EvaluationResult(); + Azure.Response < AI.Projects.1DP.EvaluationResult > response = client.CreateVersion("", "", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EvaluationResults_CreateVersion_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.EvaluationResult body = new Projects.1DP.EvaluationResult(); + Azure.Response < AI.Projects.1DP.EvaluationResult > response = await client.CreateVersionAsync("", "", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EvaluationResults_CreateVersion_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + ResultType = "Benchmark", + ModelName = "", + ModelVersion = "", + ModelAssetId = "", + DatasetFamily = "", + DatasetName = "", + Metrics = new + { + key = 123.45, + }, + BlobUri = "", + stage = "", + description = "", + tags = new + { + key = "", + }, + }); + Response response = client.CreateVersion("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("ResultType").ToString()); + Console.WriteLine(result.GetProperty("ModelName").ToString()); + Console.WriteLine(result.GetProperty("ModelVersion").ToString()); + Console.WriteLine(result.GetProperty("ModelAssetId").ToString()); + Console.WriteLine(result.GetProperty("DatasetFamily").ToString()); + Console.WriteLine(result.GetProperty("DatasetName").ToString()); + Console.WriteLine(result.GetProperty("Metrics").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("BlobUri").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EvaluationResults_CreateVersion_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + ResultType = "Benchmark", + ModelName = "", + ModelVersion = "", + ModelAssetId = "", + DatasetFamily = "", + DatasetName = "", + Metrics = new + { + key = 123.45, + }, + BlobUri = "", + stage = "", + description = "", + tags = new + { + key = "", + }, + }); + Response response = await client.CreateVersionAsync("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("ResultType").ToString()); + Console.WriteLine(result.GetProperty("ModelName").ToString()); + Console.WriteLine(result.GetProperty("ModelVersion").ToString()); + Console.WriteLine(result.GetProperty("ModelAssetId").ToString()); + Console.WriteLine(result.GetProperty("DatasetFamily").ToString()); + Console.WriteLine(result.GetProperty("DatasetName").ToString()); + Console.WriteLine(result.GetProperty("Metrics").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("BlobUri").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EvaluationResults_CreateVersion_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.EvaluationResult body = new Projects.1DP.EvaluationResult + { + ResultType = AI.Projects.1DP.ResultType.Benchmark, +ModelName = "", +ModelVersion = "", +ModelAssetId = "", +DatasetFamily = "", +DatasetName = "", +Metrics = + { + ["key"] = 123.45 + }, +BlobUri = "", +Stage = "", +Description = "", +Tags = + { + ["key"] = "" + }, +}; + Azure.Response < AI.Projects.1DP.EvaluationResult > response = client.CreateVersion("", "", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EvaluationResults_CreateVersion_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.EvaluationResult body = new Projects.1DP.EvaluationResult + { + ResultType = AI.Projects.1DP.ResultType.Benchmark, +ModelName = "", +ModelVersion = "", +ModelAssetId = "", +DatasetFamily = "", +DatasetName = "", +Metrics = + { + ["key"] = 123.45 + }, +BlobUri = "", +Stage = "", +Description = "", +Tags = + { + ["key"] = "" + }, +}; + Azure.Response < AI.Projects.1DP.EvaluationResult > response = await client.CreateVersionAsync("", "", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EvaluationResults_StartPendingUpload_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + pendingUploadType = "TemporaryBlobReference", + }); + Response response = client.StartPendingUpload("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("blobUri").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("storageAccountArmId").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("sasToken").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("pendingUploadId").ToString()); + Console.WriteLine(result.GetProperty("pendingUploadType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EvaluationResults_StartPendingUpload_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + pendingUploadType = "TemporaryBlobReference", + }); + Response response = await client.StartPendingUploadAsync("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("blobUri").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("storageAccountArmId").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("sasToken").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("pendingUploadId").ToString()); + Console.WriteLine(result.GetProperty("pendingUploadType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EvaluationResults_StartPendingUpload_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.PendingUploadRequest body = new Projects.1DP.PendingUploadRequest(); + Azure.Response < AI.Projects.1DP.PendingUploadResponse > response = client.StartPendingUpload("", "", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EvaluationResults_StartPendingUpload_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.PendingUploadRequest body = new Projects.1DP.PendingUploadRequest(); + Azure.Response < AI.Projects.1DP.PendingUploadResponse > response = await client.StartPendingUploadAsync("", "", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EvaluationResults_StartPendingUpload_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + pendingUploadId = "", + connectionName = "", + pendingUploadType = "TemporaryBlobReference", + }); + Response response = client.StartPendingUpload("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("blobUri").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("storageAccountArmId").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("sasToken").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("pendingUploadId").ToString()); + Console.WriteLine(result.GetProperty("datasetVersion").ToString()); + Console.WriteLine(result.GetProperty("pendingUploadType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EvaluationResults_StartPendingUpload_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + pendingUploadId = "", + connectionName = "", + pendingUploadType = "TemporaryBlobReference", + }); + Response response = await client.StartPendingUploadAsync("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("blobUri").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("storageAccountArmId").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("sasToken").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("blobReferenceForConsumption").GetProperty("credential").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("pendingUploadId").ToString()); + Console.WriteLine(result.GetProperty("datasetVersion").ToString()); + Console.WriteLine(result.GetProperty("pendingUploadType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EvaluationResults_StartPendingUpload_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.PendingUploadRequest body = new Projects.1DP.PendingUploadRequest + { + PendingUploadId = "", +ConnectionName = "", +}; + Azure.Response < AI.Projects.1DP.PendingUploadResponse > response = client.StartPendingUpload("", "", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EvaluationResults_StartPendingUpload_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.PendingUploadRequest body = new Projects.1DP.PendingUploadRequest + { + PendingUploadId = "", +ConnectionName = "", +}; + Azure.Response < AI.Projects.1DP.PendingUploadResponse > response = await client.StartPendingUploadAsync("", "", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EvaluationResults_GetVersions_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + foreach (BinaryData item in client.GetVersions("", (int?)null, (string)null, (string)null, (string)null, (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EvaluationResults_GetVersions_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + await foreach (BinaryData item in client.GetVersionsAsync("", (int?)null, (string)null, (string)null, (string)null, (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EvaluationResults_GetVersions_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + foreach (Projects.1DP.EvaluationResult item in client.GetVersions("")) +{ + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EvaluationResults_GetVersions_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + await foreach (Projects.1DP.EvaluationResult item in client.GetVersionsAsync("")) +{ + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EvaluationResults_GetVersions_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + foreach (BinaryData item in client.GetVersions("", 1234, "", "", "ActiveOnly", (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("ResultType").ToString()); + Console.WriteLine(result.GetProperty("ModelName").ToString()); + Console.WriteLine(result.GetProperty("ModelVersion").ToString()); + Console.WriteLine(result.GetProperty("ModelAssetId").ToString()); + Console.WriteLine(result.GetProperty("DatasetFamily").ToString()); + Console.WriteLine(result.GetProperty("DatasetName").ToString()); + Console.WriteLine(result.GetProperty("Metrics").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("BlobUri").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EvaluationResults_GetVersions_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + await foreach (BinaryData item in client.GetVersionsAsync("", 1234, "", "", "ActiveOnly", (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("ResultType").ToString()); + Console.WriteLine(result.GetProperty("ModelName").ToString()); + Console.WriteLine(result.GetProperty("ModelVersion").ToString()); + Console.WriteLine(result.GetProperty("ModelAssetId").ToString()); + Console.WriteLine(result.GetProperty("DatasetFamily").ToString()); + Console.WriteLine(result.GetProperty("DatasetName").ToString()); + Console.WriteLine(result.GetProperty("Metrics").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("BlobUri").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EvaluationResults_GetVersions_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + foreach (Projects.1DP.EvaluationResult item in client.GetVersions("", maxCount: 1234, skip: "", tags: "", listViewType: AI.Projects.1DP.ListViewType.ActiveOnly)) +{ + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EvaluationResults_GetVersions_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + await foreach (Projects.1DP.EvaluationResult item in client.GetVersionsAsync("", maxCount: 1234, skip: "", tags: "", listViewType: AI.Projects.1DP.ListViewType.ActiveOnly)) +{ + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EvaluationResult_GetLatests_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + foreach (BinaryData item in client.GetLatests((int?)null, (string)null, (string)null, (string)null, (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EvaluationResult_GetLatests_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + await foreach (BinaryData item in client.GetLatestsAsync((int?)null, (string)null, (string)null, (string)null, (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EvaluationResult_GetLatests_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + foreach (Projects.1DP.EvaluationResult item in client.GetLatests()) +{ + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EvaluationResult_GetLatests_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + await foreach (Projects.1DP.EvaluationResult item in client.GetLatestsAsync()) +{ + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EvaluationResult_GetLatests_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + foreach (BinaryData item in client.GetLatests(1234, "", "", "ActiveOnly", (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("ResultType").ToString()); + Console.WriteLine(result.GetProperty("ModelName").ToString()); + Console.WriteLine(result.GetProperty("ModelVersion").ToString()); + Console.WriteLine(result.GetProperty("ModelAssetId").ToString()); + Console.WriteLine(result.GetProperty("DatasetFamily").ToString()); + Console.WriteLine(result.GetProperty("DatasetName").ToString()); + Console.WriteLine(result.GetProperty("Metrics").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("BlobUri").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EvaluationResult_GetLatests_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + await foreach (BinaryData item in client.GetLatestsAsync(1234, "", "", "ActiveOnly", (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("ResultType").ToString()); + Console.WriteLine(result.GetProperty("ModelName").ToString()); + Console.WriteLine(result.GetProperty("ModelVersion").ToString()); + Console.WriteLine(result.GetProperty("ModelAssetId").ToString()); + Console.WriteLine(result.GetProperty("DatasetFamily").ToString()); + Console.WriteLine(result.GetProperty("DatasetName").ToString()); + Console.WriteLine(result.GetProperty("Metrics").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("BlobUri").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EvaluationResult_GetLatests_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + foreach (Projects.1DP.EvaluationResult item in client.GetLatests(maxCount: 1234, skip: "", tags: "", listViewType: AI.Projects.1DP.ListViewType.ActiveOnly)) +{ + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EvaluationResult_GetLatests_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.EvaluationResults client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationResultsClient(apiVersion: "2025-05-15-preview"); + + await foreach (Projects.1DP.EvaluationResult item in client.GetLatestsAsync(maxCount: 1234, skip: "", tags: "", listViewType: AI.Projects.1DP.ListViewType.ActiveOnly)) +{ + } + } +} +} diff --git a/sdk/ai/Azure.AI.Projects.1DP/tests/Generated/Samples/Samples_Evaluations.cs b/sdk/ai/Azure.AI.Projects.1DP/tests/Generated/Samples/Samples_Evaluations.cs new file mode 100644 index 000000000000..56b37826443b --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/tests/Generated/Samples/Samples_Evaluations.cs @@ -0,0 +1,566 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.AI.Projects.1DP.Samples +{ +public partial class Samples_Evaluations +{ + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Evaluation_GetEvaluation_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + + Response response = client.GetEvaluation("", (RequestContext)null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("data").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Evaluation_GetEvaluation_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + + Response response = await client.GetEvaluationAsync("", (RequestContext)null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("data").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Evaluation_GetEvaluation_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + + Azure.Response < AI.Projects.1DP.Evaluation > response = client.GetEvaluation(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Evaluation_GetEvaluation_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + + Azure.Response < AI.Projects.1DP.Evaluation > response = await client.GetEvaluationAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Evaluation_GetEvaluation_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + + Response response = client.GetEvaluation("", (RequestContext)null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("data").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("properties").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("initParams").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("dataMapping").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Evaluation_GetEvaluation_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + + Response response = await client.GetEvaluationAsync("", (RequestContext)null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("data").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("properties").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("initParams").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("dataMapping").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Evaluation_GetEvaluation_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + + Azure.Response < AI.Projects.1DP.Evaluation > response = client.GetEvaluation(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Evaluation_GetEvaluation_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + + Azure.Response < AI.Projects.1DP.Evaluation > response = await client.GetEvaluationAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Evaluations_CreateRun_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + data = new + { + type = "dataset", + id = "", + }, + evaluators = new + { + key = new + { + id = "", + }, + }, + }); + Response response = client.CreateRun(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("data").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Evaluations_CreateRun_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + data = new + { + type = "dataset", + id = "", + }, + evaluators = new + { + key = new + { + id = "", + }, + }, + }); + Response response = await client.CreateRunAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("data").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Evaluations_CreateRun_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.Evaluation evaluation = new Projects.1DP.Evaluation(new Projects.1DP.InputDataset(""), new Dictionary + { + ["key"] = new Projects.1DP.EvaluatorConfiguration("") + }); + Azure.Response < AI.Projects.1DP.Evaluation > response = client.CreateRun(evaluation); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Evaluations_CreateRun_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.Evaluation evaluation = new Projects.1DP.Evaluation(new Projects.1DP.InputDataset(""), new Dictionary + { + ["key"] = new Projects.1DP.EvaluatorConfiguration("") + }); + Azure.Response < AI.Projects.1DP.Evaluation > response = await client.CreateRunAsync(evaluation); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Evaluations_CreateRun_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + data = new + { + type = "dataset", + id = "", + }, + displayName = "", + description = "", + tags = new + { + key = "", + }, + properties = new + { + key = "", + }, + evaluators = new + { + key = new + { + id = "", + initParams = new + { + key = new object(), + }, + dataMapping = new + { + key = "", + }, + }, + }, + }); + Response response = client.CreateRun(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("data").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("properties").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("initParams").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("dataMapping").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Evaluations_CreateRun_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + data = new + { + type = "dataset", + id = "", + }, + displayName = "", + description = "", + tags = new + { + key = "", + }, + properties = new + { + key = "", + }, + evaluators = new + { + key = new + { + id = "", + initParams = new + { + key = new object(), + }, + dataMapping = new + { + key = "", + }, + }, + }, + }); + Response response = await client.CreateRunAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("data").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("properties").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("initParams").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("dataMapping").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Evaluations_CreateRun_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.Evaluation evaluation = new Projects.1DP.Evaluation(new Projects.1DP.InputDataset(""), new Dictionary + { + ["key"] = new Projects.1DP.EvaluatorConfiguration("") + { + InitParams = + { + ["key"] = BinaryData.FromObjectAsJson(new object()) + }, +DataMapping = + { + ["key"] = "" + }, +} + }) +{ + DisplayName = "", +Description = "", +Tags = +{ + ["key"] = "" +}, +Properties = +{ + ["key"] = "" +}, +}; + Azure.Response < AI.Projects.1DP.Evaluation > response = client.CreateRun(evaluation); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Evaluations_CreateRun_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.Evaluation evaluation = new Projects.1DP.Evaluation(new Projects.1DP.InputDataset(""), new Dictionary + { + ["key"] = new Projects.1DP.EvaluatorConfiguration("") + { + InitParams = + { + ["key"] = BinaryData.FromObjectAsJson(new object()) + }, +DataMapping = + { + ["key"] = "" + }, +} + }) +{ + DisplayName = "", +Description = "", +Tags = +{ + ["key"] = "" +}, +Properties = +{ + ["key"] = "" +}, +}; + Azure.Response < AI.Projects.1DP.Evaluation > response = await client.CreateRunAsync(evaluation); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Evaluation_GetEvaluations_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + + foreach (BinaryData item in client.GetEvaluations((int?)null, (int?)null, (int?)null, (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("data").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Evaluation_GetEvaluations_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + + await foreach (BinaryData item in client.GetEvaluationsAsync((int?)null, (int?)null, (int?)null, (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("data").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Evaluation_GetEvaluations_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + + foreach (Projects.1DP.Evaluation item in client.GetEvaluations()) +{ + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Evaluation_GetEvaluations_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + + await foreach (Projects.1DP.Evaluation item in client.GetEvaluationsAsync()) +{ + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Evaluation_GetEvaluations_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + + foreach (BinaryData item in client.GetEvaluations(1234, 1234, 1234, (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("data").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("properties").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("initParams").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("dataMapping").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Evaluation_GetEvaluations_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + + await foreach (BinaryData item in client.GetEvaluationsAsync(1234, 1234, 1234, (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("data").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("properties").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("initParams").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("evaluators").GetProperty("").GetProperty("dataMapping").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Evaluation_GetEvaluations_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + + foreach (Projects.1DP.Evaluation item in client.GetEvaluations(maxCount: 1234, skip: 1234, maxpagesize: 1234)) +{ + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Evaluation_GetEvaluations_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Evaluations client = new Projects.1DP.AIProjectClient(endpoint, credential).GetEvaluationsClient(apiVersion: "2025-05-15-preview"); + + await foreach (Projects.1DP.Evaluation item in client.GetEvaluationsAsync(maxCount: 1234, skip: 1234, maxpagesize: 1234)) +{ + } + } +} +} diff --git a/sdk/ai/Azure.AI.Projects.1DP/tests/Generated/Samples/Samples_Indexes.cs b/sdk/ai/Azure.AI.Projects.1DP/tests/Generated/Samples/Samples_Indexes.cs new file mode 100644 index 000000000000..5c20a5083a91 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/tests/Generated/Samples/Samples_Indexes.cs @@ -0,0 +1,787 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.AI.Projects.1DP.Samples +{ +public partial class Samples_Indexes +{ + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Indexes_GetVersion_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + Response response = client.GetVersion("", "", (RequestContext)null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Indexes_GetVersion_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + Response response = await client.GetVersionAsync("", "", (RequestContext)null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Indexes_GetVersion_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + Azure.Response < AI.Projects.1DP.Index > response = client.GetVersion("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Indexes_GetVersion_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + Azure.Response < AI.Projects.1DP.Index > response = await client.GetVersionAsync("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Indexes_GetVersion_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + Response response = client.GetVersion("", "", (RequestContext)null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Indexes_GetVersion_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + Response response = await client.GetVersionAsync("", "", (RequestContext)null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Indexes_GetVersion_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + Azure.Response < AI.Projects.1DP.Index > response = client.GetVersion("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Indexes_GetVersion_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + Azure.Response < AI.Projects.1DP.Index > response = await client.GetVersionAsync("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Indexes_DeleteVersion_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + Response response = client.DeleteVersion("", ""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Indexes_DeleteVersion_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + Response response = await client.DeleteVersionAsync("", ""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Indexes_DeleteVersion_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + Response response = client.DeleteVersion("", ""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Indexes_DeleteVersion_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + Response response = await client.DeleteVersionAsync("", ""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Indexes_Create_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + type = "AzureSearch", + connectionName = "", + indexName = "", + }); + Response response = client.Create("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Indexes_Create_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + type = "AzureSearch", + connectionName = "", + indexName = "", + }); + Response response = await client.CreateAsync("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Indexes_Create_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.Index body = new Projects.1DP.AzureAISearchIndex("", ""); + Azure.Response < AI.Projects.1DP.Index > response = client.Create("", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Indexes_Create_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.Index body = new Projects.1DP.AzureAISearchIndex("", ""); + Azure.Response < AI.Projects.1DP.Index > response = await client.CreateAsync("", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Indexes_Create_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + type = "AzureSearch", + connectionName = "", + indexName = "", + stage = "", + description = "", + tags = new + { + key = "", + }, + }); + Response response = client.Create("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Indexes_Create_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + type = "AzureSearch", + connectionName = "", + indexName = "", + stage = "", + description = "", + tags = new + { + key = "", + }, + }); + Response response = await client.CreateAsync("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Indexes_Create_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.Index body = new Projects.1DP.AzureAISearchIndex("", "") + { + Stage = "", +Description = "", +Tags = + { + ["key"] = "" + }, +}; + Azure.Response < AI.Projects.1DP.Index > response = client.Create("", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Indexes_Create_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.Index body = new Projects.1DP.AzureAISearchIndex("", "") + { + Stage = "", +Description = "", +Tags = + { + ["key"] = "" + }, +}; + Azure.Response < AI.Projects.1DP.Index > response = await client.CreateAsync("", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Indexes_CreateVersion_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + type = "AzureSearch", + connectionName = "", + indexName = "", + }); + Response response = client.CreateVersion("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Indexes_CreateVersion_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + type = "AzureSearch", + connectionName = "", + indexName = "", + }); + Response response = await client.CreateVersionAsync("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Indexes_CreateVersion_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.Index body = new Projects.1DP.AzureAISearchIndex("", ""); + Azure.Response < AI.Projects.1DP.Index > response = client.CreateVersion("", "", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Indexes_CreateVersion_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.Index body = new Projects.1DP.AzureAISearchIndex("", ""); + Azure.Response < AI.Projects.1DP.Index > response = await client.CreateVersionAsync("", "", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Indexes_CreateVersion_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + type = "AzureSearch", + connectionName = "", + indexName = "", + stage = "", + description = "", + tags = new + { + key = "", + }, + }); + Response response = client.CreateVersion("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Indexes_CreateVersion_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + type = "AzureSearch", + connectionName = "", + indexName = "", + stage = "", + description = "", + tags = new + { + key = "", + }, + }); + Response response = await client.CreateVersionAsync("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Indexes_CreateVersion_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.Index body = new Projects.1DP.AzureAISearchIndex("", "") + { + Stage = "", +Description = "", +Tags = + { + ["key"] = "" + }, +}; + Azure.Response < AI.Projects.1DP.Index > response = client.CreateVersion("", "", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Indexes_CreateVersion_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.Index body = new Projects.1DP.AzureAISearchIndex("", "") + { + Stage = "", +Description = "", +Tags = + { + ["key"] = "" + }, +}; + Azure.Response < AI.Projects.1DP.Index > response = await client.CreateVersionAsync("", "", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Indexes_GetVersions_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + foreach (BinaryData item in client.GetVersions("", (int?)null, (string)null, (string)null, (string)null, (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Indexes_GetVersions_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + await foreach (BinaryData item in client.GetVersionsAsync("", (int?)null, (string)null, (string)null, (string)null, (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Indexes_GetVersions_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + foreach (Projects.1DP.Index item in client.GetVersions("")) +{ + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Indexes_GetVersions_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + await foreach (Projects.1DP.Index item in client.GetVersionsAsync("")) +{ + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Indexes_GetVersions_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + foreach (BinaryData item in client.GetVersions("", 1234, "", "", "ActiveOnly", (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Indexes_GetVersions_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + await foreach (BinaryData item in client.GetVersionsAsync("", 1234, "", "", "ActiveOnly", (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Indexes_GetVersions_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + foreach (Projects.1DP.Index item in client.GetVersions("", maxCount: 1234, skip: "", tags: "", listViewType: AI.Projects.1DP.ListViewType.ActiveOnly)) +{ + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Indexes_GetVersions_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + await foreach (Projects.1DP.Index item in client.GetVersionsAsync("", maxCount: 1234, skip: "", tags: "", listViewType: AI.Projects.1DP.ListViewType.ActiveOnly)) +{ + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Index_GetLatests_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + foreach (BinaryData item in client.GetLatests((int?)null, (string)null, (string)null, (string)null, (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Index_GetLatests_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + await foreach (BinaryData item in client.GetLatestsAsync((int?)null, (string)null, (string)null, (string)null, (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Index_GetLatests_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + foreach (Projects.1DP.Index item in client.GetLatests()) +{ + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Index_GetLatests_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + await foreach (Projects.1DP.Index item in client.GetLatestsAsync()) +{ + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Index_GetLatests_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + foreach (BinaryData item in client.GetLatests(1234, "", "", "ActiveOnly", (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Index_GetLatests_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + await foreach (BinaryData item in client.GetLatestsAsync(1234, "", "", "ActiveOnly", (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("stage").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("version").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Index_GetLatests_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + foreach (Projects.1DP.Index item in client.GetLatests(maxCount: 1234, skip: "", tags: "", listViewType: AI.Projects.1DP.ListViewType.ActiveOnly)) +{ + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Index_GetLatests_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.Indexes client = new Projects.1DP.AIProjectClient(endpoint, credential).GetIndexesClient(apiVersion: "2025-05-15-preview"); + + await foreach (Projects.1DP.Index item in client.GetLatestsAsync(maxCount: 1234, skip: "", tags: "", listViewType: AI.Projects.1DP.ListViewType.ActiveOnly)) +{ + } + } +} +} diff --git a/sdk/ai/Azure.AI.Projects.1DP/tests/Generated/Samples/Samples_RedTeams.cs b/sdk/ai/Azure.AI.Projects.1DP/tests/Generated/Samples/Samples_RedTeams.cs new file mode 100644 index 000000000000..15c13e263d4c --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/tests/Generated/Samples/Samples_RedTeams.cs @@ -0,0 +1,527 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.AI.Projects.1DP.Samples +{ +public partial class Samples_RedTeams +{ + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_RedTeam_GetRedTeam_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + + Response response = client.GetRedTeam("", (RequestContext)null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("scanName").ToString()); + Console.WriteLine(result.GetProperty("numTurns").ToString()); + Console.WriteLine(result.GetProperty("attackStrategy")[0].ToString()); + Console.WriteLine(result.GetProperty("simulationOnly").ToString()); + Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("riskCategories")[0].ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_RedTeam_GetRedTeam_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + + Response response = await client.GetRedTeamAsync("", (RequestContext)null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("scanName").ToString()); + Console.WriteLine(result.GetProperty("numTurns").ToString()); + Console.WriteLine(result.GetProperty("attackStrategy")[0].ToString()); + Console.WriteLine(result.GetProperty("simulationOnly").ToString()); + Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("riskCategories")[0].ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_RedTeam_GetRedTeam_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + + Azure.Response < AI.Projects.1DP.RedTeam > response = client.GetRedTeam(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_RedTeam_GetRedTeam_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + + Azure.Response < AI.Projects.1DP.RedTeam > response = await client.GetRedTeamAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_RedTeam_GetRedTeam_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + + Response response = client.GetRedTeam("", (RequestContext)null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("scanName").ToString()); + Console.WriteLine(result.GetProperty("numTurns").ToString()); + Console.WriteLine(result.GetProperty("attackStrategy")[0].ToString()); + Console.WriteLine(result.GetProperty("simulationOnly").ToString()); + Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("riskCategories")[0].ToString()); + Console.WriteLine(result.GetProperty("applicationScenario").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("properties").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_RedTeam_GetRedTeam_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + + Response response = await client.GetRedTeamAsync("", (RequestContext)null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("scanName").ToString()); + Console.WriteLine(result.GetProperty("numTurns").ToString()); + Console.WriteLine(result.GetProperty("attackStrategy")[0].ToString()); + Console.WriteLine(result.GetProperty("simulationOnly").ToString()); + Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("riskCategories")[0].ToString()); + Console.WriteLine(result.GetProperty("applicationScenario").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("properties").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_RedTeam_GetRedTeam_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + + Azure.Response < AI.Projects.1DP.RedTeam > response = client.GetRedTeam(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_RedTeam_GetRedTeam_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + + Azure.Response < AI.Projects.1DP.RedTeam > response = await client.GetRedTeamAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_RedTeams_CreateRun_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + scanName = "", + numTurns = 1234, + attackStrategy = new object[] + { +"easy" + }, + simulationOnly = true, + riskCategories = new object[] + { +"HateUnfairness" + }, + }); + Response response = client.CreateRun(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("scanName").ToString()); + Console.WriteLine(result.GetProperty("numTurns").ToString()); + Console.WriteLine(result.GetProperty("attackStrategy")[0].ToString()); + Console.WriteLine(result.GetProperty("simulationOnly").ToString()); + Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("riskCategories")[0].ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_RedTeams_CreateRun_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + scanName = "", + numTurns = 1234, + attackStrategy = new object[] + { +"easy" + }, + simulationOnly = true, + riskCategories = new object[] + { +"HateUnfairness" + }, + }); + Response response = await client.CreateRunAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("scanName").ToString()); + Console.WriteLine(result.GetProperty("numTurns").ToString()); + Console.WriteLine(result.GetProperty("attackStrategy")[0].ToString()); + Console.WriteLine(result.GetProperty("simulationOnly").ToString()); + Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("riskCategories")[0].ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_RedTeams_CreateRun_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.RedTeam redTeam = new Projects.1DP.RedTeam("", 1234, new Projects.1DP.AttackStrategy[]{ AI.Projects.1DP.AttackStrategy.Easy}, true, new Projects.1DP.RiskCategory[]{ AI.Projects.1DP.RiskCategory.HateUnfairness}); + Azure.Response < AI.Projects.1DP.RedTeam > response = client.CreateRun(redTeam); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_RedTeams_CreateRun_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.RedTeam redTeam = new Projects.1DP.RedTeam("", 1234, new Projects.1DP.AttackStrategy[]{ AI.Projects.1DP.AttackStrategy.Easy}, true, new Projects.1DP.RiskCategory[]{ AI.Projects.1DP.RiskCategory.HateUnfairness}); + Azure.Response < AI.Projects.1DP.RedTeam > response = await client.CreateRunAsync(redTeam); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_RedTeams_CreateRun_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + scanName = "", + numTurns = 1234, + attackStrategy = new object[] + { +"easy" + }, + simulationOnly = true, + riskCategories = new object[] + { +"HateUnfairness" + }, + applicationScenario = "", + tags = new + { + key = "", + }, + properties = new + { + key = "", + }, + }); + Response response = client.CreateRun(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("scanName").ToString()); + Console.WriteLine(result.GetProperty("numTurns").ToString()); + Console.WriteLine(result.GetProperty("attackStrategy")[0].ToString()); + Console.WriteLine(result.GetProperty("simulationOnly").ToString()); + Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("riskCategories")[0].ToString()); + Console.WriteLine(result.GetProperty("applicationScenario").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("properties").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_RedTeams_CreateRun_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + + using RequestContent content = RequestContent.Create(new + { + scanName = "", + numTurns = 1234, + attackStrategy = new object[] + { +"easy" + }, + simulationOnly = true, + riskCategories = new object[] + { +"HateUnfairness" + }, + applicationScenario = "", + tags = new + { + key = "", + }, + properties = new + { + key = "", + }, + }); + Response response = await client.CreateRunAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("scanName").ToString()); + Console.WriteLine(result.GetProperty("numTurns").ToString()); + Console.WriteLine(result.GetProperty("attackStrategy")[0].ToString()); + Console.WriteLine(result.GetProperty("simulationOnly").ToString()); + Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("riskCategories")[0].ToString()); + Console.WriteLine(result.GetProperty("applicationScenario").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("properties").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_RedTeams_CreateRun_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.RedTeam redTeam = new Projects.1DP.RedTeam("", 1234, new Projects.1DP.AttackStrategy[]{ AI.Projects.1DP.AttackStrategy.Easy}, true, new Projects.1DP.RiskCategory[]{ AI.Projects.1DP.RiskCategory.HateUnfairness}) +{ + ApplicationScenario = "", +Tags = +{ + ["key"] = "" +}, +Properties = +{ + ["key"] = "" +}, +}; + Azure.Response < AI.Projects.1DP.RedTeam > response = client.CreateRun(redTeam); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_RedTeams_CreateRun_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + + AI.Projects.1DP.RedTeam redTeam = new Projects.1DP.RedTeam("", 1234, new Projects.1DP.AttackStrategy[]{ AI.Projects.1DP.AttackStrategy.Easy}, true, new Projects.1DP.RiskCategory[]{ AI.Projects.1DP.RiskCategory.HateUnfairness}) +{ + ApplicationScenario = "", +Tags = +{ + ["key"] = "" +}, +Properties = +{ + ["key"] = "" +}, +}; + Azure.Response < AI.Projects.1DP.RedTeam > response = await client.CreateRunAsync(redTeam); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_RedTeam_GetRedTeams_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + + foreach (BinaryData item in client.GetRedTeams((int?)null, (int?)null, (int?)null, (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("scanName").ToString()); + Console.WriteLine(result.GetProperty("numTurns").ToString()); + Console.WriteLine(result.GetProperty("attackStrategy")[0].ToString()); + Console.WriteLine(result.GetProperty("simulationOnly").ToString()); + Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("riskCategories")[0].ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_RedTeam_GetRedTeams_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + + await foreach (BinaryData item in client.GetRedTeamsAsync((int?)null, (int?)null, (int?)null, (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("scanName").ToString()); + Console.WriteLine(result.GetProperty("numTurns").ToString()); + Console.WriteLine(result.GetProperty("attackStrategy")[0].ToString()); + Console.WriteLine(result.GetProperty("simulationOnly").ToString()); + Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("riskCategories")[0].ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_RedTeam_GetRedTeams_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + + foreach (Projects.1DP.RedTeam item in client.GetRedTeams()) +{ + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_RedTeam_GetRedTeams_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + + await foreach (Projects.1DP.RedTeam item in client.GetRedTeamsAsync()) +{ + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_RedTeam_GetRedTeams_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + + foreach (BinaryData item in client.GetRedTeams(1234, 1234, 1234, (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("scanName").ToString()); + Console.WriteLine(result.GetProperty("numTurns").ToString()); + Console.WriteLine(result.GetProperty("attackStrategy")[0].ToString()); + Console.WriteLine(result.GetProperty("simulationOnly").ToString()); + Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("riskCategories")[0].ToString()); + Console.WriteLine(result.GetProperty("applicationScenario").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("properties").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_RedTeam_GetRedTeams_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + + await foreach (BinaryData item in client.GetRedTeamsAsync(1234, 1234, 1234, (RequestContext)null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("scanName").ToString()); + Console.WriteLine(result.GetProperty("numTurns").ToString()); + Console.WriteLine(result.GetProperty("attackStrategy")[0].ToString()); + Console.WriteLine(result.GetProperty("simulationOnly").ToString()); + Console.WriteLine(result.GetProperty("outputs").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("riskCategories")[0].ToString()); + Console.WriteLine(result.GetProperty("applicationScenario").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("properties").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_RedTeam_GetRedTeams_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + + foreach (Projects.1DP.RedTeam item in client.GetRedTeams(maxCount: 1234, skip: 1234, maxpagesize: 1234)) +{ + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_RedTeam_GetRedTeams_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AI.Projects.1DP.RedTeams client = new Projects.1DP.AIProjectClient(endpoint, credential).GetRedTeamsClient(apiVersion: "2025-05-15-preview"); + + await foreach (Projects.1DP.RedTeam item in client.GetRedTeamsAsync(maxCount: 1234, skip: 1234, maxpagesize: 1234)) +{ + } + } +} +} diff --git a/sdk/ai/Azure.AI.Projects.1DP/tsp-location.yaml b/sdk/ai/Azure.AI.Projects.1DP/tsp-location.yaml new file mode 100644 index 000000000000..d6c4e5fd22b5 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects.1DP/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/ai/Azure.AI.Projects +commit: 54b1384a56710dd114569774b5f90a6b5778bd31 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/ai/ci.yml b/sdk/ai/ci.yml new file mode 100644 index 000000000000..1c663b6bee99 --- /dev/null +++ b/sdk/ai/ci.yml @@ -0,0 +1,35 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/ai + - sdk/ai/ci.yml + - sdk/ai/Azure.AI.Assistants + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/ai + - sdk/ai/ci.yml + - sdk/ai/Azure.AI.Assistants + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: ai + ArtifactName: packages + Artifacts: + - name: Azure.AI.Assistants + safeName: AzureAIAssistants diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/autorest.md b/sdk/cdn/Azure.ResourceManager.Cdn/src/autorest.md index db3e84353afd..10dfff544a66 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/autorest.md +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/autorest.md @@ -7,7 +7,7 @@ azure-arm: true library-name: Cdn namespace: Azure.ResourceManager.Cdn title: CdnManagementClient -require: https://github.com/Azure/azure-rest-api-specs/blob/2d973fccf9f28681a481e9760fa12b2334216e21/specification/cdn/resource-manager/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/cdn/resource-manager/readme.md output-folder: $(this-folder)/Generated clear-output-folder: true sample-gen: diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_AgentPoolSnapshotCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_AgentPoolSnapshotCollection.cs index 5863b1521d9f..f9f2e7956a8c 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_AgentPoolSnapshotCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_AgentPoolSnapshotCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_AgentPoolSnapshotCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateUpdateSnapshot() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/SnapshotsCreate.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/SnapshotsCreate.json // this example is just showing the usage of "Snapshots_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -63,7 +63,7 @@ public async Task CreateOrUpdate_CreateUpdateSnapshot() [Ignore("Only validating compilation of examples")] public async Task Get_GetSnapshot() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/SnapshotsGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/SnapshotsGet.json // this example is just showing the usage of "Snapshots_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -96,7 +96,7 @@ public async Task Get_GetSnapshot() [Ignore("Only validating compilation of examples")] public async Task GetAll_ListSnapshotsByResourceGroup() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/SnapshotsListByResourceGroup.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/SnapshotsListByResourceGroup.json // this example is just showing the usage of "Snapshots_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -131,7 +131,7 @@ public async Task GetAll_ListSnapshotsByResourceGroup() [Ignore("Only validating compilation of examples")] public async Task Exists_GetSnapshot() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/SnapshotsGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/SnapshotsGet.json // this example is just showing the usage of "Snapshots_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -160,7 +160,7 @@ public async Task Exists_GetSnapshot() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_GetSnapshot() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/SnapshotsGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/SnapshotsGet.json // this example is just showing the usage of "Snapshots_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_AgentPoolSnapshotResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_AgentPoolSnapshotResource.cs index 18f0d6f5f8fc..fbfa28bfc5a0 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_AgentPoolSnapshotResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_AgentPoolSnapshotResource.cs @@ -20,7 +20,7 @@ public partial class Sample_AgentPoolSnapshotResource [Ignore("Only validating compilation of examples")] public async Task Get_GetSnapshot() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/SnapshotsGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/SnapshotsGet.json // this example is just showing the usage of "Snapshots_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -50,7 +50,7 @@ public async Task Get_GetSnapshot() [Ignore("Only validating compilation of examples")] public async Task Delete_DeleteSnapshot() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/SnapshotsDelete.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/SnapshotsDelete.json // this example is just showing the usage of "Snapshots_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -76,7 +76,7 @@ public async Task Delete_DeleteSnapshot() [Ignore("Only validating compilation of examples")] public async Task Update_UpdateSnapshotTags() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/SnapshotsUpdateTags.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/SnapshotsUpdateTags.json // this example is just showing the usage of "Snapshots_UpdateTags" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_AgentPoolUpgradeProfileResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_AgentPoolUpgradeProfileResource.cs index 16685e88b2e2..9eb76316a46a 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_AgentPoolUpgradeProfileResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_AgentPoolUpgradeProfileResource.cs @@ -19,7 +19,7 @@ public partial class Sample_AgentPoolUpgradeProfileResource [Ignore("Only validating compilation of examples")] public async Task Get_GetUpgradeProfileForAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsGetUpgradeProfile.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsGetUpgradeProfile.json // this example is just showing the usage of "AgentPools_GetUpgradeProfile" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceAgentPoolCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceAgentPoolCollection.cs index d89556d52e00..ae01757109a5 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceAgentPoolCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceAgentPoolCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_ContainerServiceAgentPoolCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateAgentPoolUsingAnAgentPoolSnapshot() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_Snapshot.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsCreate_Snapshot.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -64,7 +64,7 @@ public async Task CreateOrUpdate_CreateAgentPoolUsingAnAgentPoolSnapshot() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateAgentPoolWithCapacityReservationGroup() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_CRG.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsCreate_CRG.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -107,7 +107,7 @@ public async Task CreateOrUpdate_CreateAgentPoolWithCapacityReservationGroup() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateAgentPoolWithDedicatedHostGroup() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_DedicatedHostGroup.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsCreate_DedicatedHostGroup.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -150,7 +150,7 @@ public async Task CreateOrUpdate_CreateAgentPoolWithDedicatedHostGroup() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateAgentPoolWithEncryptionAtHostEnabled() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_EnableEncryptionAtHost.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsCreate_EnableEncryptionAtHost.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -193,7 +193,7 @@ public async Task CreateOrUpdate_CreateAgentPoolWithEncryptionAtHostEnabled() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateAgentPoolWithEphemeralOSDisk() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_Ephemeral.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsCreate_Ephemeral.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -237,7 +237,7 @@ public async Task CreateOrUpdate_CreateAgentPoolWithEphemeralOSDisk() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateAgentPoolWithFIPSEnabledOS() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_EnableFIPS.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsCreate_EnableFIPS.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -280,7 +280,7 @@ public async Task CreateOrUpdate_CreateAgentPoolWithFIPSEnabledOS() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateAgentPoolWithGPUMIG() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_GPUMIG.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsCreate_GPUMIG.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -347,7 +347,7 @@ public async Task CreateOrUpdate_CreateAgentPoolWithGPUMIG() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateAgentPoolWithKrustletAndTheWASIRuntime() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_WasmWasi.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsCreate_WasmWasi.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -392,7 +392,7 @@ public async Task CreateOrUpdate_CreateAgentPoolWithKrustletAndTheWASIRuntime() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateAgentPoolWithKubeletConfigAndLinuxOSConfig() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_CustomNodeConfig.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsCreate_CustomNodeConfig.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -454,11 +454,56 @@ public async Task CreateOrUpdate_CreateAgentPoolWithKubeletConfigAndLinuxOSConfi Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateAgentPoolWithMessageOfTheDay() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsCreate_MessageOfTheDay.json + // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceManagedClusterResource created on azure + // for more information of creating ContainerServiceManagedClusterResource, please refer to the document of ContainerServiceManagedClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + ResourceIdentifier containerServiceManagedClusterResourceId = ContainerServiceManagedClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + ContainerServiceManagedClusterResource containerServiceManagedCluster = client.GetContainerServiceManagedClusterResource(containerServiceManagedClusterResourceId); + + // get the collection of this ContainerServiceAgentPoolResource + ContainerServiceAgentPoolCollection collection = containerServiceManagedCluster.GetContainerServiceAgentPools(); + + // invoke the operation + string agentPoolName = "agentpool1"; + ContainerServiceAgentPoolData data = new ContainerServiceAgentPoolData + { + Count = 3, + VmSize = "Standard_DS2_v2", + OSDiskSizeInGB = 64, + MessageOfTheDay = "Zm9vCg==", + OSType = ContainerServiceOSType.Linux, + Mode = AgentPoolMode.User, + OrchestratorVersion = "", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, agentPoolName, data); + ContainerServiceAgentPoolResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ContainerServiceAgentPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateAgentPoolWithOSSKU() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_OSSKU.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsCreate_OSSKU.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -525,7 +570,7 @@ public async Task CreateOrUpdate_CreateAgentPoolWithOSSKU() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateAgentPoolWithPPG() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_PPG.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsCreate_PPG.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -568,7 +613,7 @@ public async Task CreateOrUpdate_CreateAgentPoolWithPPG() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateAgentPoolWithUltraSSDEnabled() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_EnableUltraSSD.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsCreate_EnableUltraSSD.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -611,7 +656,7 @@ public async Task CreateOrUpdate_CreateAgentPoolWithUltraSSDEnabled() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateAgentPoolWithWindowsOSSKU() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_WindowsOSSKU.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsCreate_WindowsOSSKU.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -654,7 +699,7 @@ public async Task CreateOrUpdate_CreateAgentPoolWithWindowsOSSKU() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateSpotAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_Spot.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsCreate_Spot.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -703,11 +748,55 @@ public async Task CreateOrUpdate_CreateSpotAgentPool() Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateWindowsAgentPoolWithDisablingOutboundNAT() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsCreate_WindowsDisableOutboundNAT.json + // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceManagedClusterResource created on azure + // for more information of creating ContainerServiceManagedClusterResource, please refer to the document of ContainerServiceManagedClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + ResourceIdentifier containerServiceManagedClusterResourceId = ContainerServiceManagedClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + ContainerServiceManagedClusterResource containerServiceManagedCluster = client.GetContainerServiceManagedClusterResource(containerServiceManagedClusterResourceId); + + // get the collection of this ContainerServiceAgentPoolResource + ContainerServiceAgentPoolCollection collection = containerServiceManagedCluster.GetContainerServiceAgentPools(); + + // invoke the operation + string agentPoolName = "wnp2"; + ContainerServiceAgentPoolData data = new ContainerServiceAgentPoolData + { + Count = 3, + VmSize = "Standard_D4s_v3", + OSType = ContainerServiceOSType.Windows, + OSSku = ContainerServiceOSSku.Windows2022, + OrchestratorVersion = "1.23.8", + DisableOutboundNat = true, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, agentPoolName, data); + ContainerServiceAgentPoolResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ContainerServiceAgentPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateUpdateAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_Update.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsCreate_Update.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -761,7 +850,7 @@ public async Task CreateOrUpdate_CreateUpdateAgentPool() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_StartAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPools_Start.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPools_Start.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -800,7 +889,7 @@ public async Task CreateOrUpdate_StartAgentPool() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_StopAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPools_Stop.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPools_Stop.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -839,7 +928,7 @@ public async Task CreateOrUpdate_StopAgentPool() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_UpdateAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPools_Update.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPools_Update.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -887,7 +976,7 @@ public async Task CreateOrUpdate_UpdateAgentPool() [Ignore("Only validating compilation of examples")] public async Task Get_GetAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsGet.json // this example is just showing the usage of "AgentPools_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -921,7 +1010,7 @@ public async Task Get_GetAgentPool() [Ignore("Only validating compilation of examples")] public async Task GetAll_ListAgentPoolsByManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsList.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsList.json // this example is just showing the usage of "AgentPools_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -957,7 +1046,7 @@ public async Task GetAll_ListAgentPoolsByManagedCluster() [Ignore("Only validating compilation of examples")] public async Task Exists_GetAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsGet.json // this example is just showing the usage of "AgentPools_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -987,7 +1076,7 @@ public async Task Exists_GetAgentPool() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_GetAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsGet.json // this example is just showing the usage of "AgentPools_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceAgentPoolResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceAgentPoolResource.cs index 8f449f069239..3320d891ece6 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceAgentPoolResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceAgentPoolResource.cs @@ -20,7 +20,7 @@ public partial class Sample_ContainerServiceAgentPoolResource [Ignore("Only validating compilation of examples")] public async Task Get_GetAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsGet.json // this example is just showing the usage of "AgentPools_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -51,7 +51,7 @@ public async Task Get_GetAgentPool() [Ignore("Only validating compilation of examples")] public async Task Delete_DeleteAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsDelete.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsDelete.json // this example is just showing the usage of "AgentPools_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -78,7 +78,7 @@ public async Task Delete_DeleteAgentPool() [Ignore("Only validating compilation of examples")] public async Task Update_CreateAgentPoolUsingAnAgentPoolSnapshot() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_Snapshot.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsCreate_Snapshot.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -119,7 +119,7 @@ public async Task Update_CreateAgentPoolUsingAnAgentPoolSnapshot() [Ignore("Only validating compilation of examples")] public async Task Update_CreateAgentPoolWithCapacityReservationGroup() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_CRG.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsCreate_CRG.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -159,7 +159,7 @@ public async Task Update_CreateAgentPoolWithCapacityReservationGroup() [Ignore("Only validating compilation of examples")] public async Task Update_CreateAgentPoolWithDedicatedHostGroup() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_DedicatedHostGroup.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsCreate_DedicatedHostGroup.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -199,7 +199,7 @@ public async Task Update_CreateAgentPoolWithDedicatedHostGroup() [Ignore("Only validating compilation of examples")] public async Task Update_CreateAgentPoolWithEncryptionAtHostEnabled() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_EnableEncryptionAtHost.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsCreate_EnableEncryptionAtHost.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -239,7 +239,7 @@ public async Task Update_CreateAgentPoolWithEncryptionAtHostEnabled() [Ignore("Only validating compilation of examples")] public async Task Update_CreateAgentPoolWithEphemeralOSDisk() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_Ephemeral.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsCreate_Ephemeral.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -280,7 +280,7 @@ public async Task Update_CreateAgentPoolWithEphemeralOSDisk() [Ignore("Only validating compilation of examples")] public async Task Update_CreateAgentPoolWithFIPSEnabledOS() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_EnableFIPS.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsCreate_EnableFIPS.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -320,7 +320,7 @@ public async Task Update_CreateAgentPoolWithFIPSEnabledOS() [Ignore("Only validating compilation of examples")] public async Task Update_CreateAgentPoolWithGPUMIG() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_GPUMIG.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsCreate_GPUMIG.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -384,7 +384,7 @@ public async Task Update_CreateAgentPoolWithGPUMIG() [Ignore("Only validating compilation of examples")] public async Task Update_CreateAgentPoolWithKrustletAndTheWASIRuntime() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_WasmWasi.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsCreate_WasmWasi.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -426,7 +426,7 @@ public async Task Update_CreateAgentPoolWithKrustletAndTheWASIRuntime() [Ignore("Only validating compilation of examples")] public async Task Update_CreateAgentPoolWithKubeletConfigAndLinuxOSConfig() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_CustomNodeConfig.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsCreate_CustomNodeConfig.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -485,11 +485,53 @@ public async Task Update_CreateAgentPoolWithKubeletConfigAndLinuxOSConfig() Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_CreateAgentPoolWithMessageOfTheDay() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsCreate_MessageOfTheDay.json + // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceAgentPoolResource created on azure + // for more information of creating ContainerServiceAgentPoolResource, please refer to the document of ContainerServiceAgentPoolResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + string agentPoolName = "agentpool1"; + ResourceIdentifier containerServiceAgentPoolResourceId = ContainerServiceAgentPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, agentPoolName); + ContainerServiceAgentPoolResource containerServiceAgentPool = client.GetContainerServiceAgentPoolResource(containerServiceAgentPoolResourceId); + + // invoke the operation + ContainerServiceAgentPoolData data = new ContainerServiceAgentPoolData + { + Count = 3, + VmSize = "Standard_DS2_v2", + OSDiskSizeInGB = 64, + MessageOfTheDay = "Zm9vCg==", + OSType = ContainerServiceOSType.Linux, + Mode = AgentPoolMode.User, + OrchestratorVersion = "", + }; + ArmOperation lro = await containerServiceAgentPool.UpdateAsync(WaitUntil.Completed, data); + ContainerServiceAgentPoolResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ContainerServiceAgentPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task Update_CreateAgentPoolWithOSSKU() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_OSSKU.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsCreate_OSSKU.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -553,7 +595,7 @@ public async Task Update_CreateAgentPoolWithOSSKU() [Ignore("Only validating compilation of examples")] public async Task Update_CreateAgentPoolWithPPG() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_PPG.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsCreate_PPG.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -593,7 +635,7 @@ public async Task Update_CreateAgentPoolWithPPG() [Ignore("Only validating compilation of examples")] public async Task Update_CreateAgentPoolWithUltraSSDEnabled() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_EnableUltraSSD.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsCreate_EnableUltraSSD.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -633,7 +675,7 @@ public async Task Update_CreateAgentPoolWithUltraSSDEnabled() [Ignore("Only validating compilation of examples")] public async Task Update_CreateAgentPoolWithWindowsOSSKU() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_WindowsOSSKU.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsCreate_WindowsOSSKU.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -673,7 +715,7 @@ public async Task Update_CreateAgentPoolWithWindowsOSSKU() [Ignore("Only validating compilation of examples")] public async Task Update_CreateSpotAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_Spot.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsCreate_Spot.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -719,11 +761,52 @@ public async Task Update_CreateSpotAgentPool() Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_CreateWindowsAgentPoolWithDisablingOutboundNAT() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsCreate_WindowsDisableOutboundNAT.json + // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceAgentPoolResource created on azure + // for more information of creating ContainerServiceAgentPoolResource, please refer to the document of ContainerServiceAgentPoolResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + string agentPoolName = "wnp2"; + ResourceIdentifier containerServiceAgentPoolResourceId = ContainerServiceAgentPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, agentPoolName); + ContainerServiceAgentPoolResource containerServiceAgentPool = client.GetContainerServiceAgentPoolResource(containerServiceAgentPoolResourceId); + + // invoke the operation + ContainerServiceAgentPoolData data = new ContainerServiceAgentPoolData + { + Count = 3, + VmSize = "Standard_D4s_v3", + OSType = ContainerServiceOSType.Windows, + OSSku = ContainerServiceOSSku.Windows2022, + OrchestratorVersion = "1.23.8", + DisableOutboundNat = true, + }; + ArmOperation lro = await containerServiceAgentPool.UpdateAsync(WaitUntil.Completed, data); + ContainerServiceAgentPoolResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ContainerServiceAgentPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task Update_CreateUpdateAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_Update.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsCreate_Update.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -774,7 +857,7 @@ public async Task Update_CreateUpdateAgentPool() [Ignore("Only validating compilation of examples")] public async Task Update_StartAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPools_Start.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPools_Start.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -810,7 +893,7 @@ public async Task Update_StartAgentPool() [Ignore("Only validating compilation of examples")] public async Task Update_StopAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPools_Stop.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPools_Stop.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -846,7 +929,7 @@ public async Task Update_StopAgentPool() [Ignore("Only validating compilation of examples")] public async Task Update_UpdateAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPools_Update.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPools_Update.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -891,7 +974,7 @@ public async Task Update_UpdateAgentPool() [Ignore("Only validating compilation of examples")] public async Task AbortLatestOperation_AbortOperationOnAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsAbortOperation.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsAbortOperation.json // this example is just showing the usage of "AgentPools_AbortLatestOperation" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -914,11 +997,39 @@ public async Task AbortLatestOperation_AbortOperationOnAgentPool() Console.WriteLine("Succeeded"); } + [Test] + [Ignore("Only validating compilation of examples")] + public async Task DeleteMachines_DeleteSpecificMachinesInAnAgentPool() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsDeleteMachines.json + // this example is just showing the usage of "AgentPools_DeleteMachines" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceAgentPoolResource created on azure + // for more information of creating ContainerServiceAgentPoolResource, please refer to the document of ContainerServiceAgentPoolResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + string agentPoolName = "agentpool1"; + ResourceIdentifier containerServiceAgentPoolResourceId = ContainerServiceAgentPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, agentPoolName); + ContainerServiceAgentPoolResource containerServiceAgentPool = client.GetContainerServiceAgentPoolResource(containerServiceAgentPoolResourceId); + + // invoke the operation + AgentPoolDeleteMachinesParameter machines = new AgentPoolDeleteMachinesParameter(new string[] { "aks-nodepool1-42263519-vmss00000a", "aks-nodepool1-42263519-vmss00000b" }); + await containerServiceAgentPool.DeleteMachinesAsync(WaitUntil.Completed, machines); + + Console.WriteLine("Succeeded"); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task UpgradeNodeImageVersion_UpgradeAgentPoolNodeImageVersion() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsUpgradeNodeImageVersion.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsUpgradeNodeImageVersion.json // this example is just showing the usage of "AgentPools_UpgradeNodeImageVersion" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceMaintenanceConfigurationCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceMaintenanceConfigurationCollection.cs index 6c6340f77ea6..003cbc82a316 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceMaintenanceConfigurationCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceMaintenanceConfigurationCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_ContainerServiceMaintenanceConfigurationCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateUpdateMaintenanceConfiguration() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/MaintenanceConfigurationsCreate_Update.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/MaintenanceConfigurationsCreate_Update.json // this example is just showing the usage of "MaintenanceConfigurations_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -68,7 +68,7 @@ public async Task CreateOrUpdate_CreateUpdateMaintenanceConfiguration() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateUpdateMaintenanceConfigurationWithMaintenanceWindow() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/MaintenanceConfigurationsCreate_Update_MaintenanceWindow.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/MaintenanceConfigurationsCreate_Update_MaintenanceWindow.json // this example is just showing the usage of "MaintenanceConfigurations_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -115,7 +115,7 @@ public async Task CreateOrUpdate_CreateUpdateMaintenanceConfigurationWithMainten [Ignore("Only validating compilation of examples")] public async Task Get_GetMaintenanceConfiguration() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/MaintenanceConfigurationsGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/MaintenanceConfigurationsGet.json // this example is just showing the usage of "MaintenanceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -149,7 +149,7 @@ public async Task Get_GetMaintenanceConfiguration() [Ignore("Only validating compilation of examples")] public async Task Get_GetMaintenanceConfigurationConfiguredWithMaintenanceWindow() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/MaintenanceConfigurationsGet_MaintenanceWindow.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/MaintenanceConfigurationsGet_MaintenanceWindow.json // this example is just showing the usage of "MaintenanceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -183,7 +183,7 @@ public async Task Get_GetMaintenanceConfigurationConfiguredWithMaintenanceWindow [Ignore("Only validating compilation of examples")] public async Task GetAll_ListMaintenanceConfigurationsByManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/MaintenanceConfigurationsList.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/MaintenanceConfigurationsList.json // this example is just showing the usage of "MaintenanceConfigurations_ListByManagedCluster" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -219,7 +219,7 @@ public async Task GetAll_ListMaintenanceConfigurationsByManagedCluster() [Ignore("Only validating compilation of examples")] public async Task GetAll_ListMaintenanceConfigurationsConfiguredWithMaintenanceWindowByManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/MaintenanceConfigurationsList_MaintenanceWindow.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/MaintenanceConfigurationsList_MaintenanceWindow.json // this example is just showing the usage of "MaintenanceConfigurations_ListByManagedCluster" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -255,7 +255,7 @@ public async Task GetAll_ListMaintenanceConfigurationsConfiguredWithMaintenanceW [Ignore("Only validating compilation of examples")] public async Task Exists_GetMaintenanceConfiguration() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/MaintenanceConfigurationsGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/MaintenanceConfigurationsGet.json // this example is just showing the usage of "MaintenanceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -285,7 +285,7 @@ public async Task Exists_GetMaintenanceConfiguration() [Ignore("Only validating compilation of examples")] public async Task Exists_GetMaintenanceConfigurationConfiguredWithMaintenanceWindow() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/MaintenanceConfigurationsGet_MaintenanceWindow.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/MaintenanceConfigurationsGet_MaintenanceWindow.json // this example is just showing the usage of "MaintenanceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -315,7 +315,7 @@ public async Task Exists_GetMaintenanceConfigurationConfiguredWithMaintenanceWin [Ignore("Only validating compilation of examples")] public async Task GetIfExists_GetMaintenanceConfiguration() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/MaintenanceConfigurationsGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/MaintenanceConfigurationsGet.json // this example is just showing the usage of "MaintenanceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -357,7 +357,7 @@ public async Task GetIfExists_GetMaintenanceConfiguration() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_GetMaintenanceConfigurationConfiguredWithMaintenanceWindow() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/MaintenanceConfigurationsGet_MaintenanceWindow.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/MaintenanceConfigurationsGet_MaintenanceWindow.json // this example is just showing the usage of "MaintenanceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceMaintenanceConfigurationResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceMaintenanceConfigurationResource.cs index bacc1890041f..7ff5c6b664df 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceMaintenanceConfigurationResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceMaintenanceConfigurationResource.cs @@ -20,7 +20,7 @@ public partial class Sample_ContainerServiceMaintenanceConfigurationResource [Ignore("Only validating compilation of examples")] public async Task Get_GetMaintenanceConfiguration() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/MaintenanceConfigurationsGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/MaintenanceConfigurationsGet.json // this example is just showing the usage of "MaintenanceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -51,7 +51,7 @@ public async Task Get_GetMaintenanceConfiguration() [Ignore("Only validating compilation of examples")] public async Task Get_GetMaintenanceConfigurationConfiguredWithMaintenanceWindow() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/MaintenanceConfigurationsGet_MaintenanceWindow.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/MaintenanceConfigurationsGet_MaintenanceWindow.json // this example is just showing the usage of "MaintenanceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -82,7 +82,7 @@ public async Task Get_GetMaintenanceConfigurationConfiguredWithMaintenanceWindow [Ignore("Only validating compilation of examples")] public async Task Delete_DeleteMaintenanceConfiguration() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/MaintenanceConfigurationsDelete.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/MaintenanceConfigurationsDelete.json // this example is just showing the usage of "MaintenanceConfigurations_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -109,7 +109,7 @@ public async Task Delete_DeleteMaintenanceConfiguration() [Ignore("Only validating compilation of examples")] public async Task Delete_DeleteMaintenanceConfigurationForNodeOSUpgrade() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/MaintenanceConfigurationsDelete_MaintenanceWindow.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/MaintenanceConfigurationsDelete_MaintenanceWindow.json // this example is just showing the usage of "MaintenanceConfigurations_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -136,7 +136,7 @@ public async Task Delete_DeleteMaintenanceConfigurationForNodeOSUpgrade() [Ignore("Only validating compilation of examples")] public async Task Update_CreateUpdateMaintenanceConfiguration() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/MaintenanceConfigurationsCreate_Update.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/MaintenanceConfigurationsCreate_Update.json // this example is just showing the usage of "MaintenanceConfigurations_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -181,7 +181,7 @@ public async Task Update_CreateUpdateMaintenanceConfiguration() [Ignore("Only validating compilation of examples")] public async Task Update_CreateUpdateMaintenanceConfigurationWithMaintenanceWindow() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/MaintenanceConfigurationsCreate_Update_MaintenanceWindow.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/MaintenanceConfigurationsCreate_Update_MaintenanceWindow.json // this example is just showing the usage of "MaintenanceConfigurations_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceManagedClusterCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceManagedClusterCollection.cs index 76550907a7de..368171da359e 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceManagedClusterCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceManagedClusterCollection.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Text; using System.Threading.Tasks; using Azure.Core; using Azure.Identity; @@ -22,7 +23,7 @@ public partial class Sample_ContainerServiceManagedClusterCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateManagedClusterUsingAnAgentPoolSnapshot() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_Snapshot.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersCreate_Snapshot.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -115,7 +116,7 @@ public async Task CreateOrUpdate_CreateManagedClusterUsingAnAgentPoolSnapshot() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateManagedClusterWithAKSManagedNATGatewayAsOutboundType() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_ManagedNATGateway.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersCreate_ManagedNATGateway.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -203,7 +204,7 @@ public async Task CreateOrUpdate_CreateManagedClusterWithAKSManagedNATGatewayAsO [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateManagedClusterWithAzureKeyVaultSecretsProviderAddon() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_AzureKeyvaultSecretsProvider.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersCreate_AzureKeyvaultSecretsProvider.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -304,7 +305,7 @@ public async Task CreateOrUpdate_CreateManagedClusterWithAzureKeyVaultSecretsPro [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateManagedClusterWithCapacityReservationGroup() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_CRG.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersCreate_CRG.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -392,11 +393,106 @@ public async Task CreateOrUpdate_CreateManagedClusterWithCapacityReservationGrou Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateManagedClusterWithCustomCATrustCertificates() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersCreate_CustomCATrustCertificates.json + // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ContainerServiceManagedClusterResource + ContainerServiceManagedClusterCollection collection = resourceGroupResource.GetContainerServiceManagedClusters(); + + // invoke the operation + string resourceName = "clustername1"; + ContainerServiceManagedClusterData data = new ContainerServiceManagedClusterData(new AzureLocation("location1")) + { + Sku = new ManagedClusterSku + { + Name = new ManagedClusterSkuName("Basic"), + Tier = ManagedClusterSkuTier.Free, + }, + KubernetesVersion = "", + DnsPrefix = "dnsprefix1", + AgentPoolProfiles = {new ManagedClusterAgentPoolProfile("nodepool1") +{ +Count = 3, +VmSize = "Standard_DS2_v2", +OSType = ContainerServiceOSType.Linux, +AgentPoolType = AgentPoolType.VirtualMachineScaleSets, +Mode = AgentPoolMode.System, +EnableNodePublicIP = true, +}}, + LinuxProfile = new ContainerServiceLinuxProfile("azureuser", new ContainerServiceSshConfiguration(new ContainerServiceSshPublicKey[] + { +new ContainerServiceSshPublicKey("keydata") + })), + WindowsProfile = new ManagedClusterWindowsProfile("azureuser") + { + AdminPassword = "replacePassword1234$", + }, + ServicePrincipalProfile = new ManagedClusterServicePrincipalProfile("clientid") + { + Secret = "secret", + }, + AddonProfiles = { }, + EnableRbac = true, + EnablePodSecurityPolicy = true, + NetworkProfile = new ContainerServiceNetworkProfile + { + OutboundType = ContainerServiceOutboundType.LoadBalancer, + LoadBalancerSku = ContainerServiceLoadBalancerSku.Standard, + LoadBalancerProfile = new ManagedClusterLoadBalancerProfile + { + ManagedOutboundIPs = new ManagedClusterLoadBalancerProfileManagedOutboundIPs + { + Count = 2, + }, + }, + }, + AutoScalerProfile = new ManagedClusterAutoScalerProfile + { + ScanIntervalInSeconds = "20s", + ScaleDownDelayAfterAdd = "15m", + }, + DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + SecurityProfile = new ManagedClusterSecurityProfile + { + CustomCATrustCertificates = { Encoding.UTF8.GetBytes("ZHVtbXlFeGFtcGxlVGVzdFZhbHVlRm9yQ2VydGlmaWNhdGVUb0JlQWRkZWQ=") }, + }, + Tags = +{ +["archv2"] = "", +["tier"] = "production" +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, resourceName, data); + ContainerServiceManagedClusterResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ContainerServiceManagedClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateManagedClusterWithDedicatedHostGroup() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_DedicatedHostGroup.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersCreate_DedicatedHostGroup.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -487,7 +583,7 @@ public async Task CreateOrUpdate_CreateManagedClusterWithDedicatedHostGroup() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateManagedClusterWithEncryptionAtHostEnabled() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_EnableEncryptionAtHost.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersCreate_EnableEncryptionAtHost.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -579,7 +675,7 @@ public async Task CreateOrUpdate_CreateManagedClusterWithEncryptionAtHostEnabled [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateManagedClusterWithFIPSEnabledOS() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_EnabledFIPS.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersCreate_EnabledFIPS.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -671,7 +767,7 @@ public async Task CreateOrUpdate_CreateManagedClusterWithFIPSEnabledOS() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateManagedClusterWithGPUMIG() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_GPUMIG.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersCreate_GPUMIG.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -770,7 +866,7 @@ public async Task CreateOrUpdate_CreateManagedClusterWithGPUMIG() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateManagedClusterWithHTTPProxyConfigured() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_HTTPProxy.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersCreate_HTTPProxy.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -868,7 +964,7 @@ public async Task CreateOrUpdate_CreateManagedClusterWithHTTPProxyConfigured() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateManagedClusterWithLongTermSupport() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_Premium.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersCreate_Premium.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -964,7 +1060,7 @@ public async Task CreateOrUpdate_CreateManagedClusterWithLongTermSupport() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateManagedClusterWithNodePublicIPPrefix() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_NodePublicIPPrefix.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersCreate_NodePublicIPPrefix.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -1056,7 +1152,7 @@ public async Task CreateOrUpdate_CreateManagedClusterWithNodePublicIPPrefix() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateManagedClusterWithOSSKU() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_OSSKU.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersCreate_OSSKU.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -1155,7 +1251,7 @@ public async Task CreateOrUpdate_CreateManagedClusterWithOSSKU() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateManagedClusterWithPPG() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_PPG.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersCreate_PPG.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -1247,7 +1343,7 @@ public async Task CreateOrUpdate_CreateManagedClusterWithPPG() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateManagedClusterWithPodIdentityEnabled() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_PodIdentity.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersCreate_PodIdentity.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -1343,7 +1439,7 @@ public async Task CreateOrUpdate_CreateManagedClusterWithPodIdentityEnabled() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateManagedClusterWithRunCommandDisabled() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_DisableRunCommand.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersCreate_DisableRunCommand.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -1438,7 +1534,7 @@ public async Task CreateOrUpdate_CreateManagedClusterWithRunCommandDisabled() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateManagedClusterWithSecurityProfileConfigured() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_SecurityProfile.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersCreate_SecurityProfile.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -1521,7 +1617,7 @@ public async Task CreateOrUpdate_CreateManagedClusterWithSecurityProfileConfigur [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateManagedClusterWithUltraSSDEnabled() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_EnableUltraSSD.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersCreate_EnableUltraSSD.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -1609,11 +1705,90 @@ public async Task CreateOrUpdate_CreateManagedClusterWithUltraSSDEnabled() Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateManagedClusterWithWebAppRoutingIngressProfileConfigured() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersCreate_IngressProfile_WebAppRouting.json + // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ContainerServiceManagedClusterResource + ContainerServiceManagedClusterCollection collection = resourceGroupResource.GetContainerServiceManagedClusters(); + + // invoke the operation + string resourceName = "clustername1"; + ContainerServiceManagedClusterData data = new ContainerServiceManagedClusterData(new AzureLocation("location1")) + { + Sku = new ManagedClusterSku + { + Name = new ManagedClusterSkuName("Basic"), + Tier = ManagedClusterSkuTier.Free, + }, + KubernetesVersion = "", + DnsPrefix = "dnsprefix1", + AgentPoolProfiles = {new ManagedClusterAgentPoolProfile("nodepool1") +{ +Count = 3, +VmSize = "Standard_DS2_v2", +OSType = ContainerServiceOSType.Linux, +AgentPoolType = AgentPoolType.VirtualMachineScaleSets, +Mode = AgentPoolMode.System, +EnableNodePublicIP = true, +}}, + LinuxProfile = new ContainerServiceLinuxProfile("azureuser", new ContainerServiceSshConfiguration(new ContainerServiceSshPublicKey[] + { +new ContainerServiceSshPublicKey("keydata") + })), + NetworkProfile = new ContainerServiceNetworkProfile + { + OutboundType = ContainerServiceOutboundType.LoadBalancer, + LoadBalancerSku = ContainerServiceLoadBalancerSku.Standard, + LoadBalancerProfile = new ManagedClusterLoadBalancerProfile + { + ManagedOutboundIPs = new ManagedClusterLoadBalancerProfileManagedOutboundIPs + { + Count = 2, + }, + }, + }, + IngressWebAppRouting = new ManagedClusterIngressProfileWebAppRouting + { + Enabled = true, + DnsZoneResourceIds = { new ResourceIdentifier("/subscriptions/SUB_ID/resourceGroups/RG_NAME/providers/Microsoft.Network/dnszones/DNS_ZONE_NAME") }, + }, + Tags = +{ +["archv2"] = "", +["tier"] = "production" +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, resourceName, data); + ContainerServiceManagedClusterResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ContainerServiceManagedClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateManagedClusterWithUserAssignedNATGatewayAsOutboundType() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_UserAssignedNATGateway.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersCreate_UserAssignedNATGateway.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -1697,7 +1872,7 @@ public async Task CreateOrUpdate_CreateManagedClusterWithUserAssignedNATGatewayA [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateManagedPrivateClusterWithPublicFQDNSpecified() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_PrivateClusterPublicFQDN.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersCreate_PrivateClusterPublicFQDN.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -1793,7 +1968,7 @@ public async Task CreateOrUpdate_CreateManagedPrivateClusterWithPublicFQDNSpecif [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateManagedPrivateClusterWithFqdnSubdomainSpecified() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_PrivateClusterFQDNSubdomain.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersCreate_PrivateClusterFQDNSubdomain.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -1889,7 +2064,7 @@ public async Task CreateOrUpdate_CreateManagedPrivateClusterWithFqdnSubdomainSpe [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateUpdateAADManagedClusterWithEnableAzureRBAC() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_UpdateWithEnableAzureRBAC.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersCreate_UpdateWithEnableAzureRBAC.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -1986,7 +2161,7 @@ public async Task CreateOrUpdate_CreateUpdateAADManagedClusterWithEnableAzureRBA [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateUpdateManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_Update.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersCreate_Update.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -2097,7 +2272,7 @@ public async Task CreateOrUpdate_CreateUpdateManagedCluster() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateUpdateManagedClusterWithAzureServiceMesh() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_AzureServiceMesh.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersCreate_AzureServiceMesh.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -2185,13 +2360,7 @@ public async Task CreateOrUpdate_CreateUpdateManagedClusterWithAzureServiceMesh( Components = new IstioComponents { IngressGateways = { new IstioIngressGateway(IstioIngressGatewayMode.Internal, true) }, - EgressGateways = {new IstioEgressGateway(true) -{ -NodeSelector = -{ -["istio"] = "egress" -}, -}}, + EgressGateways = { new IstioEgressGateway(true) }, }, CertificateAuthorityPlugin = new IstioPluginCertificateAuthority { @@ -2223,7 +2392,7 @@ public async Task CreateOrUpdate_CreateUpdateManagedClusterWithAzureServiceMesh( [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateUpdateManagedClusterWithEnableAHUB() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_UpdateWithAHUB.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersCreate_UpdateWithAHUB.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -2324,7 +2493,7 @@ public async Task CreateOrUpdate_CreateUpdateManagedClusterWithEnableAHUB() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateUpdateManagedClusterWithWindowsGMSAEnabled() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_UpdateWindowsGmsa.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersCreate_UpdateWindowsGmsa.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -2428,7 +2597,7 @@ public async Task CreateOrUpdate_CreateUpdateManagedClusterWithWindowsGMSAEnable [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateUpdateManagedClusterWithDualStackNetworking() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_DualStackNetworking.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersCreate_DualStackNetworking.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -2535,7 +2704,7 @@ public async Task CreateOrUpdate_CreateUpdateManagedClusterWithDualStackNetworki [Ignore("Only validating compilation of examples")] public async Task Get_GetManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersGet.json // this example is just showing the usage of "ManagedClusters_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -2568,7 +2737,7 @@ public async Task Get_GetManagedCluster() [Ignore("Only validating compilation of examples")] public async Task GetAll_GetManagedClustersByResourceGroup() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersListByResourceGroup.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersListByResourceGroup.json // this example is just showing the usage of "ManagedClusters_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -2603,7 +2772,7 @@ public async Task GetAll_GetManagedClustersByResourceGroup() [Ignore("Only validating compilation of examples")] public async Task Exists_GetManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersGet.json // this example is just showing the usage of "ManagedClusters_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -2632,7 +2801,7 @@ public async Task Exists_GetManagedCluster() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_GetManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersGet.json // this example is just showing the usage of "ManagedClusters_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceManagedClusterResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceManagedClusterResource.cs index 6d601b6ae0e4..ab5a855ddc66 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceManagedClusterResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceManagedClusterResource.cs @@ -20,7 +20,7 @@ public partial class Sample_ContainerServiceManagedClusterResource [Ignore("Only validating compilation of examples")] public async Task Get_GetManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersGet.json // this example is just showing the usage of "ManagedClusters_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -50,7 +50,7 @@ public async Task Get_GetManagedCluster() [Ignore("Only validating compilation of examples")] public async Task Delete_DeleteManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersDelete.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersDelete.json // this example is just showing the usage of "ManagedClusters_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -76,7 +76,7 @@ public async Task Delete_DeleteManagedCluster() [Ignore("Only validating compilation of examples")] public async Task Update_UpdateManagedClusterTags() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersUpdateTags.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersUpdateTags.json // this example is just showing the usage of "ManagedClusters_UpdateTags" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -115,7 +115,7 @@ public async Task Update_UpdateManagedClusterTags() [Ignore("Only validating compilation of examples")] public async Task GetAccessProfile_GetManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersGetAccessProfile.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersGetAccessProfile.json // this example is just showing the usage of "ManagedClusters_GetAccessProfile" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -142,7 +142,7 @@ public async Task GetAccessProfile_GetManagedCluster() [Ignore("Only validating compilation of examples")] public async Task GetClusterAdminCredentials_GetManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersListClusterAdminCredentials.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersListClusterAdminCredentials.json // this example is just showing the usage of "ManagedClusters_ListClusterAdminCredentials" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -168,7 +168,7 @@ public async Task GetClusterAdminCredentials_GetManagedCluster() [Ignore("Only validating compilation of examples")] public async Task GetClusterUserCredentials_GetManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersListClusterUserCredentials.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersListClusterUserCredentials.json // this example is just showing the usage of "ManagedClusters_ListClusterUserCredentials" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -194,7 +194,7 @@ public async Task GetClusterUserCredentials_GetManagedCluster() [Ignore("Only validating compilation of examples")] public async Task GetClusterMonitoringUserCredentials_GetManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersListClusterMonitoringUserCredentials.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersListClusterMonitoringUserCredentials.json // this example is just showing the usage of "ManagedClusters_ListClusterMonitoringUserCredentials" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -220,7 +220,7 @@ public async Task GetClusterMonitoringUserCredentials_GetManagedCluster() [Ignore("Only validating compilation of examples")] public async Task ResetServicePrincipalProfile_ResetServicePrincipalProfile() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersResetServicePrincipalProfile.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersResetServicePrincipalProfile.json // this example is just showing the usage of "ManagedClusters_ResetServicePrincipalProfile" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -250,7 +250,7 @@ public async Task ResetServicePrincipalProfile_ResetServicePrincipalProfile() [Ignore("Only validating compilation of examples")] public async Task ResetAadProfile_ResetAADProfile() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersResetAADProfile.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersResetAADProfile.json // this example is just showing the usage of "ManagedClusters_ResetAadProfile" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -283,7 +283,7 @@ public async Task ResetAadProfile_ResetAADProfile() [Ignore("Only validating compilation of examples")] public async Task RotateClusterCertificates_RotateClusterCertificates() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersRotateClusterCertificates.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersRotateClusterCertificates.json // this example is just showing the usage of "ManagedClusters_RotateClusterCertificates" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -309,7 +309,7 @@ public async Task RotateClusterCertificates_RotateClusterCertificates() [Ignore("Only validating compilation of examples")] public async Task AbortLatestOperation_AbortOperationOnManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersAbortOperation.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersAbortOperation.json // this example is just showing the usage of "ManagedClusters_AbortLatestOperation" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -335,7 +335,7 @@ public async Task AbortLatestOperation_AbortOperationOnManagedCluster() [Ignore("Only validating compilation of examples")] public async Task RotateServiceAccountSigningKeys_RotateClusterServiceAccountSigningKeys() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersRotateServiceAccountSigningKeys.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersRotateServiceAccountSigningKeys.json // this example is just showing the usage of "ManagedClusters_RotateServiceAccountSigningKeys" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -361,7 +361,7 @@ public async Task RotateServiceAccountSigningKeys_RotateClusterServiceAccountSig [Ignore("Only validating compilation of examples")] public async Task Stop_StopManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersStop.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersStop.json // this example is just showing the usage of "ManagedClusters_Stop" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -387,7 +387,7 @@ public async Task Stop_StopManagedCluster() [Ignore("Only validating compilation of examples")] public async Task Start_StartManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersStart.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersStart.json // this example is just showing the usage of "ManagedClusters_Start" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -413,7 +413,7 @@ public async Task Start_StartManagedCluster() [Ignore("Only validating compilation of examples")] public async Task RunCommand_SubmitNewCommand() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/RunCommandRequest.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/RunCommandRequest.json // this example is just showing the usage of "ManagedClusters_RunCommand" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -445,7 +445,7 @@ public async Task RunCommand_SubmitNewCommand() [Ignore("Only validating compilation of examples")] public async Task GetCommandResult_CommandFailedResult() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/RunCommandResultFailed.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/RunCommandResultFailed.json // this example is just showing the usage of "ManagedClusters_GetCommandResult" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -472,7 +472,7 @@ public async Task GetCommandResult_CommandFailedResult() [Ignore("Only validating compilation of examples")] public async Task GetCommandResult_CommandSucceedResult() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/RunCommandResultSucceed.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/RunCommandResultSucceed.json // this example is just showing the usage of "ManagedClusters_GetCommandResult" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -499,7 +499,7 @@ public async Task GetCommandResult_CommandSucceedResult() [Ignore("Only validating compilation of examples")] public async Task GetOutboundNetworkDependenciesEndpoints_ListOutboundNetworkDependenciesEndpointsByManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/OutboundNetworkDependenciesEndpointsList.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/OutboundNetworkDependenciesEndpointsList.json // this example is just showing the usage of "ManagedClusters_ListOutboundNetworkDependenciesEndpoints" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -528,7 +528,7 @@ public async Task GetOutboundNetworkDependenciesEndpoints_ListOutboundNetworkDep [Ignore("Only validating compilation of examples")] public async Task GetAvailableAgentPoolVersions_GetAvailableVersionsForAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsGetAgentPoolAvailableVersions.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/AgentPoolsGetAgentPoolAvailableVersions.json // this example is just showing the usage of "AgentPools_GetAvailableAgentPoolVersions" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -554,7 +554,7 @@ public async Task GetAvailableAgentPoolVersions_GetAvailableVersionsForAgentPool [Ignore("Only validating compilation of examples")] public async Task GetPrivateLinkResources_ListPrivateLinkResourcesByManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/PrivateLinkResourcesList.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/PrivateLinkResourcesList.json // this example is just showing the usage of "PrivateLinkResources_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -583,7 +583,7 @@ public async Task GetPrivateLinkResources_ListPrivateLinkResourcesByManagedClust [Ignore("Only validating compilation of examples")] public async Task ResolvePrivateLinkServiceId_ResolveThePrivateLinkServiceIDForManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ResolvePrivateLinkServiceId.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ResolvePrivateLinkServiceId.json // this example is just showing the usage of "ResolvePrivateLinkServiceId_Post" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServicePrivateEndpointConnectionCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServicePrivateEndpointConnectionCollection.cs index c86354e22e27..dc6a75a63ec8 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServicePrivateEndpointConnectionCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServicePrivateEndpointConnectionCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_ContainerServicePrivateEndpointConnectionCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_UpdatePrivateEndpointConnection() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/PrivateEndpointConnectionsUpdate.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/PrivateEndpointConnectionsUpdate.json // this example is just showing the usage of "PrivateEndpointConnections_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -62,7 +62,7 @@ public async Task CreateOrUpdate_UpdatePrivateEndpointConnection() [Ignore("Only validating compilation of examples")] public async Task Get_GetPrivateEndpointConnection() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/PrivateEndpointConnectionsGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/PrivateEndpointConnectionsGet.json // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -96,7 +96,7 @@ public async Task Get_GetPrivateEndpointConnection() [Ignore("Only validating compilation of examples")] public async Task GetAll_ListPrivateEndpointConnectionsByManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/PrivateEndpointConnectionsList.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/PrivateEndpointConnectionsList.json // this example is just showing the usage of "PrivateEndpointConnections_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -132,7 +132,7 @@ public async Task GetAll_ListPrivateEndpointConnectionsByManagedCluster() [Ignore("Only validating compilation of examples")] public async Task Exists_GetPrivateEndpointConnection() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/PrivateEndpointConnectionsGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/PrivateEndpointConnectionsGet.json // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -162,7 +162,7 @@ public async Task Exists_GetPrivateEndpointConnection() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_GetPrivateEndpointConnection() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/PrivateEndpointConnectionsGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/PrivateEndpointConnectionsGet.json // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServicePrivateEndpointConnectionResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServicePrivateEndpointConnectionResource.cs index 9e5acc67aca0..422f44c3e674 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServicePrivateEndpointConnectionResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServicePrivateEndpointConnectionResource.cs @@ -20,7 +20,7 @@ public partial class Sample_ContainerServicePrivateEndpointConnectionResource [Ignore("Only validating compilation of examples")] public async Task Get_GetPrivateEndpointConnection() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/PrivateEndpointConnectionsGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/PrivateEndpointConnectionsGet.json // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -51,7 +51,7 @@ public async Task Get_GetPrivateEndpointConnection() [Ignore("Only validating compilation of examples")] public async Task Delete_DeletePrivateEndpointConnection() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/PrivateEndpointConnectionsDelete.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/PrivateEndpointConnectionsDelete.json // this example is just showing the usage of "PrivateEndpointConnections_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -78,7 +78,7 @@ public async Task Delete_DeletePrivateEndpointConnection() [Ignore("Only validating compilation of examples")] public async Task Update_UpdatePrivateEndpointConnection() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/PrivateEndpointConnectionsUpdate.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/PrivateEndpointConnectionsUpdate.json // this example is just showing the usage of "PrivateEndpointConnections_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceTrustedAccessRoleBindingCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceTrustedAccessRoleBindingCollection.cs index 0b58e1ae96a7..f92e0cdba65f 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceTrustedAccessRoleBindingCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceTrustedAccessRoleBindingCollection.cs @@ -19,7 +19,7 @@ public partial class Sample_ContainerServiceTrustedAccessRoleBindingCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateOrUpdateATrustedAccessRoleBinding() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/TrustedAccessRoleBindings_CreateOrUpdate.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/TrustedAccessRoleBindings_CreateOrUpdate.json // this example is just showing the usage of "TrustedAccessRoleBindings_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -55,7 +55,7 @@ public async Task CreateOrUpdate_CreateOrUpdateATrustedAccessRoleBinding() [Ignore("Only validating compilation of examples")] public async Task Get_GetATrustedAccessRoleBinding() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/TrustedAccessRoleBindings_Get.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/TrustedAccessRoleBindings_Get.json // this example is just showing the usage of "TrustedAccessRoleBindings_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -89,7 +89,7 @@ public async Task Get_GetATrustedAccessRoleBinding() [Ignore("Only validating compilation of examples")] public async Task GetAll_ListTrustedAccessRoleBindings() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/TrustedAccessRoleBindings_List.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/TrustedAccessRoleBindings_List.json // this example is just showing the usage of "TrustedAccessRoleBindings_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -125,7 +125,7 @@ public async Task GetAll_ListTrustedAccessRoleBindings() [Ignore("Only validating compilation of examples")] public async Task Exists_GetATrustedAccessRoleBinding() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/TrustedAccessRoleBindings_Get.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/TrustedAccessRoleBindings_Get.json // this example is just showing the usage of "TrustedAccessRoleBindings_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -155,7 +155,7 @@ public async Task Exists_GetATrustedAccessRoleBinding() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_GetATrustedAccessRoleBinding() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/TrustedAccessRoleBindings_Get.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/TrustedAccessRoleBindings_Get.json // this example is just showing the usage of "TrustedAccessRoleBindings_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceTrustedAccessRoleBindingResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceTrustedAccessRoleBindingResource.cs index 6d9666b3d4c5..ee9656ab60ae 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceTrustedAccessRoleBindingResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceTrustedAccessRoleBindingResource.cs @@ -19,7 +19,7 @@ public partial class Sample_ContainerServiceTrustedAccessRoleBindingResource [Ignore("Only validating compilation of examples")] public async Task Get_GetATrustedAccessRoleBinding() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/TrustedAccessRoleBindings_Get.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/TrustedAccessRoleBindings_Get.json // this example is just showing the usage of "TrustedAccessRoleBindings_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -50,7 +50,7 @@ public async Task Get_GetATrustedAccessRoleBinding() [Ignore("Only validating compilation of examples")] public async Task Delete_DeleteATrustedAccessRoleBinding() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/TrustedAccessRoleBindings_Delete.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/TrustedAccessRoleBindings_Delete.json // this example is just showing the usage of "TrustedAccessRoleBindings_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -77,7 +77,7 @@ public async Task Delete_DeleteATrustedAccessRoleBinding() [Ignore("Only validating compilation of examples")] public async Task Update_CreateOrUpdateATrustedAccessRoleBinding() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/TrustedAccessRoleBindings_CreateOrUpdate.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/TrustedAccessRoleBindings_CreateOrUpdate.json // this example is just showing the usage of "TrustedAccessRoleBindings_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MachineCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MachineCollection.cs new file mode 100644 index 000000000000..911a0383a032 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MachineCollection.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.ResourceManager.ContainerService.Samples +{ + public partial class Sample_MachineCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetAMachineInAnAgentPoolsByManagedCluster() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/MachineGet.json + // this example is just showing the usage of "Machines_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceAgentPoolResource created on azure + // for more information of creating ContainerServiceAgentPoolResource, please refer to the document of ContainerServiceAgentPoolResource + string subscriptionId = "26fe00f8-9173-4872-9134-bb1d2e00343a"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + string agentPoolName = "agentpool1"; + ResourceIdentifier containerServiceAgentPoolResourceId = ContainerServiceAgentPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, agentPoolName); + ContainerServiceAgentPoolResource containerServiceAgentPool = client.GetContainerServiceAgentPoolResource(containerServiceAgentPoolResourceId); + + // get the collection of this MachineResource + MachineCollection collection = containerServiceAgentPool.GetMachines(); + + // invoke the operation + string machineName = "aks-nodepool1-42263519-vmss00000t"; + MachineResource result = await collection.GetAsync(machineName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MachineData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_ListMachinesInAnAgentpoolByManagedCluster() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/MachineList.json + // this example is just showing the usage of "Machines_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceAgentPoolResource created on azure + // for more information of creating ContainerServiceAgentPoolResource, please refer to the document of ContainerServiceAgentPoolResource + string subscriptionId = "26fe00f8-9173-4872-9134-bb1d2e00343a"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + string agentPoolName = "agentpool1"; + ResourceIdentifier containerServiceAgentPoolResourceId = ContainerServiceAgentPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, agentPoolName); + ContainerServiceAgentPoolResource containerServiceAgentPool = client.GetContainerServiceAgentPoolResource(containerServiceAgentPoolResourceId); + + // get the collection of this MachineResource + MachineCollection collection = containerServiceAgentPool.GetMachines(); + + // invoke the operation and iterate over the result + await foreach (MachineResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MachineData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_GetAMachineInAnAgentPoolsByManagedCluster() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/MachineGet.json + // this example is just showing the usage of "Machines_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceAgentPoolResource created on azure + // for more information of creating ContainerServiceAgentPoolResource, please refer to the document of ContainerServiceAgentPoolResource + string subscriptionId = "26fe00f8-9173-4872-9134-bb1d2e00343a"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + string agentPoolName = "agentpool1"; + ResourceIdentifier containerServiceAgentPoolResourceId = ContainerServiceAgentPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, agentPoolName); + ContainerServiceAgentPoolResource containerServiceAgentPool = client.GetContainerServiceAgentPoolResource(containerServiceAgentPoolResourceId); + + // get the collection of this MachineResource + MachineCollection collection = containerServiceAgentPool.GetMachines(); + + // invoke the operation + string machineName = "aks-nodepool1-42263519-vmss00000t"; + bool result = await collection.ExistsAsync(machineName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetAMachineInAnAgentPoolsByManagedCluster() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/MachineGet.json + // this example is just showing the usage of "Machines_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceAgentPoolResource created on azure + // for more information of creating ContainerServiceAgentPoolResource, please refer to the document of ContainerServiceAgentPoolResource + string subscriptionId = "26fe00f8-9173-4872-9134-bb1d2e00343a"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + string agentPoolName = "agentpool1"; + ResourceIdentifier containerServiceAgentPoolResourceId = ContainerServiceAgentPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, agentPoolName); + ContainerServiceAgentPoolResource containerServiceAgentPool = client.GetContainerServiceAgentPoolResource(containerServiceAgentPoolResourceId); + + // get the collection of this MachineResource + MachineCollection collection = containerServiceAgentPool.GetMachines(); + + // invoke the operation + string machineName = "aks-nodepool1-42263519-vmss00000t"; + NullableResponse response = await collection.GetIfExistsAsync(machineName); + MachineResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MachineData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MachineResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MachineResource.cs new file mode 100644 index 000000000000..809af4e55119 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MachineResource.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.ResourceManager.ContainerService.Samples +{ + public partial class Sample_MachineResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetAMachineInAnAgentPoolsByManagedCluster() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/MachineGet.json + // this example is just showing the usage of "Machines_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MachineResource created on azure + // for more information of creating MachineResource, please refer to the document of MachineResource + string subscriptionId = "26fe00f8-9173-4872-9134-bb1d2e00343a"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + string agentPoolName = "agentpool1"; + string machineName = "aks-nodepool1-42263519-vmss00000t"; + ResourceIdentifier machineResourceId = MachineResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, agentPoolName, machineName); + MachineResource machine = client.GetMachineResource(machineResourceId); + + // invoke the operation + MachineResource result = await machine.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MachineData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ManagedClusterUpgradeProfileResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ManagedClusterUpgradeProfileResource.cs index 0481cdaf7948..797ea0633899 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ManagedClusterUpgradeProfileResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ManagedClusterUpgradeProfileResource.cs @@ -19,7 +19,7 @@ public partial class Sample_ManagedClusterUpgradeProfileResource [Ignore("Only validating compilation of examples")] public async Task Get_GetUpgradeProfileForManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersGetUpgradeProfile.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersGetUpgradeProfile.json // this example is just showing the usage of "ManagedClusters_GetUpgradeProfile" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MeshRevisionProfileCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MeshRevisionProfileCollection.cs index a12ea79e1106..5630116c2f37 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MeshRevisionProfileCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MeshRevisionProfileCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_MeshRevisionProfileCollection [Ignore("Only validating compilation of examples")] public async Task Get_GetAMeshRevisionProfileForAMeshMode() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersGet_MeshRevisionProfile.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersGet_MeshRevisionProfile.json // this example is just showing the usage of "ManagedClusters_GetMeshRevisionProfile" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -53,7 +53,7 @@ public async Task Get_GetAMeshRevisionProfileForAMeshMode() [Ignore("Only validating compilation of examples")] public async Task GetAll_ListMeshRevisionProfilesInALocation() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersList_MeshRevisionProfiles.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersList_MeshRevisionProfiles.json // this example is just showing the usage of "ManagedClusters_ListMeshRevisionProfiles" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -88,7 +88,7 @@ public async Task GetAll_ListMeshRevisionProfilesInALocation() [Ignore("Only validating compilation of examples")] public async Task Exists_GetAMeshRevisionProfileForAMeshMode() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersGet_MeshRevisionProfile.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersGet_MeshRevisionProfile.json // this example is just showing the usage of "ManagedClusters_GetMeshRevisionProfile" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -117,7 +117,7 @@ public async Task Exists_GetAMeshRevisionProfileForAMeshMode() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_GetAMeshRevisionProfileForAMeshMode() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersGet_MeshRevisionProfile.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersGet_MeshRevisionProfile.json // this example is just showing the usage of "ManagedClusters_GetMeshRevisionProfile" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MeshRevisionProfileResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MeshRevisionProfileResource.cs index 8e0938d5a73e..e31a649e92ad 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MeshRevisionProfileResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MeshRevisionProfileResource.cs @@ -19,7 +19,7 @@ public partial class Sample_MeshRevisionProfileResource [Ignore("Only validating compilation of examples")] public async Task Get_GetAMeshRevisionProfileForAMeshMode() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersGet_MeshRevisionProfile.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersGet_MeshRevisionProfile.json // this example is just showing the usage of "ManagedClusters_GetMeshRevisionProfile" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MeshUpgradeProfileCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MeshUpgradeProfileCollection.cs index 53dc0a0a6d5c..2ca0dc64acf6 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MeshUpgradeProfileCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MeshUpgradeProfileCollection.cs @@ -19,7 +19,7 @@ public partial class Sample_MeshUpgradeProfileCollection [Ignore("Only validating compilation of examples")] public async Task Get_GetsVersionCompatibilityAndUpgradeProfileForAServiceMeshInACluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersGet_MeshUpgradeProfile.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersGet_MeshUpgradeProfile.json // this example is just showing the usage of "ManagedClusters_GetMeshUpgradeProfile" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -53,7 +53,7 @@ public async Task Get_GetsVersionCompatibilityAndUpgradeProfileForAServiceMeshIn [Ignore("Only validating compilation of examples")] public async Task GetAll_ListsVersionCompatibilityAndUpgradeProfileForAllServiceMeshesInACluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersList_MeshUpgradeProfiles.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersList_MeshUpgradeProfiles.json // this example is just showing the usage of "ManagedClusters_ListMeshUpgradeProfiles" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -89,7 +89,7 @@ public async Task GetAll_ListsVersionCompatibilityAndUpgradeProfileForAllService [Ignore("Only validating compilation of examples")] public async Task Exists_GetsVersionCompatibilityAndUpgradeProfileForAServiceMeshInACluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersGet_MeshUpgradeProfile.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersGet_MeshUpgradeProfile.json // this example is just showing the usage of "ManagedClusters_GetMeshUpgradeProfile" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -119,7 +119,7 @@ public async Task Exists_GetsVersionCompatibilityAndUpgradeProfileForAServiceMes [Ignore("Only validating compilation of examples")] public async Task GetIfExists_GetsVersionCompatibilityAndUpgradeProfileForAServiceMeshInACluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersGet_MeshUpgradeProfile.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersGet_MeshUpgradeProfile.json // this example is just showing the usage of "ManagedClusters_GetMeshUpgradeProfile" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MeshUpgradeProfileResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MeshUpgradeProfileResource.cs index d2e1b5438892..731a51e0f61b 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MeshUpgradeProfileResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MeshUpgradeProfileResource.cs @@ -19,7 +19,7 @@ public partial class Sample_MeshUpgradeProfileResource [Ignore("Only validating compilation of examples")] public async Task Get_GetsVersionCompatibilityAndUpgradeProfileForAServiceMeshInACluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersGet_MeshUpgradeProfile.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersGet_MeshUpgradeProfile.json // this example is just showing the usage of "ManagedClusters_GetMeshUpgradeProfile" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs index d4e1e40228ea..5b285999e6ec 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -21,7 +21,7 @@ public partial class Sample_SubscriptionResourceExtensions [Ignore("Only validating compilation of examples")] public async Task GetKubernetesVersionsManagedCluster_ListKubernetesVersions() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/KubernetesVersions_List.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/KubernetesVersions_List.json // this example is just showing the usage of "ManagedClusters_ListKubernetesVersions" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -46,7 +46,7 @@ public async Task GetKubernetesVersionsManagedCluster_ListKubernetesVersions() [Ignore("Only validating compilation of examples")] public async Task GetContainerServiceManagedClusters_ListManagedClusters() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersList.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/ManagedClustersList.json // this example is just showing the usage of "ManagedClusters_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -77,7 +77,7 @@ public async Task GetContainerServiceManagedClusters_ListManagedClusters() [Ignore("Only validating compilation of examples")] public async Task GetAgentPoolSnapshots_ListSnapshots() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/SnapshotsList.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/SnapshotsList.json // this example is just showing the usage of "Snapshots_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -108,7 +108,7 @@ public async Task GetAgentPoolSnapshots_ListSnapshots() [Ignore("Only validating compilation of examples")] public async Task GetTrustedAccessRoles_ListTrustedAccessRoles() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/TrustedAccessRoles_List.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2025-01-01/examples/TrustedAccessRoles_List.json // this example is just showing the usage of "TrustedAccessRoles_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotCollection.cs index 327b8b63ae23..cdf7818f9964 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotCollection.cs @@ -65,7 +65,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -116,7 +116,7 @@ public virtual async Task> CreateOrUpdat /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -167,7 +167,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -212,7 +212,7 @@ public virtual async Task> GetAsync(string r /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -257,7 +257,7 @@ public virtual Response Get(string resourceName, Canc /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -287,7 +287,7 @@ public virtual AsyncPageable GetAllAsync(Cancellation /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -317,7 +317,7 @@ public virtual Pageable GetAll(CancellationToken canc /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -360,7 +360,7 @@ public virtual async Task> ExistsAsync(string resourceName, Cance /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -403,7 +403,7 @@ public virtual Response Exists(string resourceName, CancellationToken canc /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -448,7 +448,7 @@ public virtual async Task> GetIfExis /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotResource.cs index 6045d3413e5b..c123d8428132 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotResource.cs @@ -103,7 +103,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -143,7 +143,7 @@ public virtual async Task> GetAsync(Cancella /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -183,7 +183,7 @@ public virtual Response Get(CancellationToken cancell /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -227,7 +227,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -271,7 +271,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -313,7 +313,7 @@ public virtual async Task> UpdateAsync(Conta /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -355,7 +355,7 @@ public virtual Response Update(ContainerServiceTagsOb /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -417,7 +417,7 @@ public virtual async Task> AddTagAsync(strin /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -479,7 +479,7 @@ public virtual Response AddTag(string key, string val /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -536,7 +536,7 @@ public virtual async Task> SetTagsAsync(IDic /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -593,7 +593,7 @@ public virtual Response SetTags(IDictionary /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -653,7 +653,7 @@ public virtual async Task> RemoveTagAsync(st /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolUpgradeProfileResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolUpgradeProfileResource.cs index 9c357b37cb3d..27fcf5ab0550 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolUpgradeProfileResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolUpgradeProfileResource.cs @@ -101,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -141,7 +141,7 @@ public virtual async Task> GetAsync(Ca /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ArmContainerServiceModelFactory.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ArmContainerServiceModelFactory.cs index d8ce03a6d98a..5e42cc80ed1f 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ArmContainerServiceModelFactory.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ArmContainerServiceModelFactory.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using System.Net; using Azure.Core; @@ -18,35 +19,6 @@ namespace Azure.ResourceManager.ContainerService.Models /// Model factory for models. public static partial class ArmContainerServiceModelFactory { - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The list of OS options. - /// A new instance for mocking. - public static OSOptionProfileData OSOptionProfileData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IEnumerable osOptionPropertyList = null) - { - osOptionPropertyList ??= new List(); - - return new OSOptionProfileData( - id, - name, - resourceType, - systemData, - osOptionPropertyList?.ToList(), - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The OS type. - /// Whether the image is FIPS-enabled. - /// A new instance for mocking. - public static ContainerServiceOSOptionProperty ContainerServiceOSOptionProperty(string osType = null, bool enableFipsImage = default) - { - return new ContainerServiceOSOptionProperty(osType, enableFipsImage, serializedAdditionalRawData: null); - } - /// Initializes a new instance of . /// Array of AKS supported Kubernetes versions. /// A new instance for mocking. @@ -60,15 +32,22 @@ public static KubernetesVersionListResult KubernetesVersionListResult(IEnumerabl /// Initializes a new instance of . /// major.minor version of Kubernetes release. /// Capabilities on this Kubernetes version. + /// Whether this version is default. /// Whether this version is in preview mode. /// Patch versions of Kubernetes release. /// A new instance for mocking. - public static KubernetesVersion KubernetesVersion(string version = null, IEnumerable capabilitiesSupportPlan = null, bool? isPreview = null, IReadOnlyDictionary patchVersions = null) + public static KubernetesVersion KubernetesVersion(string version = null, IEnumerable capabilitiesSupportPlan = null, bool? isDefault = null, bool? isPreview = null, IReadOnlyDictionary patchVersions = null) { capabilitiesSupportPlan ??= new List(); patchVersions ??= new Dictionary(); - return new KubernetesVersion(version, capabilitiesSupportPlan != null ? new KubernetesVersionCapabilities(capabilitiesSupportPlan?.ToList(), serializedAdditionalRawData: null) : null, isPreview, patchVersions, serializedAdditionalRawData: null); + return new KubernetesVersion( + version, + capabilitiesSupportPlan != null ? new KubernetesVersionCapabilities(capabilitiesSupportPlan?.ToList(), serializedAdditionalRawData: null) : null, + isDefault, + isPreview, + patchVersions, + serializedAdditionalRawData: null); } /// Initializes a new instance of . @@ -88,6 +67,7 @@ public static KubernetesPatchVersion KubernetesPatchVersion(IEnumerable /// The systemData. /// The tags. /// The location. + /// Unique read-only string used to implement optimistic concurrency. The eTag value will change when the resource is updated. Specify an if-match or if-none-match header with the eTag value for a subsequent request to enable optimistic concurrency per the normal etag convention. /// The managed cluster SKU. /// The extended location of the Virtual Machine. /// The identity of the managed cluster, if configured. @@ -109,6 +89,7 @@ public static KubernetesPatchVersion KubernetesPatchVersion(IEnumerable /// See [use AAD pod identity](https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity) for more details on AAD pod identity integration. /// The OIDC issuer profile of the Managed Cluster. /// The name of the resource group containing agent pool nodes. + /// Profile of the node resource group configuration. /// Whether to enable Kubernetes Role-Based Access Control. /// The support plan for the Managed Cluster. If unspecified, the default is 'KubernetesOfficial'. /// (DEPRECATED) Whether to enable Kubernetes pod security policy (preview). PodSecurityPolicy was deprecated in Kubernetes v1.21, and removed from Kubernetes in v1.25. Learn more at https://aka.ms/k8s/psp and https://aka.ms/aks/psp. @@ -119,19 +100,22 @@ public static KubernetesPatchVersion KubernetesPatchVersion(IEnumerable /// Parameters to be applied to the cluster-autoscaler when enabled. /// The access profile for managed cluster API server. /// This is of the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{encryptionSetName}'. - /// Identities associated with the cluster. + /// The user identity associated with the managed cluster. This identity will be used by the kubelet. Only one user assigned identity is allowed. The only accepted key is "kubeletidentity", with value of "resourceId": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}". /// Private link resources associated with the cluster. /// If set to true, getting static credentials will be disabled for this cluster. This must only be used on Managed Clusters that are AAD enabled. For more details see [disable local accounts](https://docs.microsoft.com/azure/aks/managed-aad#disable-local-accounts-preview). /// Configurations for provisioning the cluster with HTTP proxy servers. /// Security profile for the managed cluster. /// Storage profile for the managed cluster. + /// Ingress profile for the managed cluster. /// Allow or deny public network access for AKS. /// Workload Auto-scaler profile for the managed cluster. /// Azure Monitor addon profiles for monitoring the managed cluster. /// Service mesh profile for a managed cluster. /// The resourceUID uniquely identifies ManagedClusters that reuse ARM ResourceIds (i.e: create, delete, create sequence). + /// Optional cluster metrics configuration. + /// Profile of the cluster bootstrap configuration. /// A new instance for mocking. - public static ContainerServiceManagedClusterData ContainerServiceManagedClusterData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ManagedClusterSku sku = null, ExtendedLocation extendedLocation = null, ManagedClusterIdentity clusterIdentity = null, string provisioningState = null, ContainerServiceStateCode? powerStateCode = null, int? maxAgentPools = null, string kubernetesVersion = null, string currentKubernetesVersion = null, string dnsPrefix = null, string fqdnSubdomain = null, string fqdn = null, string privateFqdn = null, string azurePortalFqdn = null, IEnumerable agentPoolProfiles = null, ContainerServiceLinuxProfile linuxProfile = null, ManagedClusterWindowsProfile windowsProfile = null, ManagedClusterServicePrincipalProfile servicePrincipalProfile = null, IDictionary addonProfiles = null, ManagedClusterPodIdentityProfile podIdentityProfile = null, ManagedClusterOidcIssuerProfile oidcIssuerProfile = null, string nodeResourceGroup = null, bool? enableRbac = null, KubernetesSupportPlan? supportPlan = null, bool? enablePodSecurityPolicy = null, ContainerServiceNetworkProfile networkProfile = null, ManagedClusterAadProfile aadProfile = null, ManagedClusterAutoUpgradeProfile autoUpgradeProfile = null, UpgradeOverrideSettings upgradeOverrideSettings = null, ManagedClusterAutoScalerProfile autoScalerProfile = null, ManagedClusterApiServerAccessProfile apiServerAccessProfile = null, ResourceIdentifier diskEncryptionSetId = null, IDictionary identityProfile = null, IEnumerable privateLinkResources = null, bool? disableLocalAccounts = null, ManagedClusterHttpProxyConfig httpProxyConfig = null, ManagedClusterSecurityProfile securityProfile = null, ManagedClusterStorageProfile storageProfile = null, ContainerServicePublicNetworkAccess? publicNetworkAccess = null, ManagedClusterWorkloadAutoScalerProfile workloadAutoScalerProfile = null, ManagedClusterMonitorProfileMetrics azureMonitorMetrics = null, ServiceMeshProfile serviceMeshProfile = null, ResourceIdentifier resourceId = null) + public static ContainerServiceManagedClusterData ContainerServiceManagedClusterData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ETag? etag = null, ManagedClusterSku sku = null, ExtendedLocation extendedLocation = null, ManagedClusterIdentity clusterIdentity = null, string provisioningState = null, ContainerServiceStateCode? powerStateCode = null, int? maxAgentPools = null, string kubernetesVersion = null, string currentKubernetesVersion = null, string dnsPrefix = null, string fqdnSubdomain = null, string fqdn = null, string privateFqdn = null, string azurePortalFqdn = null, IEnumerable agentPoolProfiles = null, ContainerServiceLinuxProfile linuxProfile = null, ManagedClusterWindowsProfile windowsProfile = null, ManagedClusterServicePrincipalProfile servicePrincipalProfile = null, IDictionary addonProfiles = null, ManagedClusterPodIdentityProfile podIdentityProfile = null, ManagedClusterOidcIssuerProfile oidcIssuerProfile = null, string nodeResourceGroup = null, RestrictionLevel? nodeResourceGroupRestrictionLevel = null, bool? enableRbac = null, KubernetesSupportPlan? supportPlan = null, bool? enablePodSecurityPolicy = null, ContainerServiceNetworkProfile networkProfile = null, ManagedClusterAadProfile aadProfile = null, ManagedClusterAutoUpgradeProfile autoUpgradeProfile = null, UpgradeOverrideSettings upgradeOverrideSettings = null, ManagedClusterAutoScalerProfile autoScalerProfile = null, ManagedClusterApiServerAccessProfile apiServerAccessProfile = null, ResourceIdentifier diskEncryptionSetId = null, IDictionary identityProfile = null, IEnumerable privateLinkResources = null, bool? disableLocalAccounts = null, ManagedClusterHttpProxyConfig httpProxyConfig = null, ManagedClusterSecurityProfile securityProfile = null, ManagedClusterStorageProfile storageProfile = null, ManagedClusterIngressProfileWebAppRouting ingressWebAppRouting = null, ContainerServicePublicNetworkAccess? publicNetworkAccess = null, ManagedClusterWorkloadAutoScalerProfile workloadAutoScalerProfile = null, ManagedClusterMonitorProfileMetrics azureMonitorMetrics = null, ServiceMeshProfile serviceMeshProfile = null, ResourceIdentifier resourceId = null, bool? costAnalysisEnabled = null, ManagedClusterBootstrapProfile bootstrapProfile = null) { tags ??= new Dictionary(); agentPoolProfiles ??= new List(); @@ -146,6 +130,7 @@ public static ContainerServiceManagedClusterData ContainerServiceManagedClusterD systemData, tags, location, + etag, sku, extendedLocation, clusterIdentity, @@ -167,6 +152,7 @@ public static ContainerServiceManagedClusterData ContainerServiceManagedClusterD podIdentityProfile, oidcIssuerProfile, nodeResourceGroup, + nodeResourceGroupRestrictionLevel != null ? new ManagedClusterNodeResourceGroupProfile(nodeResourceGroupRestrictionLevel, serializedAdditionalRawData: null) : null, enableRbac, supportPlan, enablePodSecurityPolicy, @@ -183,21 +169,26 @@ public static ContainerServiceManagedClusterData ContainerServiceManagedClusterD httpProxyConfig, securityProfile, storageProfile, + ingressWebAppRouting != null ? new ManagedClusterIngressProfile(ingressWebAppRouting, serializedAdditionalRawData: null) : null, publicNetworkAccess, workloadAutoScalerProfile, azureMonitorMetrics != null ? new ManagedClusterAzureMonitorProfile(azureMonitorMetrics, serializedAdditionalRawData: null) : null, serviceMeshProfile, resourceId, + costAnalysisEnabled != null ? new ManagedClusterMetricsProfile(new ManagedClusterCostAnalysis(costAnalysisEnabled, serializedAdditionalRawData: null), serializedAdditionalRawData: null) : null, + bootstrapProfile, serializedAdditionalRawData: null); } /// Initializes a new instance of . + /// Unique read-only string used to implement optimistic concurrency. The eTag value will change when the resource is updated. Specify an if-match or if-none-match header with the eTag value for a subsequent request to enable optimistic concurrency per the normal etag convention. /// Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. /// VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. /// OS Disk Size in GB to be used to specify the disk size for every machine in the master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. /// The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see [Ephemeral OS](https://docs.microsoft.com/azure/aks/cluster-configuration#ephemeral-os). /// Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. /// Determines the type of workload a node can run. + /// A base64-encoded string which will be written to /etc/motd after decoding. This allows customization of the message of the day for Linux nodes. It must not be specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be executed as a script). /// If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just nodes. This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. /// If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. /// The maximum number of pods that can run on a node. @@ -235,9 +226,12 @@ public static ContainerServiceManagedClusterData ContainerServiceManagedClusterD /// AKS will associate the specified agent pool with the Capacity Reservation Group. /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. For more information see [Azure dedicated hosts](https://docs.microsoft.com/azure/virtual-machines/dedicated-hosts). /// Network-related settings of an agent pool. + /// The Windows agent pool's specific profile. + /// The security settings of an agent pool. + /// GPU settings for the Agent Pool. /// Windows agent pool names must be 6 characters or less. /// A new instance for mocking. - public static ManagedClusterAgentPoolProfile ManagedClusterAgentPoolProfile(int? count = null, string vmSize = null, int? osDiskSizeInGB = null, ContainerServiceOSDiskType? osDiskType = null, KubeletDiskType? kubeletDiskType = null, WorkloadRuntime? workloadRuntime = null, ResourceIdentifier vnetSubnetId = null, ResourceIdentifier podSubnetId = null, int? maxPods = null, ContainerServiceOSType? osType = null, ContainerServiceOSSku? osSku = null, int? maxCount = null, int? minCount = null, bool? enableAutoScaling = null, ScaleDownMode? scaleDownMode = null, AgentPoolType? agentPoolType = null, AgentPoolMode? mode = null, string orchestratorVersion = null, string currentOrchestratorVersion = null, string nodeImageVersion = null, AgentPoolUpgradeSettings upgradeSettings = null, string provisioningState = null, ContainerServiceStateCode? powerStateCode = null, IEnumerable availabilityZones = null, bool? enableNodePublicIP = null, ResourceIdentifier nodePublicIPPrefixId = null, ScaleSetPriority? scaleSetPriority = null, ScaleSetEvictionPolicy? scaleSetEvictionPolicy = null, float? spotMaxPrice = null, IDictionary tags = null, IDictionary nodeLabels = null, IEnumerable nodeTaints = null, ResourceIdentifier proximityPlacementGroupId = null, KubeletConfig kubeletConfig = null, LinuxOSConfig linuxOSConfig = null, bool? enableEncryptionAtHost = null, bool? enableUltraSsd = null, bool? enableFips = null, GpuInstanceProfile? gpuInstanceProfile = null, ResourceIdentifier creationDataSourceResourceId = null, ResourceIdentifier capacityReservationGroupId = null, ResourceIdentifier hostGroupId = null, AgentPoolNetworkProfile networkProfile = null, string name = null) + public static ManagedClusterAgentPoolProfile ManagedClusterAgentPoolProfile(ETag? etag = null, int? count = null, string vmSize = null, int? osDiskSizeInGB = null, ContainerServiceOSDiskType? osDiskType = null, KubeletDiskType? kubeletDiskType = null, WorkloadRuntime? workloadRuntime = null, string messageOfTheDay = null, ResourceIdentifier vnetSubnetId = null, ResourceIdentifier podSubnetId = null, int? maxPods = null, ContainerServiceOSType? osType = null, ContainerServiceOSSku? osSku = null, int? maxCount = null, int? minCount = null, bool? enableAutoScaling = null, ScaleDownMode? scaleDownMode = null, AgentPoolType? agentPoolType = null, AgentPoolMode? mode = null, string orchestratorVersion = null, string currentOrchestratorVersion = null, string nodeImageVersion = null, AgentPoolUpgradeSettings upgradeSettings = null, string provisioningState = null, ContainerServiceStateCode? powerStateCode = null, IEnumerable availabilityZones = null, bool? enableNodePublicIP = null, ResourceIdentifier nodePublicIPPrefixId = null, ScaleSetPriority? scaleSetPriority = null, ScaleSetEvictionPolicy? scaleSetEvictionPolicy = null, float? spotMaxPrice = null, IDictionary tags = null, IDictionary nodeLabels = null, IEnumerable nodeTaints = null, ResourceIdentifier proximityPlacementGroupId = null, KubeletConfig kubeletConfig = null, LinuxOSConfig linuxOSConfig = null, bool? enableEncryptionAtHost = null, bool? enableUltraSsd = null, bool? enableFips = null, GpuInstanceProfile? gpuInstanceProfile = null, ResourceIdentifier creationDataSourceResourceId = null, ResourceIdentifier capacityReservationGroupId = null, ResourceIdentifier hostGroupId = null, AgentPoolNetworkProfile networkProfile = null, bool? disableOutboundNat = null, AgentPoolSecurityProfile securityProfile = null, GpuDriver? gpuDriver = null, string name = null) { availabilityZones ??= new List(); tags ??= new Dictionary(); @@ -245,12 +239,14 @@ public static ManagedClusterAgentPoolProfile ManagedClusterAgentPoolProfile(int? nodeTaints ??= new List(); return new ManagedClusterAgentPoolProfile( + etag, count, vmSize, osDiskSizeInGB, osDiskType, kubeletDiskType, workloadRuntime, + messageOfTheDay, vnetSubnetId, podSubnetId, maxPods, @@ -288,17 +284,22 @@ public static ManagedClusterAgentPoolProfile ManagedClusterAgentPoolProfile(int? capacityReservationGroupId, hostGroupId, networkProfile, + disableOutboundNat != null ? new AgentPoolWindowsProfile(disableOutboundNat, serializedAdditionalRawData: null) : null, + securityProfile, + gpuDriver != null ? new GpuProfile(gpuDriver, serializedAdditionalRawData: null) : null, serializedAdditionalRawData: null, name); } /// Initializes a new instance of . + /// Unique read-only string used to implement optimistic concurrency. The eTag value will change when the resource is updated. Specify an if-match or if-none-match header with the eTag value for a subsequent request to enable optimistic concurrency per the normal etag convention. /// Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. /// VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. /// OS Disk Size in GB to be used to specify the disk size for every machine in the master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. /// The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see [Ephemeral OS](https://docs.microsoft.com/azure/aks/cluster-configuration#ephemeral-os). /// Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. /// Determines the type of workload a node can run. + /// A base64-encoded string which will be written to /etc/motd after decoding. This allows customization of the message of the day for Linux nodes. It must not be specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be executed as a script). /// If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just nodes. This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. /// If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. /// The maximum number of pods that can run on a node. @@ -336,8 +337,11 @@ public static ManagedClusterAgentPoolProfile ManagedClusterAgentPoolProfile(int? /// AKS will associate the specified agent pool with the Capacity Reservation Group. /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. For more information see [Azure dedicated hosts](https://docs.microsoft.com/azure/virtual-machines/dedicated-hosts). /// Network-related settings of an agent pool. + /// The Windows agent pool's specific profile. + /// The security settings of an agent pool. + /// GPU settings for the Agent Pool. /// A new instance for mocking. - public static ManagedClusterAgentPoolProfileProperties ManagedClusterAgentPoolProfileProperties(int? count = null, string vmSize = null, int? osDiskSizeInGB = null, ContainerServiceOSDiskType? osDiskType = null, KubeletDiskType? kubeletDiskType = null, WorkloadRuntime? workloadRuntime = null, ResourceIdentifier vnetSubnetId = null, ResourceIdentifier podSubnetId = null, int? maxPods = null, ContainerServiceOSType? osType = null, ContainerServiceOSSku? osSku = null, int? maxCount = null, int? minCount = null, bool? enableAutoScaling = null, ScaleDownMode? scaleDownMode = null, AgentPoolType? agentPoolType = null, AgentPoolMode? mode = null, string orchestratorVersion = null, string currentOrchestratorVersion = null, string nodeImageVersion = null, AgentPoolUpgradeSettings upgradeSettings = null, string provisioningState = null, ContainerServiceStateCode? powerStateCode = null, IEnumerable availabilityZones = null, bool? enableNodePublicIP = null, ResourceIdentifier nodePublicIPPrefixId = null, ScaleSetPriority? scaleSetPriority = null, ScaleSetEvictionPolicy? scaleSetEvictionPolicy = null, float? spotMaxPrice = null, IDictionary tags = null, IDictionary nodeLabels = null, IEnumerable nodeTaints = null, ResourceIdentifier proximityPlacementGroupId = null, KubeletConfig kubeletConfig = null, LinuxOSConfig linuxOSConfig = null, bool? enableEncryptionAtHost = null, bool? enableUltraSsd = null, bool? enableFips = null, GpuInstanceProfile? gpuInstanceProfile = null, ResourceIdentifier creationDataSourceResourceId = null, ResourceIdentifier capacityReservationGroupId = null, ResourceIdentifier hostGroupId = null, AgentPoolNetworkProfile networkProfile = null) + public static ManagedClusterAgentPoolProfileProperties ManagedClusterAgentPoolProfileProperties(ETag? etag = null, int? count = null, string vmSize = null, int? osDiskSizeInGB = null, ContainerServiceOSDiskType? osDiskType = null, KubeletDiskType? kubeletDiskType = null, WorkloadRuntime? workloadRuntime = null, string messageOfTheDay = null, ResourceIdentifier vnetSubnetId = null, ResourceIdentifier podSubnetId = null, int? maxPods = null, ContainerServiceOSType? osType = null, ContainerServiceOSSku? osSku = null, int? maxCount = null, int? minCount = null, bool? enableAutoScaling = null, ScaleDownMode? scaleDownMode = null, AgentPoolType? agentPoolType = null, AgentPoolMode? mode = null, string orchestratorVersion = null, string currentOrchestratorVersion = null, string nodeImageVersion = null, AgentPoolUpgradeSettings upgradeSettings = null, string provisioningState = null, ContainerServiceStateCode? powerStateCode = null, IEnumerable availabilityZones = null, bool? enableNodePublicIP = null, ResourceIdentifier nodePublicIPPrefixId = null, ScaleSetPriority? scaleSetPriority = null, ScaleSetEvictionPolicy? scaleSetEvictionPolicy = null, float? spotMaxPrice = null, IDictionary tags = null, IDictionary nodeLabels = null, IEnumerable nodeTaints = null, ResourceIdentifier proximityPlacementGroupId = null, KubeletConfig kubeletConfig = null, LinuxOSConfig linuxOSConfig = null, bool? enableEncryptionAtHost = null, bool? enableUltraSsd = null, bool? enableFips = null, GpuInstanceProfile? gpuInstanceProfile = null, ResourceIdentifier creationDataSourceResourceId = null, ResourceIdentifier capacityReservationGroupId = null, ResourceIdentifier hostGroupId = null, AgentPoolNetworkProfile networkProfile = null, bool? disableOutboundNat = null, AgentPoolSecurityProfile securityProfile = null, GpuDriver? gpuDriver = null) { availabilityZones ??= new List(); tags ??= new Dictionary(); @@ -345,12 +349,14 @@ public static ManagedClusterAgentPoolProfileProperties ManagedClusterAgentPoolPr nodeTaints ??= new List(); return new ManagedClusterAgentPoolProfileProperties( + etag, count, vmSize, osDiskSizeInGB, osDiskType, kubeletDiskType, workloadRuntime, + messageOfTheDay, vnetSubnetId, podSubnetId, maxPods, @@ -388,6 +394,9 @@ public static ManagedClusterAgentPoolProfileProperties ManagedClusterAgentPoolPr capacityReservationGroupId, hostGroupId, networkProfile, + disableOutboundNat != null ? new AgentPoolWindowsProfile(disableOutboundNat, serializedAdditionalRawData: null) : null, + securityProfile, + gpuDriver != null ? new GpuProfile(gpuDriver, serializedAdditionalRawData: null) : null, serializedAdditionalRawData: null); } @@ -432,6 +441,46 @@ public static ManagedClusterOidcIssuerProfile ManagedClusterOidcIssuerProfile(st return new ManagedClusterOidcIssuerProfile(issuerUriInfo, isEnabled, serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// Desired managed outbound IPs for the cluster load balancer. + /// Desired outbound IP Prefix resources for the cluster load balancer. + /// Desired outbound IP resources for the cluster load balancer. + /// The effective outbound IP resources of the cluster load balancer. + /// The desired number of allocated SNAT ports per VM. Allowed values are in the range of 0 to 64000 (inclusive). The default value is 0 which results in Azure dynamically allocating ports. + /// Desired outbound flow idle timeout in minutes. Allowed values are in the range of 4 to 120 (inclusive). The default value is 30 minutes. + /// Enable multiple standard load balancers per AKS cluster or not. + /// The type of the managed inbound Load Balancer BackendPool. + /// A new instance for mocking. + public static ManagedClusterLoadBalancerProfile ManagedClusterLoadBalancerProfile(ManagedClusterLoadBalancerProfileManagedOutboundIPs managedOutboundIPs = null, IEnumerable outboundPublicIPPrefixes = null, IEnumerable outboundPublicIPs = null, IEnumerable effectiveOutboundIPs = null, int? allocatedOutboundPorts = null, int? idleTimeoutInMinutes = null, bool? enableMultipleStandardLoadBalancers = null, ManagedClusterLoadBalancerBackendPoolType? backendPoolType = null) + { + outboundPublicIPPrefixes ??= new List(); + outboundPublicIPs ??= new List(); + effectiveOutboundIPs ??= new List(); + + return new ManagedClusterLoadBalancerProfile( + managedOutboundIPs, + outboundPublicIPPrefixes != null ? new ManagedClusterLoadBalancerProfileOutboundIPPrefixes(outboundPublicIPPrefixes?.ToList(), serializedAdditionalRawData: null) : null, + outboundPublicIPs != null ? new ManagedClusterLoadBalancerProfileOutboundIPs(outboundPublicIPs?.ToList(), serializedAdditionalRawData: null) : null, + effectiveOutboundIPs?.ToList(), + allocatedOutboundPorts, + idleTimeoutInMinutes, + enableMultipleStandardLoadBalancers, + backendPoolType, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Profile of the managed outbound IP resources of the cluster NAT gateway. + /// The effective outbound IP resources of the cluster NAT gateway. + /// Desired outbound flow idle timeout in minutes. Allowed values are in the range of 4 to 120 (inclusive). The default value is 4 minutes. + /// A new instance for mocking. + public static ManagedClusterNatGatewayProfile ManagedClusterNatGatewayProfile(int? managedOutboundIPCount = null, IEnumerable effectiveOutboundIPs = null, int? idleTimeoutInMinutes = null) + { + effectiveOutboundIPs ??= new List(); + + return new ManagedClusterNatGatewayProfile(managedOutboundIPCount != null ? new ManagedClusterManagedOutboundIPProfile(managedOutboundIPCount, serializedAdditionalRawData: null) : null, effectiveOutboundIPs?.ToList(), idleTimeoutInMinutes, serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The ID of the private link resource. /// The name of the private link resource. @@ -454,6 +503,18 @@ public static ContainerServicePrivateLinkResourceData ContainerServicePrivateLin serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// Whether to enable the Application Routing add-on. + /// Resource IDs of the DNS zones to be associated with the Application Routing add-on. Used only when Application Routing add-on is enabled. Public and private DNS zones can be in different resource groups, but all public DNS zones must be in the same resource group and all private DNS zones must be in the same resource group. + /// Managed identity of the Application Routing add-on. This is the identity that should be granted permissions, for example, to manage the associated Azure DNS resource and get certificates from Azure Key Vault. See [this overview of the add-on](https://learn.microsoft.com/en-us/azure/aks/web-app-routing?tabs=with-osm) for more instructions. + /// A new instance for mocking. + public static ManagedClusterIngressProfileWebAppRouting ManagedClusterIngressProfileWebAppRouting(bool? enabled = null, IEnumerable dnsZoneResourceIds = null, ContainerServiceUserAssignedIdentity identity = null) + { + dnsZoneResourceIds ??= new List(); + + return new ManagedClusterIngressProfileWebAppRouting(enabled, dnsZoneResourceIds?.ToList(), identity, serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -571,12 +632,14 @@ public static ContainerServiceMaintenanceConfigurationData ContainerServiceMaint /// The name. /// The resourceType. /// The systemData. + /// Unique read-only string used to implement optimistic concurrency. The eTag value will change when the resource is updated. Specify an if-match or if-none-match header with the eTag value for a subsequent request to enable optimistic concurrency per the normal etag convention. /// Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. /// VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. /// OS Disk Size in GB to be used to specify the disk size for every machine in the master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. /// The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see [Ephemeral OS](https://docs.microsoft.com/azure/aks/cluster-configuration#ephemeral-os). /// Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. /// Determines the type of workload a node can run. + /// A base64-encoded string which will be written to /etc/motd after decoding. This allows customization of the message of the day for Linux nodes. It must not be specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be executed as a script). /// If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just nodes. This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. /// If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. /// The maximum number of pods that can run on a node. @@ -614,8 +677,11 @@ public static ContainerServiceMaintenanceConfigurationData ContainerServiceMaint /// AKS will associate the specified agent pool with the Capacity Reservation Group. /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. For more information see [Azure dedicated hosts](https://docs.microsoft.com/azure/virtual-machines/dedicated-hosts). /// Network-related settings of an agent pool. + /// The Windows agent pool's specific profile. + /// The security settings of an agent pool. + /// GPU settings for the Agent Pool. /// A new instance for mocking. - public static ContainerServiceAgentPoolData ContainerServiceAgentPoolData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, int? count = null, string vmSize = null, int? osDiskSizeInGB = null, ContainerServiceOSDiskType? osDiskType = null, KubeletDiskType? kubeletDiskType = null, WorkloadRuntime? workloadRuntime = null, ResourceIdentifier vnetSubnetId = null, ResourceIdentifier podSubnetId = null, int? maxPods = null, ContainerServiceOSType? osType = null, ContainerServiceOSSku? osSku = null, int? maxCount = null, int? minCount = null, bool? enableAutoScaling = null, ScaleDownMode? scaleDownMode = null, AgentPoolType? typePropertiesType = null, AgentPoolMode? mode = null, string orchestratorVersion = null, string currentOrchestratorVersion = null, string nodeImageVersion = null, AgentPoolUpgradeSettings upgradeSettings = null, string provisioningState = null, ContainerServiceStateCode? powerStateCode = null, IEnumerable availabilityZones = null, bool? enableNodePublicIP = null, ResourceIdentifier nodePublicIPPrefixId = null, ScaleSetPriority? scaleSetPriority = null, ScaleSetEvictionPolicy? scaleSetEvictionPolicy = null, float? spotMaxPrice = null, IDictionary tags = null, IDictionary nodeLabels = null, IEnumerable nodeTaints = null, ResourceIdentifier proximityPlacementGroupId = null, KubeletConfig kubeletConfig = null, LinuxOSConfig linuxOSConfig = null, bool? enableEncryptionAtHost = null, bool? enableUltraSsd = null, bool? enableFips = null, GpuInstanceProfile? gpuInstanceProfile = null, ResourceIdentifier creationDataSourceResourceId = null, ResourceIdentifier capacityReservationGroupId = null, ResourceIdentifier hostGroupId = null, AgentPoolNetworkProfile networkProfile = null) + public static ContainerServiceAgentPoolData ContainerServiceAgentPoolData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ETag? etag = null, int? count = null, string vmSize = null, int? osDiskSizeInGB = null, ContainerServiceOSDiskType? osDiskType = null, KubeletDiskType? kubeletDiskType = null, WorkloadRuntime? workloadRuntime = null, string messageOfTheDay = null, ResourceIdentifier vnetSubnetId = null, ResourceIdentifier podSubnetId = null, int? maxPods = null, ContainerServiceOSType? osType = null, ContainerServiceOSSku? osSku = null, int? maxCount = null, int? minCount = null, bool? enableAutoScaling = null, ScaleDownMode? scaleDownMode = null, AgentPoolType? typePropertiesType = null, AgentPoolMode? mode = null, string orchestratorVersion = null, string currentOrchestratorVersion = null, string nodeImageVersion = null, AgentPoolUpgradeSettings upgradeSettings = null, string provisioningState = null, ContainerServiceStateCode? powerStateCode = null, IEnumerable availabilityZones = null, bool? enableNodePublicIP = null, ResourceIdentifier nodePublicIPPrefixId = null, ScaleSetPriority? scaleSetPriority = null, ScaleSetEvictionPolicy? scaleSetEvictionPolicy = null, float? spotMaxPrice = null, IDictionary tags = null, IDictionary nodeLabels = null, IEnumerable nodeTaints = null, ResourceIdentifier proximityPlacementGroupId = null, KubeletConfig kubeletConfig = null, LinuxOSConfig linuxOSConfig = null, bool? enableEncryptionAtHost = null, bool? enableUltraSsd = null, bool? enableFips = null, GpuInstanceProfile? gpuInstanceProfile = null, ResourceIdentifier creationDataSourceResourceId = null, ResourceIdentifier capacityReservationGroupId = null, ResourceIdentifier hostGroupId = null, AgentPoolNetworkProfile networkProfile = null, bool? disableOutboundNat = null, AgentPoolSecurityProfile securityProfile = null, GpuDriver? gpuDriver = null) { availabilityZones ??= new List(); tags ??= new Dictionary(); @@ -627,12 +693,14 @@ public static ContainerServiceAgentPoolData ContainerServiceAgentPoolData(Resour name, resourceType, systemData, + etag, count, vmSize, osDiskSizeInGB, osDiskType, kubeletDiskType, workloadRuntime, + messageOfTheDay, vnetSubnetId, podSubnetId, maxPods, @@ -670,6 +738,9 @@ public static ContainerServiceAgentPoolData ContainerServiceAgentPoolData(Resour capacityReservationGroupId, hostGroupId, networkProfile, + disableOutboundNat != null ? new AgentPoolWindowsProfile(disableOutboundNat, serializedAdditionalRawData: null) : null, + securityProfile, + gpuDriver != null ? new GpuProfile(gpuDriver, serializedAdditionalRawData: null) : null, serializedAdditionalRawData: null); } @@ -960,5 +1031,269 @@ public static ContainerServiceTrustedAccessRoleRule ContainerServiceTrustedAcces nonResourceUrls?.ToList(), serializedAdditionalRawData: null); } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The properties of the machine. + /// A new instance for mocking. + public static MachineData MachineData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, MachineProperties properties = null) + { + return new MachineData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// network properties of the machine. + /// Azure resource id of the machine. It can be used to GET underlying VM Instance. + /// A new instance for mocking. + public static MachineProperties MachineProperties(IEnumerable networkIPAddresses = null, ResourceIdentifier resourceId = null) + { + networkIPAddresses ??= new List(); + + return new MachineProperties(networkIPAddresses != null ? new MachineNetworkProperties(networkIPAddresses?.ToList(), serializedAdditionalRawData: null) : null, resourceId, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// To determine if address belongs IPv4 or IPv6 family. + /// IPv4 or IPv6 address of the machine. + /// A new instance for mocking. + public static MachineIPAddress MachineIPAddress(IPFamily? family = null, string ip = null) + { + return new MachineIPAddress(family, ip, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// major.minor version of Kubernetes release. + /// Capabilities on this Kubernetes version. + /// Whether this version is in preview mode. + /// Patch versions of Kubernetes release. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static KubernetesVersion KubernetesVersion(string version, IEnumerable capabilitiesSupportPlan, bool? isPreview, IReadOnlyDictionary patchVersions) + { + return KubernetesVersion(version: version, capabilitiesSupportPlan: capabilitiesSupportPlan, isDefault: default, isPreview: isPreview, patchVersions: patchVersions); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The managed cluster SKU. + /// The extended location of the Virtual Machine. + /// The identity of the managed cluster, if configured. + /// The current provisioning state. + /// The Power State of the cluster. + /// The max number of agent pools for the managed cluster. + /// Both patch version <major.minor.patch> (e.g. 1.20.13) and <major.minor> (e.g. 1.20) are supported. When <major.minor> is specified, the latest supported GA patch version is chosen automatically. Updating the cluster with the same <major.minor> once it has been created (e.g. 1.14.x -> 1.14) will not trigger an upgrade, even if a newer patch version is available. When you upgrade a supported AKS cluster, Kubernetes minor versions cannot be skipped. All upgrades must be performed sequentially by major version number. For example, upgrades between 1.14.x -> 1.15.x or 1.15.x -> 1.16.x are allowed, however 1.14.x -> 1.16.x is not allowed. See [upgrading an AKS cluster](https://docs.microsoft.com/azure/aks/upgrade-cluster) for more details. + /// If kubernetesVersion was a fully specified version <major.minor.patch>, this field will be exactly equal to it. If kubernetesVersion was <major.minor>, this field will contain the full <major.minor.patch> version being used. + /// This cannot be updated once the Managed Cluster has been created. + /// This cannot be updated once the Managed Cluster has been created. + /// The FQDN of the master pool. + /// The FQDN of private cluster. + /// The Azure Portal requires certain Cross-Origin Resource Sharing (CORS) headers to be sent in some responses, which Kubernetes APIServer doesn't handle by default. This special FQDN supports CORS, allowing the Azure Portal to function properly. + /// The agent pool properties. + /// The profile for Linux VMs in the Managed Cluster. + /// The profile for Windows VMs in the Managed Cluster. + /// Information about a service principal identity for the cluster to use for manipulating Azure APIs. + /// The profile of managed cluster add-on. + /// See [use AAD pod identity](https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity) for more details on AAD pod identity integration. + /// The OIDC issuer profile of the Managed Cluster. + /// The name of the resource group containing agent pool nodes. + /// Whether to enable Kubernetes Role-Based Access Control. + /// The support plan for the Managed Cluster. If unspecified, the default is 'KubernetesOfficial'. + /// (DEPRECATED) Whether to enable Kubernetes pod security policy (preview). PodSecurityPolicy was deprecated in Kubernetes v1.21, and removed from Kubernetes in v1.25. Learn more at https://aka.ms/k8s/psp and https://aka.ms/aks/psp. + /// The network configuration profile. + /// The Azure Active Directory configuration. + /// The auto upgrade configuration. + /// Settings for upgrading a cluster. + /// Parameters to be applied to the cluster-autoscaler when enabled. + /// The access profile for managed cluster API server. + /// This is of the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{encryptionSetName}'. + /// Identities associated with the cluster. + /// Private link resources associated with the cluster. + /// If set to true, getting static credentials will be disabled for this cluster. This must only be used on Managed Clusters that are AAD enabled. For more details see [disable local accounts](https://docs.microsoft.com/azure/aks/managed-aad#disable-local-accounts-preview). + /// Configurations for provisioning the cluster with HTTP proxy servers. + /// Security profile for the managed cluster. + /// Storage profile for the managed cluster. + /// Allow or deny public network access for AKS. + /// Workload Auto-scaler profile for the managed cluster. + /// Azure Monitor addon profiles for monitoring the managed cluster. + /// Service mesh profile for a managed cluster. + /// The resourceUID uniquely identifies ManagedClusters that reuse ARM ResourceIds (i.e: create, delete, create sequence). + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static ContainerServiceManagedClusterData ContainerServiceManagedClusterData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedClusterSku sku, ExtendedLocation extendedLocation, ManagedClusterIdentity clusterIdentity, string provisioningState, ContainerServiceStateCode? powerStateCode, int? maxAgentPools, string kubernetesVersion, string currentKubernetesVersion, string dnsPrefix, string fqdnSubdomain, string fqdn, string privateFqdn, string azurePortalFqdn, IEnumerable agentPoolProfiles, ContainerServiceLinuxProfile linuxProfile, ManagedClusterWindowsProfile windowsProfile, ManagedClusterServicePrincipalProfile servicePrincipalProfile, IDictionary addonProfiles, ManagedClusterPodIdentityProfile podIdentityProfile, ManagedClusterOidcIssuerProfile oidcIssuerProfile, string nodeResourceGroup, bool? enableRbac, KubernetesSupportPlan? supportPlan, bool? enablePodSecurityPolicy, ContainerServiceNetworkProfile networkProfile, ManagedClusterAadProfile aadProfile, ManagedClusterAutoUpgradeProfile autoUpgradeProfile, UpgradeOverrideSettings upgradeOverrideSettings, ManagedClusterAutoScalerProfile autoScalerProfile, ManagedClusterApiServerAccessProfile apiServerAccessProfile, ResourceIdentifier diskEncryptionSetId, IDictionary identityProfile, IEnumerable privateLinkResources, bool? disableLocalAccounts, ManagedClusterHttpProxyConfig httpProxyConfig, ManagedClusterSecurityProfile securityProfile, ManagedClusterStorageProfile storageProfile, ContainerServicePublicNetworkAccess? publicNetworkAccess, ManagedClusterWorkloadAutoScalerProfile workloadAutoScalerProfile, ManagedClusterMonitorProfileMetrics azureMonitorMetrics, ServiceMeshProfile serviceMeshProfile, ResourceIdentifier resourceId) + { + return ContainerServiceManagedClusterData(id: id, name: name, resourceType: resourceType, systemData: systemData, tags: tags, location: location, etag: default, sku: sku, extendedLocation: extendedLocation, clusterIdentity: clusterIdentity, provisioningState: provisioningState, powerStateCode: powerStateCode, maxAgentPools: maxAgentPools, kubernetesVersion: kubernetesVersion, currentKubernetesVersion: currentKubernetesVersion, dnsPrefix: dnsPrefix, fqdnSubdomain: fqdnSubdomain, fqdn: fqdn, privateFqdn: privateFqdn, azurePortalFqdn: azurePortalFqdn, agentPoolProfiles: agentPoolProfiles, linuxProfile: linuxProfile, windowsProfile: windowsProfile, servicePrincipalProfile: servicePrincipalProfile, addonProfiles: addonProfiles, podIdentityProfile: podIdentityProfile, oidcIssuerProfile: oidcIssuerProfile, nodeResourceGroup: nodeResourceGroup, nodeResourceGroupRestrictionLevel: default, enableRbac: enableRbac, supportPlan: supportPlan, enablePodSecurityPolicy: enablePodSecurityPolicy, networkProfile: networkProfile, aadProfile: aadProfile, autoUpgradeProfile: autoUpgradeProfile, upgradeOverrideSettings: upgradeOverrideSettings, autoScalerProfile: autoScalerProfile, apiServerAccessProfile: apiServerAccessProfile, diskEncryptionSetId: diskEncryptionSetId, identityProfile: identityProfile, privateLinkResources: privateLinkResources, disableLocalAccounts: disableLocalAccounts, httpProxyConfig: httpProxyConfig, securityProfile: securityProfile, storageProfile: storageProfile, ingressWebAppRouting: default, publicNetworkAccess: publicNetworkAccess, workloadAutoScalerProfile: workloadAutoScalerProfile, azureMonitorMetrics: azureMonitorMetrics, serviceMeshProfile: serviceMeshProfile, resourceId: resourceId, costAnalysisEnabled: default, bootstrapProfile: default); + } + + /// Initializes a new instance of . + /// Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. + /// VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. + /// OS Disk Size in GB to be used to specify the disk size for every machine in the master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. + /// The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see [Ephemeral OS](https://docs.microsoft.com/azure/aks/cluster-configuration#ephemeral-os). + /// Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. + /// Determines the type of workload a node can run. + /// If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just nodes. This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + /// If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + /// The maximum number of pods that can run on a node. + /// The operating system type. The default is Linux. + /// Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType is Linux. The default is Windows2019 when Kubernetes <= 1.24 or Windows2022 when Kubernetes >= 1.25 if OSType is Windows. + /// The maximum number of nodes for auto-scaling. + /// The minimum number of nodes for auto-scaling. + /// Whether to enable auto-scaler. + /// This also effects the cluster autoscaler behavior. If not specified, it defaults to Delete. + /// The type of Agent Pool. + /// A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools. + /// Both patch version <major.minor.patch> (e.g. 1.20.13) and <major.minor> (e.g. 1.20) are supported. When <major.minor> is specified, the latest supported GA patch version is chosen automatically. Updating the cluster with the same <major.minor> once it has been created (e.g. 1.14.x -> 1.14) will not trigger an upgrade, even if a newer patch version is available. As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version as the control plane. The node pool minor version must be within two minor versions of the control plane version. The node pool version cannot be greater than the control plane version. For more information see [upgrading a node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool). + /// If orchestratorVersion is a fully specified version <major.minor.patch>, this field will be exactly equal to it. If orchestratorVersion is <major.minor>, this field will contain the full <major.minor.patch> version being used. + /// The version of node image. + /// Settings for upgrading the agentpool. + /// The current deployment or provisioning state. + /// When an Agent Pool is first created it is initially Running. The Agent Pool can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs and does not accrue billing charges. An Agent Pool can only be stopped if it is Running and provisioning state is Succeeded. + /// The list of Availability zones to use for nodes. This can only be specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + /// Some scenarios may require nodes in a node pool to receive their own dedicated public IP addresses. A common scenario is for gaming workloads, where a console needs to make a direct connection to a cloud virtual machine to minimize hops. For more information see [assigning a public IP per node](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#assign-a-public-ip-per-node-for-your-node-pools). The default is false. + /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. + /// The Virtual Machine Scale Set priority. If not specified, the default is 'Regular'. + /// This cannot be specified unless the scaleSetPriority is 'Spot'. If not specified, the default is 'Delete'. + /// Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see [spot VMs pricing](https://docs.microsoft.com/azure/virtual-machines/spot-vms#pricing). + /// The tags to be persisted on the agent pool virtual machine scale set. + /// The node labels to be persisted across all nodes in agent pool. + /// The taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. + /// The ID for Proximity Placement Group. + /// The Kubelet configuration on the agent pool nodes. + /// The OS configuration of Linux agent nodes. + /// This is only supported on certain VM sizes and in certain Azure regions. For more information, see: https://docs.microsoft.com/azure/aks/enable-host-encryption. + /// Whether to enable UltraSSD. + /// See [Add a FIPS-enabled node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#add-a-fips-enabled-node-pool-preview) for more details. + /// GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. + /// CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. + /// AKS will associate the specified agent pool with the Capacity Reservation Group. + /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. For more information see [Azure dedicated hosts](https://docs.microsoft.com/azure/virtual-machines/dedicated-hosts). + /// Network-related settings of an agent pool. + /// Windows agent pool names must be 6 characters or less. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static ManagedClusterAgentPoolProfile ManagedClusterAgentPoolProfile(int? count, string vmSize, int? osDiskSizeInGB, ContainerServiceOSDiskType? osDiskType, KubeletDiskType? kubeletDiskType, WorkloadRuntime? workloadRuntime, ResourceIdentifier vnetSubnetId, ResourceIdentifier podSubnetId, int? maxPods, ContainerServiceOSType? osType, ContainerServiceOSSku? osSku, int? maxCount, int? minCount, bool? enableAutoScaling, ScaleDownMode? scaleDownMode, AgentPoolType? agentPoolType, AgentPoolMode? mode, string orchestratorVersion, string currentOrchestratorVersion, string nodeImageVersion, AgentPoolUpgradeSettings upgradeSettings, string provisioningState, ContainerServiceStateCode? powerStateCode, IEnumerable availabilityZones, bool? enableNodePublicIP, ResourceIdentifier nodePublicIPPrefixId, ScaleSetPriority? scaleSetPriority, ScaleSetEvictionPolicy? scaleSetEvictionPolicy, float? spotMaxPrice, IDictionary tags, IDictionary nodeLabels, IEnumerable nodeTaints, ResourceIdentifier proximityPlacementGroupId, KubeletConfig kubeletConfig, LinuxOSConfig linuxOSConfig, bool? enableEncryptionAtHost, bool? enableUltraSsd, bool? enableFips, GpuInstanceProfile? gpuInstanceProfile, ResourceIdentifier creationDataSourceResourceId, ResourceIdentifier capacityReservationGroupId, ResourceIdentifier hostGroupId, AgentPoolNetworkProfile networkProfile, string name) + { + return ManagedClusterAgentPoolProfile(etag: default, count: count, vmSize: vmSize, osDiskSizeInGB: osDiskSizeInGB, osDiskType: osDiskType, kubeletDiskType: kubeletDiskType, workloadRuntime: workloadRuntime, messageOfTheDay: default, vnetSubnetId: vnetSubnetId, podSubnetId: podSubnetId, maxPods: maxPods, osType: osType, osSku: osSku, maxCount: maxCount, minCount: minCount, enableAutoScaling: enableAutoScaling, scaleDownMode: scaleDownMode, agentPoolType: agentPoolType, mode: mode, orchestratorVersion: orchestratorVersion, currentOrchestratorVersion: currentOrchestratorVersion, nodeImageVersion: nodeImageVersion, upgradeSettings: upgradeSettings, provisioningState: provisioningState, powerStateCode: powerStateCode, availabilityZones: availabilityZones, enableNodePublicIP: enableNodePublicIP, nodePublicIPPrefixId: nodePublicIPPrefixId, scaleSetPriority: scaleSetPriority, scaleSetEvictionPolicy: scaleSetEvictionPolicy, spotMaxPrice: spotMaxPrice, tags: tags, nodeLabels: nodeLabels, nodeTaints: nodeTaints, proximityPlacementGroupId: proximityPlacementGroupId, kubeletConfig: kubeletConfig, linuxOSConfig: linuxOSConfig, enableEncryptionAtHost: enableEncryptionAtHost, enableUltraSsd: enableUltraSsd, enableFips: enableFips, gpuInstanceProfile: gpuInstanceProfile, creationDataSourceResourceId: creationDataSourceResourceId, capacityReservationGroupId: capacityReservationGroupId, hostGroupId: hostGroupId, networkProfile: networkProfile, disableOutboundNat: default, securityProfile: default, gpuDriver: default, name: name); + } + + /// Initializes a new instance of . + /// Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. + /// VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. + /// OS Disk Size in GB to be used to specify the disk size for every machine in the master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. + /// The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see [Ephemeral OS](https://docs.microsoft.com/azure/aks/cluster-configuration#ephemeral-os). + /// Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. + /// Determines the type of workload a node can run. + /// If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just nodes. This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + /// If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + /// The maximum number of pods that can run on a node. + /// The operating system type. The default is Linux. + /// Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType is Linux. The default is Windows2019 when Kubernetes <= 1.24 or Windows2022 when Kubernetes >= 1.25 if OSType is Windows. + /// The maximum number of nodes for auto-scaling. + /// The minimum number of nodes for auto-scaling. + /// Whether to enable auto-scaler. + /// This also effects the cluster autoscaler behavior. If not specified, it defaults to Delete. + /// The type of Agent Pool. + /// A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools. + /// Both patch version <major.minor.patch> (e.g. 1.20.13) and <major.minor> (e.g. 1.20) are supported. When <major.minor> is specified, the latest supported GA patch version is chosen automatically. Updating the cluster with the same <major.minor> once it has been created (e.g. 1.14.x -> 1.14) will not trigger an upgrade, even if a newer patch version is available. As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version as the control plane. The node pool minor version must be within two minor versions of the control plane version. The node pool version cannot be greater than the control plane version. For more information see [upgrading a node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool). + /// If orchestratorVersion is a fully specified version <major.minor.patch>, this field will be exactly equal to it. If orchestratorVersion is <major.minor>, this field will contain the full <major.minor.patch> version being used. + /// The version of node image. + /// Settings for upgrading the agentpool. + /// The current deployment or provisioning state. + /// When an Agent Pool is first created it is initially Running. The Agent Pool can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs and does not accrue billing charges. An Agent Pool can only be stopped if it is Running and provisioning state is Succeeded. + /// The list of Availability zones to use for nodes. This can only be specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + /// Some scenarios may require nodes in a node pool to receive their own dedicated public IP addresses. A common scenario is for gaming workloads, where a console needs to make a direct connection to a cloud virtual machine to minimize hops. For more information see [assigning a public IP per node](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#assign-a-public-ip-per-node-for-your-node-pools). The default is false. + /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. + /// The Virtual Machine Scale Set priority. If not specified, the default is 'Regular'. + /// This cannot be specified unless the scaleSetPriority is 'Spot'. If not specified, the default is 'Delete'. + /// Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see [spot VMs pricing](https://docs.microsoft.com/azure/virtual-machines/spot-vms#pricing). + /// The tags to be persisted on the agent pool virtual machine scale set. + /// The node labels to be persisted across all nodes in agent pool. + /// The taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. + /// The ID for Proximity Placement Group. + /// The Kubelet configuration on the agent pool nodes. + /// The OS configuration of Linux agent nodes. + /// This is only supported on certain VM sizes and in certain Azure regions. For more information, see: https://docs.microsoft.com/azure/aks/enable-host-encryption. + /// Whether to enable UltraSSD. + /// See [Add a FIPS-enabled node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#add-a-fips-enabled-node-pool-preview) for more details. + /// GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. + /// CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. + /// AKS will associate the specified agent pool with the Capacity Reservation Group. + /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. For more information see [Azure dedicated hosts](https://docs.microsoft.com/azure/virtual-machines/dedicated-hosts). + /// Network-related settings of an agent pool. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static ManagedClusterAgentPoolProfileProperties ManagedClusterAgentPoolProfileProperties(int? count, string vmSize, int? osDiskSizeInGB, ContainerServiceOSDiskType? osDiskType, KubeletDiskType? kubeletDiskType, WorkloadRuntime? workloadRuntime, ResourceIdentifier vnetSubnetId, ResourceIdentifier podSubnetId, int? maxPods, ContainerServiceOSType? osType, ContainerServiceOSSku? osSku, int? maxCount, int? minCount, bool? enableAutoScaling, ScaleDownMode? scaleDownMode, AgentPoolType? agentPoolType, AgentPoolMode? mode, string orchestratorVersion, string currentOrchestratorVersion, string nodeImageVersion, AgentPoolUpgradeSettings upgradeSettings, string provisioningState, ContainerServiceStateCode? powerStateCode, IEnumerable availabilityZones, bool? enableNodePublicIP, ResourceIdentifier nodePublicIPPrefixId, ScaleSetPriority? scaleSetPriority, ScaleSetEvictionPolicy? scaleSetEvictionPolicy, float? spotMaxPrice, IDictionary tags, IDictionary nodeLabels, IEnumerable nodeTaints, ResourceIdentifier proximityPlacementGroupId, KubeletConfig kubeletConfig, LinuxOSConfig linuxOSConfig, bool? enableEncryptionAtHost, bool? enableUltraSsd, bool? enableFips, GpuInstanceProfile? gpuInstanceProfile, ResourceIdentifier creationDataSourceResourceId, ResourceIdentifier capacityReservationGroupId, ResourceIdentifier hostGroupId, AgentPoolNetworkProfile networkProfile) + { + return ManagedClusterAgentPoolProfileProperties(etag: default, count: count, vmSize: vmSize, osDiskSizeInGB: osDiskSizeInGB, osDiskType: osDiskType, kubeletDiskType: kubeletDiskType, workloadRuntime: workloadRuntime, messageOfTheDay: default, vnetSubnetId: vnetSubnetId, podSubnetId: podSubnetId, maxPods: maxPods, osType: osType, osSku: osSku, maxCount: maxCount, minCount: minCount, enableAutoScaling: enableAutoScaling, scaleDownMode: scaleDownMode, agentPoolType: agentPoolType, mode: mode, orchestratorVersion: orchestratorVersion, currentOrchestratorVersion: currentOrchestratorVersion, nodeImageVersion: nodeImageVersion, upgradeSettings: upgradeSettings, provisioningState: provisioningState, powerStateCode: powerStateCode, availabilityZones: availabilityZones, enableNodePublicIP: enableNodePublicIP, nodePublicIPPrefixId: nodePublicIPPrefixId, scaleSetPriority: scaleSetPriority, scaleSetEvictionPolicy: scaleSetEvictionPolicy, spotMaxPrice: spotMaxPrice, tags: tags, nodeLabels: nodeLabels, nodeTaints: nodeTaints, proximityPlacementGroupId: proximityPlacementGroupId, kubeletConfig: kubeletConfig, linuxOSConfig: linuxOSConfig, enableEncryptionAtHost: enableEncryptionAtHost, enableUltraSsd: enableUltraSsd, enableFips: enableFips, gpuInstanceProfile: gpuInstanceProfile, creationDataSourceResourceId: creationDataSourceResourceId, capacityReservationGroupId: capacityReservationGroupId, hostGroupId: hostGroupId, networkProfile: networkProfile, disableOutboundNat: default, securityProfile: default, gpuDriver: default); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. + /// VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. + /// OS Disk Size in GB to be used to specify the disk size for every machine in the master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. + /// The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see [Ephemeral OS](https://docs.microsoft.com/azure/aks/cluster-configuration#ephemeral-os). + /// Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. + /// Determines the type of workload a node can run. + /// If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just nodes. This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + /// If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + /// The maximum number of pods that can run on a node. + /// The operating system type. The default is Linux. + /// Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType is Linux. The default is Windows2019 when Kubernetes <= 1.24 or Windows2022 when Kubernetes >= 1.25 if OSType is Windows. + /// The maximum number of nodes for auto-scaling. + /// The minimum number of nodes for auto-scaling. + /// Whether to enable auto-scaler. + /// This also effects the cluster autoscaler behavior. If not specified, it defaults to Delete. + /// The type of Agent Pool. + /// A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools. + /// Both patch version <major.minor.patch> (e.g. 1.20.13) and <major.minor> (e.g. 1.20) are supported. When <major.minor> is specified, the latest supported GA patch version is chosen automatically. Updating the cluster with the same <major.minor> once it has been created (e.g. 1.14.x -> 1.14) will not trigger an upgrade, even if a newer patch version is available. As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version as the control plane. The node pool minor version must be within two minor versions of the control plane version. The node pool version cannot be greater than the control plane version. For more information see [upgrading a node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool). + /// If orchestratorVersion is a fully specified version <major.minor.patch>, this field will be exactly equal to it. If orchestratorVersion is <major.minor>, this field will contain the full <major.minor.patch> version being used. + /// The version of node image. + /// Settings for upgrading the agentpool. + /// The current deployment or provisioning state. + /// When an Agent Pool is first created it is initially Running. The Agent Pool can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs and does not accrue billing charges. An Agent Pool can only be stopped if it is Running and provisioning state is Succeeded. + /// The list of Availability zones to use for nodes. This can only be specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + /// Some scenarios may require nodes in a node pool to receive their own dedicated public IP addresses. A common scenario is for gaming workloads, where a console needs to make a direct connection to a cloud virtual machine to minimize hops. For more information see [assigning a public IP per node](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#assign-a-public-ip-per-node-for-your-node-pools). The default is false. + /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. + /// The Virtual Machine Scale Set priority. If not specified, the default is 'Regular'. + /// This cannot be specified unless the scaleSetPriority is 'Spot'. If not specified, the default is 'Delete'. + /// Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see [spot VMs pricing](https://docs.microsoft.com/azure/virtual-machines/spot-vms#pricing). + /// The tags to be persisted on the agent pool virtual machine scale set. + /// The node labels to be persisted across all nodes in agent pool. + /// The taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. + /// The ID for Proximity Placement Group. + /// The Kubelet configuration on the agent pool nodes. + /// The OS configuration of Linux agent nodes. + /// This is only supported on certain VM sizes and in certain Azure regions. For more information, see: https://docs.microsoft.com/azure/aks/enable-host-encryption. + /// Whether to enable UltraSSD. + /// See [Add a FIPS-enabled node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#add-a-fips-enabled-node-pool-preview) for more details. + /// GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. + /// CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. + /// AKS will associate the specified agent pool with the Capacity Reservation Group. + /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. For more information see [Azure dedicated hosts](https://docs.microsoft.com/azure/virtual-machines/dedicated-hosts). + /// Network-related settings of an agent pool. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static ContainerServiceAgentPoolData ContainerServiceAgentPoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, int? count, string vmSize, int? osDiskSizeInGB, ContainerServiceOSDiskType? osDiskType, KubeletDiskType? kubeletDiskType, WorkloadRuntime? workloadRuntime, ResourceIdentifier vnetSubnetId, ResourceIdentifier podSubnetId, int? maxPods, ContainerServiceOSType? osType, ContainerServiceOSSku? osSku, int? maxCount, int? minCount, bool? enableAutoScaling, ScaleDownMode? scaleDownMode, AgentPoolType? typePropertiesType, AgentPoolMode? mode, string orchestratorVersion, string currentOrchestratorVersion, string nodeImageVersion, AgentPoolUpgradeSettings upgradeSettings, string provisioningState, ContainerServiceStateCode? powerStateCode, IEnumerable availabilityZones, bool? enableNodePublicIP, ResourceIdentifier nodePublicIPPrefixId, ScaleSetPriority? scaleSetPriority, ScaleSetEvictionPolicy? scaleSetEvictionPolicy, float? spotMaxPrice, IDictionary tags, IDictionary nodeLabels, IEnumerable nodeTaints, ResourceIdentifier proximityPlacementGroupId, KubeletConfig kubeletConfig, LinuxOSConfig linuxOSConfig, bool? enableEncryptionAtHost, bool? enableUltraSsd, bool? enableFips, GpuInstanceProfile? gpuInstanceProfile, ResourceIdentifier creationDataSourceResourceId, ResourceIdentifier capacityReservationGroupId, ResourceIdentifier hostGroupId, AgentPoolNetworkProfile networkProfile) + { + return ContainerServiceAgentPoolData(id: id, name: name, resourceType: resourceType, systemData: systemData, etag: default, count: count, vmSize: vmSize, osDiskSizeInGB: osDiskSizeInGB, osDiskType: osDiskType, kubeletDiskType: kubeletDiskType, workloadRuntime: workloadRuntime, messageOfTheDay: default, vnetSubnetId: vnetSubnetId, podSubnetId: podSubnetId, maxPods: maxPods, osType: osType, osSku: osSku, maxCount: maxCount, minCount: minCount, enableAutoScaling: enableAutoScaling, scaleDownMode: scaleDownMode, typePropertiesType: typePropertiesType, mode: mode, orchestratorVersion: orchestratorVersion, currentOrchestratorVersion: currentOrchestratorVersion, nodeImageVersion: nodeImageVersion, upgradeSettings: upgradeSettings, provisioningState: provisioningState, powerStateCode: powerStateCode, availabilityZones: availabilityZones, enableNodePublicIP: enableNodePublicIP, nodePublicIPPrefixId: nodePublicIPPrefixId, scaleSetPriority: scaleSetPriority, scaleSetEvictionPolicy: scaleSetEvictionPolicy, spotMaxPrice: spotMaxPrice, tags: tags, nodeLabels: nodeLabels, nodeTaints: nodeTaints, proximityPlacementGroupId: proximityPlacementGroupId, kubeletConfig: kubeletConfig, linuxOSConfig: linuxOSConfig, enableEncryptionAtHost: enableEncryptionAtHost, enableUltraSsd: enableUltraSsd, enableFips: enableFips, gpuInstanceProfile: gpuInstanceProfile, creationDataSourceResourceId: creationDataSourceResourceId, capacityReservationGroupId: capacityReservationGroupId, hostGroupId: hostGroupId, networkProfile: networkProfile, disableOutboundNat: default, securityProfile: default, gpuDriver: default); + } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolCollection.cs index 88b66a8d18dd..42eddbd28d75 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -75,10 +75,12 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The name of the agent pool. /// The agent pool to create or update. + /// The request should only proceed if an entity matches this string. + /// The request should only proceed if no entity matches this string. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string agentPoolName, ContainerServiceAgentPoolData data, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string agentPoolName, ContainerServiceAgentPoolData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); Argument.AssertNotNull(data, nameof(data)); @@ -87,8 +89,8 @@ public virtual async Task> Creat scope.Start(); try { - var response = await _containerServiceAgentPoolAgentPoolsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, agentPoolName, data, cancellationToken).ConfigureAwait(false); - var operation = new ContainerServiceArmOperation(new ContainerServiceAgentPoolOperationSource(Client), _containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, _containerServiceAgentPoolAgentPoolsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, agentPoolName, data).Request, response, OperationFinalStateVia.Location); + var response = await _containerServiceAgentPoolAgentPoolsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, agentPoolName, data, ifMatch, ifNoneMatch, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(new ContainerServiceAgentPoolOperationSource(Client), _containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, _containerServiceAgentPoolAgentPoolsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, agentPoolName, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -113,7 +115,7 @@ public virtual async Task> Creat /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -124,10 +126,12 @@ public virtual async Task> Creat /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The name of the agent pool. /// The agent pool to create or update. + /// The request should only proceed if an entity matches this string. + /// The request should only proceed if no entity matches this string. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string agentPoolName, ContainerServiceAgentPoolData data, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string agentPoolName, ContainerServiceAgentPoolData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); Argument.AssertNotNull(data, nameof(data)); @@ -136,8 +140,8 @@ public virtual ArmOperation CreateOrUpdate(Wa scope.Start(); try { - var response = _containerServiceAgentPoolAgentPoolsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, agentPoolName, data, cancellationToken); - var operation = new ContainerServiceArmOperation(new ContainerServiceAgentPoolOperationSource(Client), _containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, _containerServiceAgentPoolAgentPoolsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, agentPoolName, data).Request, response, OperationFinalStateVia.Location); + var response = _containerServiceAgentPoolAgentPoolsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, agentPoolName, data, ifMatch, ifNoneMatch, cancellationToken); + var operation = new ContainerServiceArmOperation(new ContainerServiceAgentPoolOperationSource(Client), _containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, _containerServiceAgentPoolAgentPoolsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, agentPoolName, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -162,7 +166,7 @@ public virtual ArmOperation CreateOrUpdate(Wa /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -207,7 +211,7 @@ public virtual async Task> GetAsync( /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -252,7 +256,7 @@ public virtual Response Get(string agentPoolN /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -282,7 +286,7 @@ public virtual AsyncPageable GetAllAsync(Canc /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -312,7 +316,7 @@ public virtual Pageable GetAll(CancellationTo /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -355,7 +359,7 @@ public virtual async Task> ExistsAsync(string agentPoolName, Canc /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -398,7 +402,7 @@ public virtual Response Exists(string agentPoolName, CancellationToken can /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -443,7 +447,7 @@ public virtual async Task> G /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolData.Serialization.cs index 4d2239c713bc..09489697a829 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolData.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolData.Serialization.cs @@ -41,6 +41,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(ETag)) + { + writer.WritePropertyName("eTag"u8); + writer.WriteStringValue(ETag.Value.ToString()); + } if (Optional.IsDefined(Count)) { writer.WritePropertyName("count"u8); @@ -71,6 +76,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("workloadRuntime"u8); writer.WriteStringValue(WorkloadRuntime.Value.ToString()); } + if (Optional.IsDefined(MessageOfTheDay)) + { + writer.WritePropertyName("messageOfTheDay"u8); + writer.WriteStringValue(MessageOfTheDay); + } if (Optional.IsDefined(VnetSubnetId)) { writer.WritePropertyName("vnetSubnetID"u8); @@ -278,6 +288,21 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("networkProfile"u8); writer.WriteObjectValue(NetworkProfile, options); } + if (Optional.IsDefined(WindowsProfile)) + { + writer.WritePropertyName("windowsProfile"u8); + writer.WriteObjectValue(WindowsProfile, options); + } + if (Optional.IsDefined(SecurityProfile)) + { + writer.WritePropertyName("securityProfile"u8); + writer.WriteObjectValue(SecurityProfile, options); + } + if (Optional.IsDefined(GpuProfile)) + { + writer.WritePropertyName("gpuProfile"u8); + writer.WriteObjectValue(GpuProfile, options); + } writer.WriteEndObject(); } @@ -305,12 +330,14 @@ internal static ContainerServiceAgentPoolData DeserializeContainerServiceAgentPo string name = default; ResourceType type = default; SystemData systemData = default; + ETag? etag = default; int? count = default; string vmSize = default; int? osDiskSizeGB = default; ContainerServiceOSDiskType? osDiskType = default; KubeletDiskType? kubeletDiskType = default; WorkloadRuntime? workloadRuntime = default; + string messageOfTheDay = default; ResourceIdentifier vnetSubnetId = default; ResourceIdentifier podSubnetId = default; int? maxPods = default; @@ -348,6 +375,9 @@ internal static ContainerServiceAgentPoolData DeserializeContainerServiceAgentPo ResourceIdentifier capacityReservationGroupId = default; ResourceIdentifier hostGroupId = default; AgentPoolNetworkProfile networkProfile = default; + AgentPoolWindowsProfile windowsProfile = default; + AgentPoolSecurityProfile securityProfile = default; + GpuProfile gpuProfile = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -385,6 +415,15 @@ internal static ContainerServiceAgentPoolData DeserializeContainerServiceAgentPo } foreach (var property0 in property.Value.EnumerateObject()) { + if (property0.NameEquals("eTag"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + etag = new ETag(property0.Value.GetString()); + continue; + } if (property0.NameEquals("count"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -435,6 +474,11 @@ internal static ContainerServiceAgentPoolData DeserializeContainerServiceAgentPo workloadRuntime = new WorkloadRuntime(property0.Value.GetString()); continue; } + if (property0.NameEquals("messageOfTheDay"u8)) + { + messageOfTheDay = property0.Value.GetString(); + continue; + } if (property0.NameEquals("vnetSubnetID"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -772,6 +816,33 @@ internal static ContainerServiceAgentPoolData DeserializeContainerServiceAgentPo networkProfile = AgentPoolNetworkProfile.DeserializeAgentPoolNetworkProfile(property0.Value, options); continue; } + if (property0.NameEquals("windowsProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + windowsProfile = AgentPoolWindowsProfile.DeserializeAgentPoolWindowsProfile(property0.Value, options); + continue; + } + if (property0.NameEquals("securityProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + securityProfile = AgentPoolSecurityProfile.DeserializeAgentPoolSecurityProfile(property0.Value, options); + continue; + } + if (property0.NameEquals("gpuProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + gpuProfile = GpuProfile.DeserializeGpuProfile(property0.Value, options); + continue; + } } continue; } @@ -786,12 +857,14 @@ internal static ContainerServiceAgentPoolData DeserializeContainerServiceAgentPo name, type, systemData, + etag, count, vmSize, osDiskSizeGB, osDiskType, kubeletDiskType, workloadRuntime, + messageOfTheDay, vnetSubnetId, podSubnetId, maxPods, @@ -829,6 +902,9 @@ internal static ContainerServiceAgentPoolData DeserializeContainerServiceAgentPo capacityReservationGroupId, hostGroupId, networkProfile, + windowsProfile, + securityProfile, + gpuProfile, serializedAdditionalRawData); } @@ -898,6 +974,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.Append(" properties:"); builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ETag), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" eTag: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ETag)) + { + builder.Append(" eTag: "); + builder.AppendLine($"'{ETag.Value.ToString()}'"); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Count), out propertyOverride); if (hasPropertyOverride) { @@ -996,6 +1087,29 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MessageOfTheDay), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" messageOfTheDay: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(MessageOfTheDay)) + { + builder.Append(" messageOfTheDay: "); + if (MessageOfTheDay.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{MessageOfTheDay}'''"); + } + else + { + builder.AppendLine($"'{MessageOfTheDay}'"); + } + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VnetSubnetId), out propertyOverride); if (hasPropertyOverride) { @@ -1684,6 +1798,61 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("DisableOutboundNat", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" windowsProfile: "); + builder.AppendLine("{"); + builder.AppendLine(" windowsProfile: {"); + builder.Append(" disableOutboundNat: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(WindowsProfile)) + { + builder.Append(" windowsProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, WindowsProfile, options, 4, false, " windowsProfile: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SecurityProfile), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" securityProfile: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SecurityProfile)) + { + builder.Append(" securityProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, SecurityProfile, options, 4, false, " securityProfile: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("GpuDriver", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" gpuProfile: "); + builder.AppendLine("{"); + builder.AppendLine(" gpuProfile: {"); + builder.Append(" driver: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(GpuProfile)) + { + builder.Append(" gpuProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, GpuProfile, options, 4, false, " gpuProfile: "); + } + } + builder.AppendLine(" }"); builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolData.cs index d21fe3381f1a..109c475f4d9e 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolData.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolData.cs @@ -65,12 +65,14 @@ public ContainerServiceAgentPoolData() /// The name. /// The resourceType. /// The systemData. + /// Unique read-only string used to implement optimistic concurrency. The eTag value will change when the resource is updated. Specify an if-match or if-none-match header with the eTag value for a subsequent request to enable optimistic concurrency per the normal etag convention. /// Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. /// VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. /// OS Disk Size in GB to be used to specify the disk size for every machine in the master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. /// The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see [Ephemeral OS](https://docs.microsoft.com/azure/aks/cluster-configuration#ephemeral-os). /// Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. /// Determines the type of workload a node can run. + /// A base64-encoded string which will be written to /etc/motd after decoding. This allows customization of the message of the day for Linux nodes. It must not be specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be executed as a script). /// If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just nodes. This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. /// If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. /// The maximum number of pods that can run on a node. @@ -108,15 +110,20 @@ public ContainerServiceAgentPoolData() /// AKS will associate the specified agent pool with the Capacity Reservation Group. /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. For more information see [Azure dedicated hosts](https://docs.microsoft.com/azure/virtual-machines/dedicated-hosts). /// Network-related settings of an agent pool. + /// The Windows agent pool's specific profile. + /// The security settings of an agent pool. + /// GPU settings for the Agent Pool. /// Keeps track of any properties unknown to the library. - internal ContainerServiceAgentPoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, int? count, string vmSize, int? osDiskSizeInGB, ContainerServiceOSDiskType? osDiskType, KubeletDiskType? kubeletDiskType, WorkloadRuntime? workloadRuntime, ResourceIdentifier vnetSubnetId, ResourceIdentifier podSubnetId, int? maxPods, ContainerServiceOSType? osType, ContainerServiceOSSku? osSku, int? maxCount, int? minCount, bool? enableAutoScaling, ScaleDownMode? scaleDownMode, AgentPoolType? typePropertiesType, AgentPoolMode? mode, string orchestratorVersion, string currentOrchestratorVersion, string nodeImageVersion, AgentPoolUpgradeSettings upgradeSettings, string provisioningState, ContainerServicePowerState powerState, IList availabilityZones, bool? enableNodePublicIP, ResourceIdentifier nodePublicIPPrefixId, ScaleSetPriority? scaleSetPriority, ScaleSetEvictionPolicy? scaleSetEvictionPolicy, float? spotMaxPrice, IDictionary tags, IDictionary nodeLabels, IList nodeTaints, ResourceIdentifier proximityPlacementGroupId, KubeletConfig kubeletConfig, LinuxOSConfig linuxOSConfig, bool? enableEncryptionAtHost, bool? enableUltraSsd, bool? enableFips, GpuInstanceProfile? gpuInstanceProfile, ContainerServiceCreationData creationData, ResourceIdentifier capacityReservationGroupId, ResourceIdentifier hostGroupId, AgentPoolNetworkProfile networkProfile, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal ContainerServiceAgentPoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ETag? etag, int? count, string vmSize, int? osDiskSizeInGB, ContainerServiceOSDiskType? osDiskType, KubeletDiskType? kubeletDiskType, WorkloadRuntime? workloadRuntime, string messageOfTheDay, ResourceIdentifier vnetSubnetId, ResourceIdentifier podSubnetId, int? maxPods, ContainerServiceOSType? osType, ContainerServiceOSSku? osSku, int? maxCount, int? minCount, bool? enableAutoScaling, ScaleDownMode? scaleDownMode, AgentPoolType? typePropertiesType, AgentPoolMode? mode, string orchestratorVersion, string currentOrchestratorVersion, string nodeImageVersion, AgentPoolUpgradeSettings upgradeSettings, string provisioningState, ContainerServicePowerState powerState, IList availabilityZones, bool? enableNodePublicIP, ResourceIdentifier nodePublicIPPrefixId, ScaleSetPriority? scaleSetPriority, ScaleSetEvictionPolicy? scaleSetEvictionPolicy, float? spotMaxPrice, IDictionary tags, IDictionary nodeLabels, IList nodeTaints, ResourceIdentifier proximityPlacementGroupId, KubeletConfig kubeletConfig, LinuxOSConfig linuxOSConfig, bool? enableEncryptionAtHost, bool? enableUltraSsd, bool? enableFips, GpuInstanceProfile? gpuInstanceProfile, ContainerServiceCreationData creationData, ResourceIdentifier capacityReservationGroupId, ResourceIdentifier hostGroupId, AgentPoolNetworkProfile networkProfile, AgentPoolWindowsProfile windowsProfile, AgentPoolSecurityProfile securityProfile, GpuProfile gpuProfile, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { + ETag = etag; Count = count; VmSize = vmSize; OSDiskSizeInGB = osDiskSizeInGB; OSDiskType = osDiskType; KubeletDiskType = kubeletDiskType; WorkloadRuntime = workloadRuntime; + MessageOfTheDay = messageOfTheDay; VnetSubnetId = vnetSubnetId; PodSubnetId = podSubnetId; MaxPods = maxPods; @@ -154,9 +161,15 @@ internal ContainerServiceAgentPoolData(ResourceIdentifier id, string name, Resou CapacityReservationGroupId = capacityReservationGroupId; HostGroupId = hostGroupId; NetworkProfile = networkProfile; + WindowsProfile = windowsProfile; + SecurityProfile = securityProfile; + GpuProfile = gpuProfile; _serializedAdditionalRawData = serializedAdditionalRawData; } + /// Unique read-only string used to implement optimistic concurrency. The eTag value will change when the resource is updated. Specify an if-match or if-none-match header with the eTag value for a subsequent request to enable optimistic concurrency per the normal etag convention. + [WirePath("properties.eTag")] + public ETag? ETag { get; } /// Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. [WirePath("properties.count")] public int? Count { get; set; } @@ -175,6 +188,9 @@ internal ContainerServiceAgentPoolData(ResourceIdentifier id, string name, Resou /// Determines the type of workload a node can run. [WirePath("properties.workloadRuntime")] public WorkloadRuntime? WorkloadRuntime { get; set; } + /// A base64-encoded string which will be written to /etc/motd after decoding. This allows customization of the message of the day for Linux nodes. It must not be specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be executed as a script). + [WirePath("properties.messageOfTheDay")] + public string MessageOfTheDay { get; set; } /// If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just nodes. This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. [WirePath("properties.vnetSubnetID")] public ResourceIdentifier VnetSubnetId { get; set; } @@ -310,5 +326,37 @@ public ResourceIdentifier CreationDataSourceResourceId /// Network-related settings of an agent pool. [WirePath("properties.networkProfile")] public AgentPoolNetworkProfile NetworkProfile { get; set; } + /// The Windows agent pool's specific profile. + internal AgentPoolWindowsProfile WindowsProfile { get; set; } + /// The default value is false. Outbound NAT can only be disabled if the cluster outboundType is NAT Gateway and the Windows agent pool does not have node public IP enabled. + [WirePath("properties.windowsProfile.disableOutboundNat")] + public bool? DisableOutboundNat + { + get => WindowsProfile is null ? default : WindowsProfile.DisableOutboundNat; + set + { + if (WindowsProfile is null) + WindowsProfile = new AgentPoolWindowsProfile(); + WindowsProfile.DisableOutboundNat = value; + } + } + + /// The security settings of an agent pool. + [WirePath("properties.securityProfile")] + public AgentPoolSecurityProfile SecurityProfile { get; set; } + /// GPU settings for the Agent Pool. + internal GpuProfile GpuProfile { get; set; } + /// Whether to install GPU drivers. When it's not specified, default is Install. + [WirePath("properties.gpuProfile.driver")] + public GpuDriver? GpuDriver + { + get => GpuProfile is null ? default : GpuProfile.Driver; + set + { + if (GpuProfile is null) + GpuProfile = new GpuProfile(); + GpuProfile.Driver = value; + } + } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolResource.cs index e3ed5337ca43..e9f8f9152a10 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolResource.cs @@ -12,6 +12,7 @@ using System.Threading.Tasks; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager.ContainerService.Models; namespace Azure.ResourceManager.ContainerService { @@ -96,6 +97,75 @@ public virtual AgentPoolUpgradeProfileResource GetAgentPoolUpgradeProfile() return new AgentPoolUpgradeProfileResource(Client, Id.AppendChildResource("upgradeProfiles", "default")); } + /// Gets a collection of MachineResources in the ContainerServiceAgentPool. + /// An object representing collection of MachineResources and their operations over a MachineResource. + public virtual MachineCollection GetMachines() + { + return GetCachedClient(client => new MachineCollection(client, Id)); + } + + /// + /// Get a specific machine in the specified agent pool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/machines/{machineName} + /// + /// + /// Operation Id + /// Machines_Get + /// + /// + /// Default Api Version + /// 2025-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// host name of the machine. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetMachineAsync(string machineName, CancellationToken cancellationToken = default) + { + return await GetMachines().GetAsync(machineName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a specific machine in the specified agent pool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/machines/{machineName} + /// + /// + /// Operation Id + /// Machines_Get + /// + /// + /// Default Api Version + /// 2025-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// host name of the machine. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetMachine(string machineName, CancellationToken cancellationToken = default) + { + return GetMachines().Get(machineName, cancellationToken); + } + /// /// Gets the specified managed cluster agent pool. /// @@ -109,7 +179,7 @@ public virtual AgentPoolUpgradeProfileResource GetAgentPoolUpgradeProfile() /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -149,7 +219,7 @@ public virtual async Task> GetAsync( /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -189,7 +259,7 @@ public virtual Response Get(CancellationToken /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -198,15 +268,17 @@ public virtual Response Get(CancellationToken /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ignore-pod-disruption-budget=true to delete those pods on a node without considering Pod Disruption Budget. + /// The request should only proceed if an entity matches this string. /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(WaitUntil waitUntil, bool? ignorePodDisruptionBudget = null, string ifMatch = null, CancellationToken cancellationToken = default) { using var scope = _containerServiceAgentPoolAgentPoolsClientDiagnostics.CreateScope("ContainerServiceAgentPoolResource.Delete"); scope.Start(); try { - var response = await _containerServiceAgentPoolAgentPoolsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new ContainerServiceArmOperation(_containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, _containerServiceAgentPoolAgentPoolsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = await _containerServiceAgentPoolAgentPoolsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ignorePodDisruptionBudget, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(_containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, _containerServiceAgentPoolAgentPoolsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ignorePodDisruptionBudget, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -231,7 +303,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -240,15 +312,17 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ignore-pod-disruption-budget=true to delete those pods on a node without considering Pod Disruption Budget. + /// The request should only proceed if an entity matches this string. /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual ArmOperation Delete(WaitUntil waitUntil, bool? ignorePodDisruptionBudget = null, string ifMatch = null, CancellationToken cancellationToken = default) { using var scope = _containerServiceAgentPoolAgentPoolsClientDiagnostics.CreateScope("ContainerServiceAgentPoolResource.Delete"); scope.Start(); try { - var response = _containerServiceAgentPoolAgentPoolsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new ContainerServiceArmOperation(_containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, _containerServiceAgentPoolAgentPoolsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = _containerServiceAgentPoolAgentPoolsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ignorePodDisruptionBudget, ifMatch, cancellationToken); + var operation = new ContainerServiceArmOperation(_containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, _containerServiceAgentPoolAgentPoolsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ignorePodDisruptionBudget, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -273,7 +347,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -283,9 +357,11 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The agent pool to create or update. + /// The request should only proceed if an entity matches this string. + /// The request should only proceed if no entity matches this string. /// The cancellation token to use. /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, ContainerServiceAgentPoolData data, CancellationToken cancellationToken = default) + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ContainerServiceAgentPoolData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); @@ -293,8 +369,8 @@ public virtual async Task> Updat scope.Start(); try { - var response = await _containerServiceAgentPoolAgentPoolsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); - var operation = new ContainerServiceArmOperation(new ContainerServiceAgentPoolOperationSource(Client), _containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, _containerServiceAgentPoolAgentPoolsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + var response = await _containerServiceAgentPoolAgentPoolsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, ifNoneMatch, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(new ContainerServiceAgentPoolOperationSource(Client), _containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, _containerServiceAgentPoolAgentPoolsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -319,7 +395,7 @@ public virtual async Task> Updat /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -329,9 +405,11 @@ public virtual async Task> Updat /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The agent pool to create or update. + /// The request should only proceed if an entity matches this string. + /// The request should only proceed if no entity matches this string. /// The cancellation token to use. /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, ContainerServiceAgentPoolData data, CancellationToken cancellationToken = default) + public virtual ArmOperation Update(WaitUntil waitUntil, ContainerServiceAgentPoolData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); @@ -339,8 +417,8 @@ public virtual ArmOperation Update(WaitUntil scope.Start(); try { - var response = _containerServiceAgentPoolAgentPoolsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); - var operation = new ContainerServiceArmOperation(new ContainerServiceAgentPoolOperationSource(Client), _containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, _containerServiceAgentPoolAgentPoolsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + var response = _containerServiceAgentPoolAgentPoolsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, ifNoneMatch, cancellationToken); + var operation = new ContainerServiceArmOperation(new ContainerServiceAgentPoolOperationSource(Client), _containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, _containerServiceAgentPoolAgentPoolsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -365,7 +443,7 @@ public virtual ArmOperation Update(WaitUntil /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -407,7 +485,7 @@ public virtual async Task AbortLatestOperationAsync(WaitUntil wait /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -436,6 +514,98 @@ public virtual ArmOperation AbortLatestOperation(WaitUntil waitUntil, Cancellati } } + /// + /// Deletes specific machines in an agent pool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/deleteMachines + /// + /// + /// Operation Id + /// AgentPools_DeleteMachines + /// + /// + /// Default Api Version + /// 2025-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A list of machines from the agent pool to be deleted. + /// The cancellation token to use. + /// is null. + public virtual async Task DeleteMachinesAsync(WaitUntil waitUntil, AgentPoolDeleteMachinesParameter machines, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(machines, nameof(machines)); + + using var scope = _containerServiceAgentPoolAgentPoolsClientDiagnostics.CreateScope("ContainerServiceAgentPoolResource.DeleteMachines"); + scope.Start(); + try + { + var response = await _containerServiceAgentPoolAgentPoolsRestClient.DeleteMachinesAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, machines, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(_containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, _containerServiceAgentPoolAgentPoolsRestClient.CreateDeleteMachinesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, machines).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes specific machines in an agent pool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/deleteMachines + /// + /// + /// Operation Id + /// AgentPools_DeleteMachines + /// + /// + /// Default Api Version + /// 2025-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A list of machines from the agent pool to be deleted. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation DeleteMachines(WaitUntil waitUntil, AgentPoolDeleteMachinesParameter machines, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(machines, nameof(machines)); + + using var scope = _containerServiceAgentPoolAgentPoolsClientDiagnostics.CreateScope("ContainerServiceAgentPoolResource.DeleteMachines"); + scope.Start(); + try + { + var response = _containerServiceAgentPoolAgentPoolsRestClient.DeleteMachines(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, machines, cancellationToken); + var operation = new ContainerServiceArmOperation(_containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, _containerServiceAgentPoolAgentPoolsRestClient.CreateDeleteMachinesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, machines).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// /// Upgrading the node image version of an agent pool applies the newest OS and runtime updates to the nodes. AKS provides one new image per week with the latest updates. For more details on node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade /// @@ -449,7 +619,7 @@ public virtual ArmOperation AbortLatestOperation(WaitUntil waitUntil, Cancellati /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -491,7 +661,7 @@ public virtual async Task UpgradeNodeImageVersionAsync(WaitUntil w /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -533,7 +703,7 @@ public virtual ArmOperation UpgradeNodeImageVersion(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -590,7 +760,7 @@ public virtual async Task> AddTagAsy /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -647,7 +817,7 @@ public virtual Response AddTag(string key, st /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -703,7 +873,7 @@ public virtual async Task> SetTagsAs /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -759,7 +929,7 @@ public virtual Response SetTags(IDictionary /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -814,7 +984,7 @@ public virtual async Task> RemoveTag /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationCollection.cs index f608a529017b..a21d7f4c4209 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -115,7 +115,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -166,7 +166,7 @@ public virtual ArmOperation Cr /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -211,7 +211,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -256,7 +256,7 @@ public virtual Response Get(st /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -286,7 +286,7 @@ public virtual AsyncPageable G /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -316,7 +316,7 @@ public virtual Pageable GetAll /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -359,7 +359,7 @@ public virtual async Task> ExistsAsync(string configName, Cancell /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -402,7 +402,7 @@ public virtual Response Exists(string configName, CancellationToken cancel /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -447,7 +447,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationResource.cs index f1463e991c78..5ed621ef20ae 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationResource.cs @@ -101,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -141,7 +141,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -181,7 +181,7 @@ public virtual Response Get(Ca /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -225,7 +225,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -269,7 +269,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -317,7 +317,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterCollection.cs index a05f8d6c2d6d..f37b3fc9d7bb 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterCollection.cs @@ -65,7 +65,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -76,10 +76,12 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The name of the managed cluster resource. /// The managed cluster to create or update. + /// The request should only proceed if an entity matches this string. + /// The request should only proceed if no entity matches this string. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string resourceName, ContainerServiceManagedClusterData data, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string resourceName, ContainerServiceManagedClusterData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); Argument.AssertNotNull(data, nameof(data)); @@ -88,8 +90,8 @@ public virtual async Task> scope.Start(); try { - var response = await _containerServiceManagedClusterManagedClustersRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, data, cancellationToken).ConfigureAwait(false); - var operation = new ContainerServiceArmOperation(new ContainerServiceManagedClusterOperationSource(Client), _containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName, data).Request, response, OperationFinalStateVia.Location); + var response = await _containerServiceManagedClusterManagedClustersRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, data, ifMatch, ifNoneMatch, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(new ContainerServiceManagedClusterOperationSource(Client), _containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -114,7 +116,7 @@ public virtual async Task> /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -125,10 +127,12 @@ public virtual async Task> /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The name of the managed cluster resource. /// The managed cluster to create or update. + /// The request should only proceed if an entity matches this string. + /// The request should only proceed if no entity matches this string. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string resourceName, ContainerServiceManagedClusterData data, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string resourceName, ContainerServiceManagedClusterData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); Argument.AssertNotNull(data, nameof(data)); @@ -137,8 +141,8 @@ public virtual ArmOperation CreateOrUpda scope.Start(); try { - var response = _containerServiceManagedClusterManagedClustersRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, resourceName, data, cancellationToken); - var operation = new ContainerServiceArmOperation(new ContainerServiceManagedClusterOperationSource(Client), _containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName, data).Request, response, OperationFinalStateVia.Location); + var response = _containerServiceManagedClusterManagedClustersRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, resourceName, data, ifMatch, ifNoneMatch, cancellationToken); + var operation = new ContainerServiceArmOperation(new ContainerServiceManagedClusterOperationSource(Client), _containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -163,7 +167,7 @@ public virtual ArmOperation CreateOrUpda /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -208,7 +212,7 @@ public virtual async Task> GetA /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -253,7 +257,7 @@ public virtual Response Get(string resou /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -283,7 +287,7 @@ public virtual AsyncPageable GetAllAsync /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -313,7 +317,7 @@ public virtual Pageable GetAll(Cancellat /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -356,7 +360,7 @@ public virtual async Task> ExistsAsync(string resourceName, Cance /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -399,7 +403,7 @@ public virtual Response Exists(string resourceName, CancellationToken canc /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -444,7 +448,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterData.Serialization.cs index 30555f8e2859..9ff26fb4f024 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterData.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterData.Serialization.cs @@ -40,6 +40,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } base.JsonModelWriteCore(writer, options); + if (options.Format != "W" && Optional.IsDefined(ETag)) + { + writer.WritePropertyName("eTag"u8); + writer.WriteStringValue(ETag.Value.ToString()); + } if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); @@ -158,6 +163,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("nodeResourceGroup"u8); writer.WriteStringValue(NodeResourceGroup); } + if (Optional.IsDefined(NodeResourceGroupProfile)) + { + writer.WritePropertyName("nodeResourceGroupProfile"u8); + writer.WriteObjectValue(NodeResourceGroupProfile, options); + } if (Optional.IsDefined(EnableRbac)) { writer.WritePropertyName("enableRBAC"u8); @@ -249,6 +259,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("storageProfile"u8); writer.WriteObjectValue(StorageProfile, options); } + if (Optional.IsDefined(IngressProfile)) + { + writer.WritePropertyName("ingressProfile"u8); + writer.WriteObjectValue(IngressProfile, options); + } if (Optional.IsDefined(PublicNetworkAccess)) { writer.WritePropertyName("publicNetworkAccess"u8); @@ -274,6 +289,16 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("resourceUID"u8); writer.WriteStringValue(ResourceId); } + if (Optional.IsDefined(MetricsProfile)) + { + writer.WritePropertyName("metricsProfile"u8); + writer.WriteObjectValue(MetricsProfile, options); + } + if (Optional.IsDefined(BootstrapProfile)) + { + writer.WritePropertyName("bootstrapProfile"u8); + writer.WriteObjectValue(BootstrapProfile, options); + } writer.WriteEndObject(); } @@ -297,6 +322,7 @@ internal static ContainerServiceManagedClusterData DeserializeContainerServiceMa { return null; } + ETag? etag = default; ManagedClusterSku sku = default; ExtendedLocation extendedLocation = default; ManagedClusterIdentity identity = default; @@ -324,6 +350,7 @@ internal static ContainerServiceManagedClusterData DeserializeContainerServiceMa ManagedClusterPodIdentityProfile podIdentityProfile = default; ManagedClusterOidcIssuerProfile oidcIssuerProfile = default; string nodeResourceGroup = default; + ManagedClusterNodeResourceGroupProfile nodeResourceGroupProfile = default; bool? enableRBAC = default; KubernetesSupportPlan? supportPlan = default; bool? enablePodSecurityPolicy = default; @@ -340,15 +367,27 @@ internal static ContainerServiceManagedClusterData DeserializeContainerServiceMa ManagedClusterHttpProxyConfig httpProxyConfig = default; ManagedClusterSecurityProfile securityProfile = default; ManagedClusterStorageProfile storageProfile = default; + ManagedClusterIngressProfile ingressProfile = default; ContainerServicePublicNetworkAccess? publicNetworkAccess = default; ManagedClusterWorkloadAutoScalerProfile workloadAutoScalerProfile = default; ManagedClusterAzureMonitorProfile azureMonitorProfile = default; ServiceMeshProfile serviceMeshProfile = default; ResourceIdentifier resourceUID = default; + ManagedClusterMetricsProfile metricsProfile = default; + ManagedClusterBootstrapProfile bootstrapProfile = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("eTag"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + etag = new ETag(property.Value.GetString()); + continue; + } if (property.NameEquals("sku"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -564,6 +603,15 @@ internal static ContainerServiceManagedClusterData DeserializeContainerServiceMa nodeResourceGroup = property0.Value.GetString(); continue; } + if (property0.NameEquals("nodeResourceGroupProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nodeResourceGroupProfile = ManagedClusterNodeResourceGroupProfile.DeserializeManagedClusterNodeResourceGroupProfile(property0.Value, options); + continue; + } if (property0.NameEquals("enableRBAC"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -718,6 +766,15 @@ internal static ContainerServiceManagedClusterData DeserializeContainerServiceMa storageProfile = ManagedClusterStorageProfile.DeserializeManagedClusterStorageProfile(property0.Value, options); continue; } + if (property0.NameEquals("ingressProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ingressProfile = ManagedClusterIngressProfile.DeserializeManagedClusterIngressProfile(property0.Value, options); + continue; + } if (property0.NameEquals("publicNetworkAccess"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -763,6 +820,24 @@ internal static ContainerServiceManagedClusterData DeserializeContainerServiceMa resourceUID = new ResourceIdentifier(property0.Value.GetString()); continue; } + if (property0.NameEquals("metricsProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + metricsProfile = ManagedClusterMetricsProfile.DeserializeManagedClusterMetricsProfile(property0.Value, options); + continue; + } + if (property0.NameEquals("bootstrapProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + bootstrapProfile = ManagedClusterBootstrapProfile.DeserializeManagedClusterBootstrapProfile(property0.Value, options); + continue; + } } continue; } @@ -779,6 +854,7 @@ internal static ContainerServiceManagedClusterData DeserializeContainerServiceMa systemData, tags ?? new ChangeTrackingDictionary(), location, + etag, sku, extendedLocation, identity, @@ -800,6 +876,7 @@ internal static ContainerServiceManagedClusterData DeserializeContainerServiceMa podIdentityProfile, oidcIssuerProfile, nodeResourceGroup, + nodeResourceGroupProfile, enableRBAC, supportPlan, enablePodSecurityPolicy, @@ -816,11 +893,14 @@ internal static ContainerServiceManagedClusterData DeserializeContainerServiceMa httpProxyConfig, securityProfile, storageProfile, + ingressProfile, publicNetworkAccess, workloadAutoScalerProfile, azureMonitorProfile, serviceMeshProfile, resourceUID, + metricsProfile, + bootstrapProfile, serializedAdditionalRawData); } @@ -907,6 +987,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ETag), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" eTag: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ETag)) + { + builder.Append(" eTag: "); + builder.AppendLine($"'{ETag.Value.ToString()}'"); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Sku), out propertyOverride); if (hasPropertyOverride) { @@ -1348,6 +1443,26 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("NodeResourceGroupRestrictionLevel", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nodeResourceGroupProfile: "); + builder.AppendLine("{"); + builder.AppendLine(" nodeResourceGroupProfile: {"); + builder.Append(" restrictionLevel: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(NodeResourceGroupProfile)) + { + builder.Append(" nodeResourceGroupProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, NodeResourceGroupProfile, options, 4, false, " nodeResourceGroupProfile: "); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnableRbac), out propertyOverride); if (hasPropertyOverride) { @@ -1613,6 +1728,26 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("IngressWebAppRouting", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" ingressProfile: "); + builder.AppendLine("{"); + builder.AppendLine(" ingressProfile: {"); + builder.Append(" webAppRouting: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(IngressProfile)) + { + builder.Append(" ingressProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, IngressProfile, options, 4, false, " ingressProfile: "); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PublicNetworkAccess), out propertyOverride); if (hasPropertyOverride) { @@ -1693,6 +1828,43 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("CostAnalysisEnabled", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" metricsProfile: "); + builder.AppendLine("{"); + builder.AppendLine(" metricsProfile: {"); + builder.AppendLine(" costAnalysis: {"); + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + builder.AppendLine(" }"); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(MetricsProfile)) + { + builder.Append(" metricsProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, MetricsProfile, options, 4, false, " metricsProfile: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(BootstrapProfile), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" bootstrapProfile: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(BootstrapProfile)) + { + builder.Append(" bootstrapProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, BootstrapProfile, options, 4, false, " bootstrapProfile: "); + } + } + builder.AppendLine(" }"); builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterData.cs index 9d7696707b56..3b5e285cc390 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterData.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterData.cs @@ -69,6 +69,7 @@ public ContainerServiceManagedClusterData(AzureLocation location) : base(locatio /// The systemData. /// The tags. /// The location. + /// Unique read-only string used to implement optimistic concurrency. The eTag value will change when the resource is updated. Specify an if-match or if-none-match header with the eTag value for a subsequent request to enable optimistic concurrency per the normal etag convention. /// The managed cluster SKU. /// The extended location of the Virtual Machine. /// The identity of the managed cluster, if configured. @@ -90,6 +91,7 @@ public ContainerServiceManagedClusterData(AzureLocation location) : base(locatio /// See [use AAD pod identity](https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity) for more details on AAD pod identity integration. /// The OIDC issuer profile of the Managed Cluster. /// The name of the resource group containing agent pool nodes. + /// Profile of the node resource group configuration. /// Whether to enable Kubernetes Role-Based Access Control. /// The support plan for the Managed Cluster. If unspecified, the default is 'KubernetesOfficial'. /// (DEPRECATED) Whether to enable Kubernetes pod security policy (preview). PodSecurityPolicy was deprecated in Kubernetes v1.21, and removed from Kubernetes in v1.25. Learn more at https://aka.ms/k8s/psp and https://aka.ms/aks/psp. @@ -100,20 +102,24 @@ public ContainerServiceManagedClusterData(AzureLocation location) : base(locatio /// Parameters to be applied to the cluster-autoscaler when enabled. /// The access profile for managed cluster API server. /// This is of the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{encryptionSetName}'. - /// Identities associated with the cluster. + /// The user identity associated with the managed cluster. This identity will be used by the kubelet. Only one user assigned identity is allowed. The only accepted key is "kubeletidentity", with value of "resourceId": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}". /// Private link resources associated with the cluster. /// If set to true, getting static credentials will be disabled for this cluster. This must only be used on Managed Clusters that are AAD enabled. For more details see [disable local accounts](https://docs.microsoft.com/azure/aks/managed-aad#disable-local-accounts-preview). /// Configurations for provisioning the cluster with HTTP proxy servers. /// Security profile for the managed cluster. /// Storage profile for the managed cluster. + /// Ingress profile for the managed cluster. /// Allow or deny public network access for AKS. /// Workload Auto-scaler profile for the managed cluster. /// Azure Monitor addon profiles for monitoring the managed cluster. /// Service mesh profile for a managed cluster. /// The resourceUID uniquely identifies ManagedClusters that reuse ARM ResourceIds (i.e: create, delete, create sequence). + /// Optional cluster metrics configuration. + /// Profile of the cluster bootstrap configuration. /// Keeps track of any properties unknown to the library. - internal ContainerServiceManagedClusterData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedClusterSku sku, ExtendedLocation extendedLocation, ManagedClusterIdentity clusterIdentity, string provisioningState, ContainerServicePowerState powerState, int? maxAgentPools, string kubernetesVersion, string currentKubernetesVersion, string dnsPrefix, string fqdnSubdomain, string fqdn, string privateFqdn, string azurePortalFqdn, IList agentPoolProfiles, ContainerServiceLinuxProfile linuxProfile, ManagedClusterWindowsProfile windowsProfile, ManagedClusterServicePrincipalProfile servicePrincipalProfile, IDictionary addonProfiles, ManagedClusterPodIdentityProfile podIdentityProfile, ManagedClusterOidcIssuerProfile oidcIssuerProfile, string nodeResourceGroup, bool? enableRbac, KubernetesSupportPlan? supportPlan, bool? enablePodSecurityPolicy, ContainerServiceNetworkProfile networkProfile, ManagedClusterAadProfile aadProfile, ManagedClusterAutoUpgradeProfile autoUpgradeProfile, ClusterUpgradeSettings upgradeSettings, ManagedClusterAutoScalerProfile autoScalerProfile, ManagedClusterApiServerAccessProfile apiServerAccessProfile, ResourceIdentifier diskEncryptionSetId, IDictionary identityProfile, IList privateLinkResources, bool? disableLocalAccounts, ManagedClusterHttpProxyConfig httpProxyConfig, ManagedClusterSecurityProfile securityProfile, ManagedClusterStorageProfile storageProfile, ContainerServicePublicNetworkAccess? publicNetworkAccess, ManagedClusterWorkloadAutoScalerProfile workloadAutoScalerProfile, ManagedClusterAzureMonitorProfile azureMonitorProfile, ServiceMeshProfile serviceMeshProfile, ResourceIdentifier resourceId, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + internal ContainerServiceManagedClusterData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, ManagedClusterSku sku, ExtendedLocation extendedLocation, ManagedClusterIdentity clusterIdentity, string provisioningState, ContainerServicePowerState powerState, int? maxAgentPools, string kubernetesVersion, string currentKubernetesVersion, string dnsPrefix, string fqdnSubdomain, string fqdn, string privateFqdn, string azurePortalFqdn, IList agentPoolProfiles, ContainerServiceLinuxProfile linuxProfile, ManagedClusterWindowsProfile windowsProfile, ManagedClusterServicePrincipalProfile servicePrincipalProfile, IDictionary addonProfiles, ManagedClusterPodIdentityProfile podIdentityProfile, ManagedClusterOidcIssuerProfile oidcIssuerProfile, string nodeResourceGroup, ManagedClusterNodeResourceGroupProfile nodeResourceGroupProfile, bool? enableRbac, KubernetesSupportPlan? supportPlan, bool? enablePodSecurityPolicy, ContainerServiceNetworkProfile networkProfile, ManagedClusterAadProfile aadProfile, ManagedClusterAutoUpgradeProfile autoUpgradeProfile, ClusterUpgradeSettings upgradeSettings, ManagedClusterAutoScalerProfile autoScalerProfile, ManagedClusterApiServerAccessProfile apiServerAccessProfile, ResourceIdentifier diskEncryptionSetId, IDictionary identityProfile, IList privateLinkResources, bool? disableLocalAccounts, ManagedClusterHttpProxyConfig httpProxyConfig, ManagedClusterSecurityProfile securityProfile, ManagedClusterStorageProfile storageProfile, ManagedClusterIngressProfile ingressProfile, ContainerServicePublicNetworkAccess? publicNetworkAccess, ManagedClusterWorkloadAutoScalerProfile workloadAutoScalerProfile, ManagedClusterAzureMonitorProfile azureMonitorProfile, ServiceMeshProfile serviceMeshProfile, ResourceIdentifier resourceId, ManagedClusterMetricsProfile metricsProfile, ManagedClusterBootstrapProfile bootstrapProfile, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { + ETag = etag; Sku = sku; ExtendedLocation = extendedLocation; ClusterIdentity = clusterIdentity; @@ -135,6 +141,7 @@ internal ContainerServiceManagedClusterData(ResourceIdentifier id, string name, PodIdentityProfile = podIdentityProfile; OidcIssuerProfile = oidcIssuerProfile; NodeResourceGroup = nodeResourceGroup; + NodeResourceGroupProfile = nodeResourceGroupProfile; EnableRbac = enableRbac; SupportPlan = supportPlan; EnablePodSecurityPolicy = enablePodSecurityPolicy; @@ -151,11 +158,14 @@ internal ContainerServiceManagedClusterData(ResourceIdentifier id, string name, HttpProxyConfig = httpProxyConfig; SecurityProfile = securityProfile; StorageProfile = storageProfile; + IngressProfile = ingressProfile; PublicNetworkAccess = publicNetworkAccess; WorkloadAutoScalerProfile = workloadAutoScalerProfile; AzureMonitorProfile = azureMonitorProfile; ServiceMeshProfile = serviceMeshProfile; ResourceId = resourceId; + MetricsProfile = metricsProfile; + BootstrapProfile = bootstrapProfile; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -164,6 +174,9 @@ internal ContainerServiceManagedClusterData() { } + /// Unique read-only string used to implement optimistic concurrency. The eTag value will change when the resource is updated. Specify an if-match or if-none-match header with the eTag value for a subsequent request to enable optimistic concurrency per the normal etag convention. + [WirePath("eTag")] + public ETag? ETag { get; } /// The managed cluster SKU. [WirePath("sku")] public ManagedClusterSku Sku { get; set; } @@ -233,6 +246,21 @@ public ContainerServiceStateCode? PowerStateCode /// The name of the resource group containing agent pool nodes. [WirePath("properties.nodeResourceGroup")] public string NodeResourceGroup { get; set; } + /// Profile of the node resource group configuration. + internal ManagedClusterNodeResourceGroupProfile NodeResourceGroupProfile { get; set; } + /// The restriction level applied to the cluster's node resource group. If not specified, the default is 'Unrestricted'. + [WirePath("properties.nodeResourceGroupProfile.restrictionLevel")] + public RestrictionLevel? NodeResourceGroupRestrictionLevel + { + get => NodeResourceGroupProfile is null ? default : NodeResourceGroupProfile.RestrictionLevel; + set + { + if (NodeResourceGroupProfile is null) + NodeResourceGroupProfile = new ManagedClusterNodeResourceGroupProfile(); + NodeResourceGroupProfile.RestrictionLevel = value; + } + } + /// Whether to enable Kubernetes Role-Based Access Control. [WirePath("properties.enableRBAC")] public bool? EnableRbac { get; set; } @@ -275,7 +303,7 @@ public UpgradeOverrideSettings UpgradeOverrideSettings /// This is of the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{encryptionSetName}'. [WirePath("properties.diskEncryptionSetID")] public ResourceIdentifier DiskEncryptionSetId { get; set; } - /// Identities associated with the cluster. + /// The user identity associated with the managed cluster. This identity will be used by the kubelet. Only one user assigned identity is allowed. The only accepted key is "kubeletidentity", with value of "resourceId": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}". [WirePath("properties.identityProfile")] public IDictionary IdentityProfile { get; } /// Private link resources associated with the cluster. @@ -293,6 +321,21 @@ public UpgradeOverrideSettings UpgradeOverrideSettings /// Storage profile for the managed cluster. [WirePath("properties.storageProfile")] public ManagedClusterStorageProfile StorageProfile { get; set; } + /// Ingress profile for the managed cluster. + internal ManagedClusterIngressProfile IngressProfile { get; set; } + /// App Routing settings for the ingress profile. You can find an overview and onboarding guide for this feature at https://learn.microsoft.com/en-us/azure/aks/app-routing?tabs=default%2Cdeploy-app-default. + [WirePath("properties.ingressProfile.webAppRouting")] + public ManagedClusterIngressProfileWebAppRouting IngressWebAppRouting + { + get => IngressProfile is null ? default : IngressProfile.WebAppRouting; + set + { + if (IngressProfile is null) + IngressProfile = new ManagedClusterIngressProfile(); + IngressProfile.WebAppRouting = value; + } + } + /// Allow or deny public network access for AKS. [WirePath("properties.publicNetworkAccess")] public ContainerServicePublicNetworkAccess? PublicNetworkAccess { get; set; } @@ -320,5 +363,23 @@ public ManagedClusterMonitorProfileMetrics AzureMonitorMetrics /// The resourceUID uniquely identifies ManagedClusters that reuse ARM ResourceIds (i.e: create, delete, create sequence). [WirePath("properties.resourceUID")] public ResourceIdentifier ResourceId { get; } + /// Optional cluster metrics configuration. + internal ManagedClusterMetricsProfile MetricsProfile { get; set; } + /// The Managed Cluster sku.tier must be set to 'Standard' or 'Premium' to enable this feature. Enabling this will add Kubernetes Namespace and Deployment details to the Cost Analysis views in the Azure portal. If not specified, the default is false. For more information see aka.ms/aks/docs/cost-analysis. + [WirePath("properties.metricsProfile.costAnalysis.enabled")] + public bool? CostAnalysisEnabled + { + get => MetricsProfile is null ? default : MetricsProfile.CostAnalysisEnabled; + set + { + if (MetricsProfile is null) + MetricsProfile = new ManagedClusterMetricsProfile(); + MetricsProfile.CostAnalysisEnabled = value; + } + } + + /// Profile of the cluster bootstrap configuration. + [WirePath("properties.bootstrapProfile")] + public ManagedClusterBootstrapProfile BootstrapProfile { get; set; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterResource.cs index e9761b7a74dd..74be851c1613 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterResource.cs @@ -130,7 +130,7 @@ public virtual MeshUpgradeProfileCollection GetMeshUpgradeProfiles() /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -161,7 +161,7 @@ public virtual async Task> GetMeshUpgradePr /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -199,7 +199,7 @@ public virtual ContainerServiceMaintenanceConfigurationCollection GetContainerSe /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -230,7 +230,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -268,7 +268,7 @@ public virtual ContainerServiceAgentPoolCollection GetContainerServiceAgentPools /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -299,7 +299,7 @@ public virtual async Task> GetContai /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -337,7 +337,7 @@ public virtual ContainerServicePrivateEndpointConnectionCollection GetContainerS /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -368,7 +368,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -406,7 +406,7 @@ public virtual ContainerServiceTrustedAccessRoleBindingCollection GetContainerSe /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -437,7 +437,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -468,7 +468,7 @@ public virtual Response GetCon /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -508,7 +508,7 @@ public virtual async Task> GetA /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -535,6 +535,92 @@ public virtual Response Get(Cancellation } } + /// + /// Deletes a managed cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusters_Delete + /// + /// + /// Default Api Version + /// 2025-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The request should only proceed if an entity matches this string. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, string ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.Delete"); + scope.Start(); + try + { + var response = await _containerServiceManagedClusterManagedClustersRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(_containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a managed cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusters_Delete + /// + /// + /// Default Api Version + /// 2025-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The request should only proceed if an entity matches this string. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, string ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.Delete"); + scope.Start(); + try + { + var response = _containerServiceManagedClusterManagedClustersRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ifMatch, cancellationToken); + var operation = new ContainerServiceArmOperation(_containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// /// Updates tags on a managed cluster. /// @@ -548,7 +634,7 @@ public virtual Response Get(Cancellation /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -558,9 +644,10 @@ public virtual Response Get(Cancellation /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// Parameters supplied to the Update Managed Cluster Tags operation. + /// The request should only proceed if an entity matches this string. /// The cancellation token to use. /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, ContainerServiceTagsObject containerServiceTagsObject, CancellationToken cancellationToken = default) + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ContainerServiceTagsObject containerServiceTagsObject, string ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(containerServiceTagsObject, nameof(containerServiceTagsObject)); @@ -568,8 +655,8 @@ public virtual async Task> scope.Start(); try { - var response = await _containerServiceManagedClusterManagedClustersRestClient.UpdateTagsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, containerServiceTagsObject, cancellationToken).ConfigureAwait(false); - var operation = new ContainerServiceArmOperation(new ContainerServiceManagedClusterOperationSource(Client), _containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateUpdateTagsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, containerServiceTagsObject).Request, response, OperationFinalStateVia.Location); + var response = await _containerServiceManagedClusterManagedClustersRestClient.UpdateTagsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, containerServiceTagsObject, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(new ContainerServiceManagedClusterOperationSource(Client), _containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateUpdateTagsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, containerServiceTagsObject, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -594,7 +681,7 @@ public virtual async Task> /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -604,9 +691,10 @@ public virtual async Task> /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// Parameters supplied to the Update Managed Cluster Tags operation. + /// The request should only proceed if an entity matches this string. /// The cancellation token to use. /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, ContainerServiceTagsObject containerServiceTagsObject, CancellationToken cancellationToken = default) + public virtual ArmOperation Update(WaitUntil waitUntil, ContainerServiceTagsObject containerServiceTagsObject, string ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(containerServiceTagsObject, nameof(containerServiceTagsObject)); @@ -614,8 +702,8 @@ public virtual ArmOperation Update(WaitU scope.Start(); try { - var response = _containerServiceManagedClusterManagedClustersRestClient.UpdateTags(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, containerServiceTagsObject, cancellationToken); - var operation = new ContainerServiceArmOperation(new ContainerServiceManagedClusterOperationSource(Client), _containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateUpdateTagsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, containerServiceTagsObject).Request, response, OperationFinalStateVia.Location); + var response = _containerServiceManagedClusterManagedClustersRestClient.UpdateTags(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, containerServiceTagsObject, ifMatch, cancellationToken); + var operation = new ContainerServiceArmOperation(new ContainerServiceManagedClusterOperationSource(Client), _containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateUpdateTagsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, containerServiceTagsObject, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -640,7 +728,7 @@ public virtual ArmOperation Update(WaitU /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// @@ -679,7 +767,7 @@ public virtual async Task> GetAccessProfil /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// @@ -718,7 +806,7 @@ public virtual Response GetAccessProfile(string rol /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -757,7 +845,7 @@ public virtual async Task> GetClusterAdminCr /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -796,7 +884,7 @@ public virtual Response GetClusterAdminCredentials(st /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -836,7 +924,7 @@ public virtual async Task> GetClusterUserCre /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -876,7 +964,7 @@ public virtual Response GetClusterUserCredentials(str /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -915,7 +1003,7 @@ public virtual async Task> GetClusterMonitor /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -954,7 +1042,7 @@ public virtual Response GetClusterMonitoringUserCrede /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -1000,7 +1088,7 @@ public virtual async Task ResetServicePrincipalProfileAsync(WaitUn /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -1046,7 +1134,7 @@ public virtual ArmOperation ResetServicePrincipalProfile(WaitUntil waitUntil, Ma /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -1092,7 +1180,7 @@ public virtual async Task ResetAadProfileAsync(WaitUntil waitUntil /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -1138,7 +1226,7 @@ public virtual ArmOperation ResetAadProfile(WaitUntil waitUntil, ManagedClusterA /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -1180,7 +1268,7 @@ public virtual async Task RotateClusterCertificatesAsync(WaitUntil /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -1222,7 +1310,7 @@ public virtual ArmOperation RotateClusterCertificates(WaitUntil waitUntil, Cance /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -1264,7 +1352,7 @@ public virtual async Task AbortLatestOperationAsync(WaitUntil wait /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -1306,7 +1394,7 @@ public virtual ArmOperation AbortLatestOperation(WaitUntil waitUntil, Cancellati /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -1348,7 +1436,7 @@ public virtual async Task RotateServiceAccountSigningKeysAsync(Wai /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -1390,7 +1478,7 @@ public virtual ArmOperation RotateServiceAccountSigningKeys(WaitUntil waitUntil, /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -1432,7 +1520,7 @@ public virtual async Task StopAsync(WaitUntil waitUntil, Cancellat /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -1474,7 +1562,7 @@ public virtual ArmOperation Stop(WaitUntil waitUntil, CancellationToken cancella /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -1516,7 +1604,7 @@ public virtual async Task StartAsync(WaitUntil waitUntil, Cancella /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -1558,7 +1646,7 @@ public virtual ArmOperation Start(WaitUntil waitUntil, CancellationToken cancell /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -1604,7 +1692,7 @@ public virtual async Task> RunComma /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -1650,7 +1738,7 @@ public virtual ArmOperation RunCommand(WaitUntil /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// @@ -1689,7 +1777,7 @@ public virtual async Task> GetCommandRe /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// @@ -1728,7 +1816,7 @@ public virtual Response GetCommandResult(string /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -1758,7 +1846,7 @@ public virtual AsyncPageable GetOut /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -1788,7 +1876,7 @@ public virtual Pageable GetOutbound /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// @@ -1822,7 +1910,7 @@ public virtual async Task> GetAvailableAgen /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// @@ -1856,7 +1944,7 @@ public virtual Response GetAvailableAgentPoolVersion /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// @@ -1881,7 +1969,7 @@ public virtual AsyncPageable GetPrivate /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// @@ -1906,7 +1994,7 @@ public virtual Pageable GetPrivateLinkR /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// @@ -1944,7 +2032,7 @@ public virtual async Task> Res /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// @@ -1982,7 +2070,7 @@ public virtual Response ResolvePrivateL /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -2044,7 +2132,7 @@ public virtual async Task> AddT /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -2106,7 +2194,7 @@ public virtual Response AddTag(string ke /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -2163,7 +2251,7 @@ public virtual async Task> SetT /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -2220,7 +2308,7 @@ public virtual Response SetTags(IDiction /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -2280,7 +2368,7 @@ public virtual async Task> Remo /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionCollection.cs index e42d1a48311f..c008934968c8 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -115,7 +115,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -166,7 +166,7 @@ public virtual ArmOperation C /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -211,7 +211,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -256,7 +256,7 @@ public virtual Response Get(s /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -285,7 +285,7 @@ public virtual AsyncPageable /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -314,7 +314,7 @@ public virtual Pageable GetAl /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -357,7 +357,7 @@ public virtual async Task> ExistsAsync(string privateEndpointConn /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -400,7 +400,7 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -445,7 +445,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionResource.cs index 56db01f3bb7c..d8e037b35a7a 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionResource.cs @@ -101,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -141,7 +141,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -181,7 +181,7 @@ public virtual Response Get(C /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -223,7 +223,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -265,7 +265,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -313,7 +313,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingCollection.cs index 53b1a5b4fea4..c3dd97eecff4 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -113,7 +113,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -162,7 +162,7 @@ public virtual ArmOperation Cr /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -207,7 +207,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -252,7 +252,7 @@ public virtual Response Get(st /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -282,7 +282,7 @@ public virtual AsyncPageable G /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -312,7 +312,7 @@ public virtual Pageable GetAll /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -355,7 +355,7 @@ public virtual async Task> ExistsAsync(string trustedAccessRoleBi /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -398,7 +398,7 @@ public virtual Response Exists(string trustedAccessRoleBindingName, Cancel /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -443,7 +443,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingResource.cs index c31d699ddd30..3b45a39c40bf 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingResource.cs @@ -101,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -141,7 +141,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -181,7 +181,7 @@ public virtual Response Get(Ca /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -223,7 +223,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -265,7 +265,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -311,7 +311,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/ContainerServiceExtensions.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/ContainerServiceExtensions.cs index 9d4c114d8c6b..bf84e0069669 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/ContainerServiceExtensions.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/ContainerServiceExtensions.cs @@ -33,25 +33,6 @@ private static MockableContainerServiceSubscriptionResource GetMockableContainer return resource.GetCachedClient(client => new MockableContainerServiceSubscriptionResource(client, resource.Id)); } - /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// is null. - /// Returns a object. - public static OSOptionProfileResource GetOSOptionProfileResource(this ArmClient client, ResourceIdentifier id) - { - Argument.AssertNotNull(client, nameof(client)); - - return GetMockableContainerServiceArmClient(client).GetOSOptionProfileResource(id); - } - /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -242,6 +223,25 @@ public static ContainerServiceTrustedAccessRoleBindingResource GetContainerServi return GetMockableContainerServiceArmClient(client).GetContainerServiceTrustedAccessRoleBindingResource(id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static MachineResource GetMachineResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableContainerServiceArmClient(client).GetMachineResource(id); + } + /// /// Gets a collection of ContainerServiceManagedClusterResources in the ResourceGroupResource. /// @@ -272,7 +272,7 @@ public static ContainerServiceManagedClusterCollection GetContainerServiceManage /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -310,7 +310,7 @@ public static async Task> GetCo /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -365,7 +365,7 @@ public static AgentPoolSnapshotCollection GetAgentPoolSnapshots(this ResourceGro /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -403,7 +403,7 @@ public static async Task> GetAgentPoolSnapsh /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -459,7 +459,7 @@ public static MeshRevisionProfileCollection GetMeshRevisionProfiles(this Subscri /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -498,7 +498,7 @@ public static async Task> GetMeshRevisionP /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -537,7 +537,7 @@ public static Response GetMeshRevisionProfile(this /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// @@ -569,7 +569,7 @@ public static async Task> GetKubernetesVer /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// @@ -601,7 +601,7 @@ public static Response GetKubernetesVersionsManaged /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -637,7 +637,7 @@ public static AsyncPageable GetContainer /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -673,7 +673,7 @@ public static Pageable GetContainerServi /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -709,7 +709,7 @@ public static AsyncPageable GetAgentPoolSnapshotsAsyn /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -745,7 +745,7 @@ public static Pageable GetAgentPoolSnapshots(this Sub /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// @@ -778,7 +778,7 @@ public static AsyncPageable GetTrustedAccessR /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceArmClient.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceArmClient.cs index 480506346597..c0488cd604fa 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceArmClient.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceArmClient.cs @@ -34,18 +34,6 @@ private string GetApiVersionOrNull(ResourceType resourceType) return apiVersion; } - /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. - /// - /// The resource ID of the resource to get. - /// Returns a object. - public virtual OSOptionProfileResource GetOSOptionProfileResource(ResourceIdentifier id) - { - OSOptionProfileResource.ValidateResourceId(id); - return new OSOptionProfileResource(Client, id); - } - /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -165,5 +153,17 @@ public virtual ContainerServiceTrustedAccessRoleBindingResource GetContainerServ ContainerServiceTrustedAccessRoleBindingResource.ValidateResourceId(id); return new ContainerServiceTrustedAccessRoleBindingResource(Client, id); } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineResource GetMachineResource(ResourceIdentifier id) + { + MachineResource.ValidateResourceId(id); + return new MachineResource(Client, id); + } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceResourceGroupResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceResourceGroupResource.cs index c0fa202bd1ae..e17ea0a72bd5 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceResourceGroupResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceResourceGroupResource.cs @@ -53,7 +53,7 @@ public virtual ContainerServiceManagedClusterCollection GetContainerServiceManag /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -84,7 +84,7 @@ public virtual async Task> GetC /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -122,7 +122,7 @@ public virtual AgentPoolSnapshotCollection GetAgentPoolSnapshots() /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -153,7 +153,7 @@ public virtual async Task> GetAgentPoolSnaps /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceSubscriptionResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceSubscriptionResource.cs index fadc63f13095..63b2f8052c16 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceSubscriptionResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceSubscriptionResource.cs @@ -75,7 +75,7 @@ public virtual MeshRevisionProfileCollection GetMeshRevisionProfiles(AzureLocati /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -107,7 +107,7 @@ public virtual async Task> GetMeshRevision /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -139,7 +139,7 @@ public virtual Response GetMeshRevisionProfile(Azur /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// @@ -174,7 +174,7 @@ public virtual async Task> GetKubernetesVe /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// @@ -209,7 +209,7 @@ public virtual Response GetKubernetesVersionsManage /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -239,7 +239,7 @@ public virtual AsyncPageable GetContaine /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -269,7 +269,7 @@ public virtual Pageable GetContainerServ /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -299,7 +299,7 @@ public virtual AsyncPageable GetAgentPoolSnapshotsAsy /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -329,7 +329,7 @@ public virtual Pageable GetAgentPoolSnapshots(Cancell /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// @@ -356,7 +356,7 @@ public virtual AsyncPageable GetTrustedAccess /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MachineCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MachineCollection.cs new file mode 100644 index 000000000000..df0084364440 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MachineCollection.cs @@ -0,0 +1,395 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.ContainerService +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetMachines method from an instance of . + /// + public partial class MachineCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _machineClientDiagnostics; + private readonly MachinesRestOperations _machineRestClient; + + /// Initializes a new instance of the class for mocking. + protected MachineCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal MachineCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _machineClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", MachineResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(MachineResource.ResourceType, out string machineApiVersion); + _machineRestClient = new MachinesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, machineApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ContainerServiceAgentPoolResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ContainerServiceAgentPoolResource.ResourceType), nameof(id)); + } + + /// + /// Get a specific machine in the specified agent pool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/machines/{machineName} + /// + /// + /// Operation Id + /// Machines_Get + /// + /// + /// Default Api Version + /// 2025-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// host name of the machine. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string machineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(machineName, nameof(machineName)); + + using var scope = _machineClientDiagnostics.CreateScope("MachineCollection.Get"); + scope.Start(); + try + { + var response = await _machineRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, machineName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new MachineResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a specific machine in the specified agent pool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/machines/{machineName} + /// + /// + /// Operation Id + /// Machines_Get + /// + /// + /// Default Api Version + /// 2025-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// host name of the machine. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string machineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(machineName, nameof(machineName)); + + using var scope = _machineClientDiagnostics.CreateScope("MachineCollection.Get"); + scope.Start(); + try + { + var response = _machineRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, machineName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new MachineResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a list of machines in the specified agent pool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/machines + /// + /// + /// Operation Id + /// Machines_List + /// + /// + /// Default Api Version + /// 2025-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _machineRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _machineRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MachineResource(Client, MachineData.DeserializeMachineData(e)), _machineClientDiagnostics, Pipeline, "MachineCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of machines in the specified agent pool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/machines + /// + /// + /// Operation Id + /// Machines_List + /// + /// + /// Default Api Version + /// 2025-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _machineRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _machineRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MachineResource(Client, MachineData.DeserializeMachineData(e)), _machineClientDiagnostics, Pipeline, "MachineCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/machines/{machineName} + /// + /// + /// Operation Id + /// Machines_Get + /// + /// + /// Default Api Version + /// 2025-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// host name of the machine. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string machineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(machineName, nameof(machineName)); + + using var scope = _machineClientDiagnostics.CreateScope("MachineCollection.Exists"); + scope.Start(); + try + { + var response = await _machineRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, machineName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/machines/{machineName} + /// + /// + /// Operation Id + /// Machines_Get + /// + /// + /// Default Api Version + /// 2025-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// host name of the machine. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string machineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(machineName, nameof(machineName)); + + using var scope = _machineClientDiagnostics.CreateScope("MachineCollection.Exists"); + scope.Start(); + try + { + var response = _machineRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, machineName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/machines/{machineName} + /// + /// + /// Operation Id + /// Machines_Get + /// + /// + /// Default Api Version + /// 2025-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// host name of the machine. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string machineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(machineName, nameof(machineName)); + + using var scope = _machineClientDiagnostics.CreateScope("MachineCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _machineRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, machineName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/machines/{machineName} + /// + /// + /// Operation Id + /// Machines_Get + /// + /// + /// Default Api Version + /// 2025-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// host name of the machine. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string machineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(machineName, nameof(machineName)); + + using var scope = _machineClientDiagnostics.CreateScope("MachineCollection.GetIfExists"); + scope.Start(); + try + { + var response = _machineRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, machineName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MachineData.Serialization.cs similarity index 64% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileData.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MachineData.Serialization.cs index 216a133986e5..502cadc2171a 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileData.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MachineData.Serialization.cs @@ -8,7 +8,6 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Text.Json; using Azure.Core; @@ -17,11 +16,11 @@ namespace Azure.ResourceManager.ContainerService { - public partial class OSOptionProfileData : IUtf8JsonSerializable, IJsonModel + public partial class MachineData : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -32,38 +31,33 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri /// The client options for reading and writing models. protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(OSOptionProfileData)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(MachineData)} does not support writing '{format}' format."); } base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - writer.WritePropertyName("osOptionPropertyList"u8); - writer.WriteStartArray(); - foreach (var item in OSOptionPropertyList) + if (options.Format != "W" && Optional.IsDefined(Properties)) { - writer.WriteObjectValue(item, options); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - writer.WriteEndArray(); - writer.WriteEndObject(); } - OSOptionProfileData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + MachineData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(OSOptionProfileData)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(MachineData)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeOSOptionProfileData(document.RootElement, options); + return DeserializeMachineData(document.RootElement, options); } - internal static OSOptionProfileData DeserializeOSOptionProfileData(JsonElement element, ModelReaderWriterOptions options = null) + internal static MachineData DeserializeMachineData(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -71,15 +65,24 @@ internal static OSOptionProfileData DeserializeOSOptionProfileData(JsonElement e { return null; } + MachineProperties properties = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - IReadOnlyList osOptionPropertyList = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = MachineProperties.DeserializeMachineProperties(property.Value, options); + continue; + } if (property.NameEquals("id"u8)) { id = new ResourceIdentifier(property.Value.GetString()); @@ -104,40 +107,18 @@ internal static OSOptionProfileData DeserializeOSOptionProfileData(JsonElement e systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("osOptionPropertyList"u8)) - { - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(ContainerServiceOSOptionProperty.DeserializeContainerServiceOSOptionProperty(item, options)); - } - osOptionPropertyList = array; - continue; - } - } - continue; - } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new OSOptionProfileData( + return new MachineData( id, name, type, systemData, - osOptionPropertyList, + properties, serializedAdditionalRawData); } @@ -175,69 +156,58 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" id: "); + builder.Append(" properties: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(Id)) + if (Optional.IsDefined(Properties)) { - builder.Append(" id: "); - builder.AppendLine($"'{Id.ToString()}'"); + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" systemData: "); + builder.Append(" id: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(SystemData)) + if (Optional.IsDefined(Id)) { - builder.Append(" systemData: "); - builder.AppendLine($"'{SystemData.ToString()}'"); + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); } } - builder.Append(" properties:"); - builder.AppendLine(" {"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OSOptionPropertyList), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" osOptionPropertyList: "); + builder.Append(" systemData: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsCollectionDefined(OSOptionPropertyList)) + if (Optional.IsDefined(SystemData)) { - if (OSOptionPropertyList.Any()) - { - builder.Append(" osOptionPropertyList: "); - builder.AppendLine("["); - foreach (var item in OSOptionPropertyList) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 6, true, " osOptionPropertyList: "); - } - builder.AppendLine(" ]"); - } + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); } } - builder.AppendLine(" }"); builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { @@ -246,26 +216,26 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(OSOptionProfileData)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(MachineData)} does not support writing '{options.Format}' format."); } } - OSOptionProfileData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + MachineData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeOSOptionProfileData(document.RootElement, options); + return DeserializeMachineData(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(OSOptionProfileData)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(MachineData)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MachineData.cs similarity index 57% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileData.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MachineData.cs index 5fd0ccff4ad6..e9e90ff8d6d6 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileData.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MachineData.cs @@ -7,7 +7,6 @@ using System; using System.Collections.Generic; -using System.Linq; using Azure.Core; using Azure.ResourceManager.ContainerService.Models; using Azure.ResourceManager.Models; @@ -15,10 +14,10 @@ namespace Azure.ResourceManager.ContainerService { /// - /// A class representing the OSOptionProfile data model. - /// The OS option profile. + /// A class representing the Machine data model. + /// A machine. Contains details about the underlying virtual machine. A machine may be visible here but not in kubectl get nodes; if so it may be because the machine has not been registered with the Kubernetes API Server yet. /// - public partial class OSOptionProfileData : ResourceData + public partial class MachineData : ResourceData { /// /// Keeps track of any properties unknown to the library. @@ -52,36 +51,26 @@ public partial class OSOptionProfileData : ResourceData /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - /// The list of OS options. - /// is null. - internal OSOptionProfileData(IEnumerable osOptionPropertyList) + /// Initializes a new instance of . + public MachineData() { - Argument.AssertNotNull(osOptionPropertyList, nameof(osOptionPropertyList)); - - OSOptionPropertyList = osOptionPropertyList.ToList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// The list of OS options. + /// The properties of the machine. /// Keeps track of any properties unknown to the library. - internal OSOptionProfileData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IReadOnlyList osOptionPropertyList, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal MachineData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, MachineProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { - OSOptionPropertyList = osOptionPropertyList; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal OSOptionProfileData() - { - } - - /// The list of OS options. - [WirePath("properties.osOptionPropertyList")] - public IReadOnlyList OSOptionPropertyList { get; } + /// The properties of the machine. + [WirePath("properties")] + public MachineProperties Properties { get; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MachineResource.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MachineResource.Serialization.cs new file mode 100644 index 000000000000..53a1eacdb245 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MachineResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.ContainerService +{ + public partial class MachineResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + MachineData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + MachineData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MachineResource.cs similarity index 51% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileResource.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MachineResource.cs index bd4c8e6a8bb9..3538266d82a9 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MachineResource.cs @@ -11,56 +11,58 @@ using System.Threading.Tasks; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.ContainerService { /// - /// A Class representing an OSOptionProfile along with the instance operations that can be performed on it. - /// If you have a you can construct an - /// from an instance of using the GetOSOptionProfileResource method. - /// Otherwise you can get one from its parent resource using the GetOSOptionProfile method. + /// A Class representing a Machine along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetMachineResource method. + /// Otherwise you can get one from its parent resource using the GetMachine method. /// - public partial class OSOptionProfileResource : ArmResource + public partial class MachineResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. /// The subscriptionId. - /// The location. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location) + /// The resourceGroupName. + /// The resourceName. + /// The agentPoolName. + /// The machineName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, string machineName) { - var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"; + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/machines/{machineName}"; return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _osOptionProfileManagedClustersClientDiagnostics; - private readonly ManagedClustersRestOperations _osOptionProfileManagedClustersRestClient; - private readonly OSOptionProfileData _data; + private readonly ClientDiagnostics _machineClientDiagnostics; + private readonly MachinesRestOperations _machineRestClient; + private readonly MachineData _data; /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.ContainerService/locations/osOptions"; + public static readonly ResourceType ResourceType = "Microsoft.ContainerService/managedClusters/agentPools/machines"; - /// Initializes a new instance of the class for mocking. - protected OSOptionProfileResource() + /// Initializes a new instance of the class for mocking. + protected MachineResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal OSOptionProfileResource(ArmClient client, OSOptionProfileData data) : this(client, data.Id) + internal MachineResource(ArmClient client, MachineData data) : this(client, data.Id) { HasData = true; _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - internal OSOptionProfileResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal MachineResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _osOptionProfileManagedClustersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string osOptionProfileManagedClustersApiVersion); - _osOptionProfileManagedClustersRestClient = new ManagedClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, osOptionProfileManagedClustersApiVersion); + _machineClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string machineApiVersion); + _machineRestClient = new MachinesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, machineApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -71,7 +73,7 @@ internal OSOptionProfileResource(ArmClient client, ResourceIdentifier id) : base /// Gets the data representing this Feature. /// Throws if there is no data loaded in the current instance. - public virtual OSOptionProfileData Data + public virtual MachineData Data { get { @@ -88,38 +90,37 @@ internal static void ValidateResourceId(ResourceIdentifier id) } /// - /// Gets supported OS options in the specified subscription. + /// Get a specific machine in the specified agent pool. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/machines/{machineName} /// /// /// Operation Id - /// ManagedClusters_GetOSOptions + /// Machines_Get /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource - /// + /// /// /// /// - /// The resource type for which the OS options needs to be returned. /// The cancellation token to use. - public virtual async Task> GetAsync(ResourceType? resourceType = null, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _osOptionProfileManagedClustersClientDiagnostics.CreateScope("OSOptionProfileResource.Get"); + using var scope = _machineClientDiagnostics.CreateScope("MachineResource.Get"); scope.Start(); try { - var response = await _osOptionProfileManagedClustersRestClient.GetOSOptionsAsync(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), resourceType, cancellationToken).ConfigureAwait(false); + var response = await _machineRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new OSOptionProfileResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new MachineResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -129,38 +130,37 @@ public virtual async Task> GetAsync(ResourceTy } /// - /// Gets supported OS options in the specified subscription. + /// Get a specific machine in the specified agent pool. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/machines/{machineName} /// /// /// Operation Id - /// ManagedClusters_GetOSOptions + /// Machines_Get /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource - /// + /// /// /// /// - /// The resource type for which the OS options needs to be returned. /// The cancellation token to use. - public virtual Response Get(ResourceType? resourceType = null, CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _osOptionProfileManagedClustersClientDiagnostics.CreateScope("OSOptionProfileResource.Get"); + using var scope = _machineClientDiagnostics.CreateScope("MachineResource.Get"); scope.Start(); try { - var response = _osOptionProfileManagedClustersRestClient.GetOSOptions(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), resourceType, cancellationToken); + var response = _machineRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new OSOptionProfileResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new MachineResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterUpgradeProfileResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterUpgradeProfileResource.cs index ae15f4b29f21..fb15674cfe9d 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterUpgradeProfileResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterUpgradeProfileResource.cs @@ -100,7 +100,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -140,7 +140,7 @@ public virtual async Task> GetAsy /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshRevisionProfileCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshRevisionProfileCollection.cs index 73f52e619891..2dcc1c889b1a 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshRevisionProfileCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshRevisionProfileCollection.cs @@ -68,7 +68,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -113,7 +113,7 @@ public virtual async Task> GetAsync(string /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -158,7 +158,7 @@ public virtual Response Get(string mode, Cancellati /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -188,7 +188,7 @@ public virtual AsyncPageable GetAllAsync(Cancellati /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -218,7 +218,7 @@ public virtual Pageable GetAll(CancellationToken ca /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -261,7 +261,7 @@ public virtual async Task> ExistsAsync(string mode, CancellationT /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -304,7 +304,7 @@ public virtual Response Exists(string mode, CancellationToken cancellation /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -349,7 +349,7 @@ public virtual async Task> GetIfEx /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshRevisionProfileResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshRevisionProfileResource.cs index 349a3898fb10..5250fce3a09e 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshRevisionProfileResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshRevisionProfileResource.cs @@ -101,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -141,7 +141,7 @@ public virtual async Task> GetAsync(Cancel /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshUpgradeProfileCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshUpgradeProfileCollection.cs index c9c2c819a366..7db71558b2b5 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshUpgradeProfileCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshUpgradeProfileCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -109,7 +109,7 @@ public virtual async Task> GetAsync(string /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -154,7 +154,7 @@ public virtual Response Get(string mode, Cancellatio /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -184,7 +184,7 @@ public virtual AsyncPageable GetAllAsync(Cancellatio /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -214,7 +214,7 @@ public virtual Pageable GetAll(CancellationToken can /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -257,7 +257,7 @@ public virtual async Task> ExistsAsync(string mode, CancellationT /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -300,7 +300,7 @@ public virtual Response Exists(string mode, CancellationToken cancellation /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -345,7 +345,7 @@ public virtual async Task> GetIfExi /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshUpgradeProfileResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshUpgradeProfileResource.cs index 84cce4083213..087b28899119 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshUpgradeProfileResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshUpgradeProfileResource.cs @@ -101,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource @@ -141,7 +141,7 @@ public virtual async Task> GetAsync(Cancell /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-01-01 /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworking.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworking.Serialization.cs new file mode 100644 index 000000000000..235fda273718 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworking.Serialization.cs @@ -0,0 +1,233 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class AdvancedNetworking : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AdvancedNetworking)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } + if (Optional.IsDefined(Observability)) + { + writer.WritePropertyName("observability"u8); + writer.WriteObjectValue(Observability, options); + } + if (Optional.IsDefined(Security)) + { + writer.WritePropertyName("security"u8); + writer.WriteObjectValue(Security, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AdvancedNetworking IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AdvancedNetworking)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAdvancedNetworking(document.RootElement, options); + } + + internal static AdvancedNetworking DeserializeAdvancedNetworking(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? enabled = default; + AdvancedNetworkingObservability observability = default; + AdvancedNetworkingSecurity security = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("observability"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + observability = AdvancedNetworkingObservability.DeserializeAdvancedNetworkingObservability(property.Value, options); + continue; + } + if (property.NameEquals("security"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + security = AdvancedNetworkingSecurity.DeserializeAdvancedNetworkingSecurity(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AdvancedNetworking(enabled, observability, security, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Enabled), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Enabled)) + { + builder.Append(" enabled: "); + var boolValue = Enabled.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("ObservabilityEnabled", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" observability: "); + builder.AppendLine("{"); + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(Observability)) + { + builder.Append(" observability: "); + BicepSerializationHelpers.AppendChildObject(builder, Observability, options, 2, false, " observability: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("SecurityEnabled", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" security: "); + builder.AppendLine("{"); + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(Security)) + { + builder.Append(" security: "); + BicepSerializationHelpers.AppendChildObject(builder, Security, options, 2, false, " security: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(AdvancedNetworking)} does not support writing '{options.Format}' format."); + } + } + + AdvancedNetworking IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAdvancedNetworking(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AdvancedNetworking)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworking.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworking.cs new file mode 100644 index 000000000000..0b5ddf543d3b --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworking.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Advanced Networking profile for enabling observability and security feature suite on a cluster. For more information see aka.ms/aksadvancednetworking. + public partial class AdvancedNetworking + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public AdvancedNetworking() + { + } + + /// Initializes a new instance of . + /// Indicates the enablement of Advanced Networking functionalities of observability and security on AKS clusters. When this is set to true, all observability and security features will be set to enabled unless explicitly disabled. If not specified, the default is false. + /// Observability profile to enable advanced network metrics and flow logs with historical contexts. + /// Security profile to enable security features on cilium based cluster. + /// Keeps track of any properties unknown to the library. + internal AdvancedNetworking(bool? enabled, AdvancedNetworkingObservability observability, AdvancedNetworkingSecurity security, IDictionary serializedAdditionalRawData) + { + Enabled = enabled; + Observability = observability; + Security = security; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Indicates the enablement of Advanced Networking functionalities of observability and security on AKS clusters. When this is set to true, all observability and security features will be set to enabled unless explicitly disabled. If not specified, the default is false. + [WirePath("enabled")] + public bool? Enabled { get; set; } + /// Observability profile to enable advanced network metrics and flow logs with historical contexts. + internal AdvancedNetworkingObservability Observability { get; set; } + /// Indicates the enablement of Advanced Networking observability functionalities on clusters. + [WirePath("observability.enabled")] + public bool? ObservabilityEnabled + { + get => Observability is null ? default : Observability.Enabled; + set + { + if (Observability is null) + Observability = new AdvancedNetworkingObservability(); + Observability.Enabled = value; + } + } + + /// Security profile to enable security features on cilium based cluster. + internal AdvancedNetworkingSecurity Security { get; set; } + /// This feature allows user to configure network policy based on DNS (FQDN) names. It can be enabled only on cilium based clusters. If not specified, the default is false. + [WirePath("security.enabled")] + public bool? SecurityEnabled + { + get => Security is null ? default : Security.Enabled; + set + { + if (Security is null) + Security = new AdvancedNetworkingSecurity(); + Security.Enabled = value; + } + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworkingObservability.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworkingObservability.Serialization.cs new file mode 100644 index 000000000000..fc7c006cbd3f --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworkingObservability.Serialization.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class AdvancedNetworkingObservability : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AdvancedNetworkingObservability)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AdvancedNetworkingObservability IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AdvancedNetworkingObservability)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAdvancedNetworkingObservability(document.RootElement, options); + } + + internal static AdvancedNetworkingObservability DeserializeAdvancedNetworkingObservability(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? enabled = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AdvancedNetworkingObservability(enabled, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Enabled), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Enabled)) + { + builder.Append(" enabled: "); + var boolValue = Enabled.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(AdvancedNetworkingObservability)} does not support writing '{options.Format}' format."); + } + } + + AdvancedNetworkingObservability IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAdvancedNetworkingObservability(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AdvancedNetworkingObservability)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworkingObservability.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworkingObservability.cs new file mode 100644 index 000000000000..0a21cd603df1 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworkingObservability.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Observability profile to enable advanced network metrics and flow logs with historical contexts. + internal partial class AdvancedNetworkingObservability + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public AdvancedNetworkingObservability() + { + } + + /// Initializes a new instance of . + /// Indicates the enablement of Advanced Networking observability functionalities on clusters. + /// Keeps track of any properties unknown to the library. + internal AdvancedNetworkingObservability(bool? enabled, IDictionary serializedAdditionalRawData) + { + Enabled = enabled; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Indicates the enablement of Advanced Networking observability functionalities on clusters. + [WirePath("enabled")] + public bool? Enabled { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworkingSecurity.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworkingSecurity.Serialization.cs new file mode 100644 index 000000000000..09cf551a6cd1 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworkingSecurity.Serialization.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class AdvancedNetworkingSecurity : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AdvancedNetworkingSecurity)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AdvancedNetworkingSecurity IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AdvancedNetworkingSecurity)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAdvancedNetworkingSecurity(document.RootElement, options); + } + + internal static AdvancedNetworkingSecurity DeserializeAdvancedNetworkingSecurity(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? enabled = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AdvancedNetworkingSecurity(enabled, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Enabled), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Enabled)) + { + builder.Append(" enabled: "); + var boolValue = Enabled.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(AdvancedNetworkingSecurity)} does not support writing '{options.Format}' format."); + } + } + + AdvancedNetworkingSecurity IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAdvancedNetworkingSecurity(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AdvancedNetworkingSecurity)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworkingSecurity.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworkingSecurity.cs new file mode 100644 index 000000000000..aba4e57922b4 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworkingSecurity.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Security profile to enable security features on cilium based cluster. + internal partial class AdvancedNetworkingSecurity + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public AdvancedNetworkingSecurity() + { + } + + /// Initializes a new instance of . + /// This feature allows user to configure network policy based on DNS (FQDN) names. It can be enabled only on cilium based clusters. If not specified, the default is false. + /// Keeps track of any properties unknown to the library. + internal AdvancedNetworkingSecurity(bool? enabled, IDictionary serializedAdditionalRawData) + { + Enabled = enabled; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// This feature allows user to configure network policy based on DNS (FQDN) names. It can be enabled only on cilium based clusters. If not specified, the default is false. + [WirePath("enabled")] + public bool? Enabled { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolDeleteMachinesParameter.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolDeleteMachinesParameter.Serialization.cs new file mode 100644 index 000000000000..d6a76040c03e --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolDeleteMachinesParameter.Serialization.cs @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class AgentPoolDeleteMachinesParameter : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AgentPoolDeleteMachinesParameter)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("machineNames"u8); + writer.WriteStartArray(); + foreach (var item in MachineNames) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AgentPoolDeleteMachinesParameter IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AgentPoolDeleteMachinesParameter)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAgentPoolDeleteMachinesParameter(document.RootElement, options); + } + + internal static AgentPoolDeleteMachinesParameter DeserializeAgentPoolDeleteMachinesParameter(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList machineNames = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("machineNames"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + machineNames = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AgentPoolDeleteMachinesParameter(machineNames, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AgentPoolDeleteMachinesParameter)} does not support writing '{options.Format}' format."); + } + } + + AgentPoolDeleteMachinesParameter IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAgentPoolDeleteMachinesParameter(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AgentPoolDeleteMachinesParameter)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSOptionProperty.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolDeleteMachinesParameter.cs similarity index 55% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSOptionProperty.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolDeleteMachinesParameter.cs index 38edc7fbc43c..8a2f8c563cac 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSOptionProperty.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolDeleteMachinesParameter.cs @@ -7,11 +7,12 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.ContainerService.Models { - /// OS option property. - public partial class ContainerServiceOSOptionProperty + /// Specifies a list of machine names from the agent pool to be deleted. + public partial class AgentPoolDeleteMachinesParameter { /// /// Keeps track of any properties unknown to the library. @@ -45,39 +46,32 @@ public partial class ContainerServiceOSOptionProperty /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - /// The OS type. - /// Whether the image is FIPS-enabled. - /// is null. - internal ContainerServiceOSOptionProperty(string osType, bool enableFipsImage) + /// Initializes a new instance of . + /// The agent pool machine names. + /// is null. + public AgentPoolDeleteMachinesParameter(IEnumerable machineNames) { - Argument.AssertNotNull(osType, nameof(osType)); + Argument.AssertNotNull(machineNames, nameof(machineNames)); - OSType = osType; - EnableFipsImage = enableFipsImage; + MachineNames = machineNames.ToList(); } - /// Initializes a new instance of . - /// The OS type. - /// Whether the image is FIPS-enabled. + /// Initializes a new instance of . + /// The agent pool machine names. /// Keeps track of any properties unknown to the library. - internal ContainerServiceOSOptionProperty(string osType, bool enableFipsImage, IDictionary serializedAdditionalRawData) + internal AgentPoolDeleteMachinesParameter(IList machineNames, IDictionary serializedAdditionalRawData) { - OSType = osType; - EnableFipsImage = enableFipsImage; + MachineNames = machineNames; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal ContainerServiceOSOptionProperty() + /// Initializes a new instance of for deserialization. + internal AgentPoolDeleteMachinesParameter() { } - /// The OS type. - [WirePath("os-type")] - public string OSType { get; } - /// Whether the image is FIPS-enabled. - [WirePath("enable-fips-image")] - public bool EnableFipsImage { get; } + /// The agent pool machine names. + [WirePath("machineNames")] + public IList MachineNames { get; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolSecurityProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolSecurityProfile.Serialization.cs new file mode 100644 index 000000000000..a09582c31b6c --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolSecurityProfile.Serialization.cs @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class AgentPoolSecurityProfile : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AgentPoolSecurityProfile)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(EnableVtpm)) + { + writer.WritePropertyName("enableVTPM"u8); + writer.WriteBooleanValue(EnableVtpm.Value); + } + if (Optional.IsDefined(EnableSecureBoot)) + { + writer.WritePropertyName("enableSecureBoot"u8); + writer.WriteBooleanValue(EnableSecureBoot.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AgentPoolSecurityProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AgentPoolSecurityProfile)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAgentPoolSecurityProfile(document.RootElement, options); + } + + internal static AgentPoolSecurityProfile DeserializeAgentPoolSecurityProfile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? enableVTPM = default; + bool? enableSecureBoot = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enableVTPM"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enableVTPM = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("enableSecureBoot"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enableSecureBoot = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AgentPoolSecurityProfile(enableVTPM, enableSecureBoot, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnableVtpm), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enableVTPM: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(EnableVtpm)) + { + builder.Append(" enableVTPM: "); + var boolValue = EnableVtpm.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnableSecureBoot), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enableSecureBoot: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(EnableSecureBoot)) + { + builder.Append(" enableSecureBoot: "); + var boolValue = EnableSecureBoot.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(AgentPoolSecurityProfile)} does not support writing '{options.Format}' format."); + } + } + + AgentPoolSecurityProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAgentPoolSecurityProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AgentPoolSecurityProfile)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolSecurityProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolSecurityProfile.cs new file mode 100644 index 000000000000..058d79bbaef3 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolSecurityProfile.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The security settings of an agent pool. + public partial class AgentPoolSecurityProfile + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public AgentPoolSecurityProfile() + { + } + + /// Initializes a new instance of . + /// vTPM is a Trusted Launch feature for configuring a dedicated secure vault for keys and measurements held locally on the node. For more details, see aka.ms/aks/trustedlaunch. If not specified, the default is false. + /// Secure Boot is a feature of Trusted Launch which ensures that only signed operating systems and drivers can boot. For more details, see aka.ms/aks/trustedlaunch. If not specified, the default is false. + /// Keeps track of any properties unknown to the library. + internal AgentPoolSecurityProfile(bool? enableVtpm, bool? enableSecureBoot, IDictionary serializedAdditionalRawData) + { + EnableVtpm = enableVtpm; + EnableSecureBoot = enableSecureBoot; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// vTPM is a Trusted Launch feature for configuring a dedicated secure vault for keys and measurements held locally on the node. For more details, see aka.ms/aks/trustedlaunch. If not specified, the default is false. + [WirePath("enableVTPM")] + public bool? EnableVtpm { get; set; } + /// Secure Boot is a feature of Trusted Launch which ensures that only signed operating systems and drivers can boot. For more details, see aka.ms/aks/trustedlaunch. If not specified, the default is false. + [WirePath("enableSecureBoot")] + public bool? EnableSecureBoot { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeSettings.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeSettings.Serialization.cs index ea26983918b6..14f215362cf0 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeSettings.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeSettings.Serialization.cs @@ -45,6 +45,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("drainTimeoutInMinutes"u8); writer.WriteNumberValue(DrainTimeoutInMinutes.Value); } + if (Optional.IsDefined(NodeSoakDurationInMinutes)) + { + writer.WritePropertyName("nodeSoakDurationInMinutes"u8); + writer.WriteNumberValue(NodeSoakDurationInMinutes.Value); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -84,6 +89,7 @@ internal static AgentPoolUpgradeSettings DeserializeAgentPoolUpgradeSettings(Jso } string maxSurge = default; int? drainTimeoutInMinutes = default; + int? nodeSoakDurationInMinutes = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -102,13 +108,22 @@ internal static AgentPoolUpgradeSettings DeserializeAgentPoolUpgradeSettings(Jso drainTimeoutInMinutes = property.Value.GetInt32(); continue; } + if (property.NameEquals("nodeSoakDurationInMinutes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nodeSoakDurationInMinutes = property.Value.GetInt32(); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new AgentPoolUpgradeSettings(maxSurge, drainTimeoutInMinutes, serializedAdditionalRawData); + return new AgentPoolUpgradeSettings(maxSurge, drainTimeoutInMinutes, nodeSoakDurationInMinutes, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -160,6 +175,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NodeSoakDurationInMinutes), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nodeSoakDurationInMinutes: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NodeSoakDurationInMinutes)) + { + builder.Append(" nodeSoakDurationInMinutes: "); + builder.AppendLine($"{NodeSoakDurationInMinutes.Value}"); + } + } + builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeSettings.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeSettings.cs index a57cb99ed6af..4c9d861b9407 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeSettings.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeSettings.cs @@ -51,21 +51,26 @@ public AgentPoolUpgradeSettings() } /// Initializes a new instance of . - /// This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the time of the upgrade. For percentages, fractional nodes are rounded up. If not specified, the default is 1. For more information, including best practices, see: https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade. + /// This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the time of the upgrade. For percentages, fractional nodes are rounded up. If not specified, the default is 10%. For more information, including best practices, see: https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade. /// The amount of time (in minutes) to wait on eviction of pods and graceful termination per node. This eviction wait time honors waiting on pod disruption budgets. If this time is exceeded, the upgrade fails. If not specified, the default is 30 minutes. + /// The amount of time (in minutes) to wait after draining a node and before reimaging it and moving on to next node. If not specified, the default is 0 minutes. /// Keeps track of any properties unknown to the library. - internal AgentPoolUpgradeSettings(string maxSurge, int? drainTimeoutInMinutes, IDictionary serializedAdditionalRawData) + internal AgentPoolUpgradeSettings(string maxSurge, int? drainTimeoutInMinutes, int? nodeSoakDurationInMinutes, IDictionary serializedAdditionalRawData) { MaxSurge = maxSurge; DrainTimeoutInMinutes = drainTimeoutInMinutes; + NodeSoakDurationInMinutes = nodeSoakDurationInMinutes; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the time of the upgrade. For percentages, fractional nodes are rounded up. If not specified, the default is 1. For more information, including best practices, see: https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade. + /// This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the time of the upgrade. For percentages, fractional nodes are rounded up. If not specified, the default is 10%. For more information, including best practices, see: https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade. [WirePath("maxSurge")] public string MaxSurge { get; set; } /// The amount of time (in minutes) to wait on eviction of pods and graceful termination per node. This eviction wait time honors waiting on pod disruption budgets. If this time is exceeded, the upgrade fails. If not specified, the default is 30 minutes. [WirePath("drainTimeoutInMinutes")] public int? DrainTimeoutInMinutes { get; set; } + /// The amount of time (in minutes) to wait after draining a node and before reimaging it and moving on to next node. If not specified, the default is 0 minutes. + [WirePath("nodeSoakDurationInMinutes")] + public int? NodeSoakDurationInMinutes { get; set; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolWindowsProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolWindowsProfile.Serialization.cs new file mode 100644 index 000000000000..d1a9aa60ca8f --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolWindowsProfile.Serialization.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class AgentPoolWindowsProfile : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AgentPoolWindowsProfile)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(DisableOutboundNat)) + { + writer.WritePropertyName("disableOutboundNat"u8); + writer.WriteBooleanValue(DisableOutboundNat.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AgentPoolWindowsProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AgentPoolWindowsProfile)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAgentPoolWindowsProfile(document.RootElement, options); + } + + internal static AgentPoolWindowsProfile DeserializeAgentPoolWindowsProfile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? disableOutboundNat = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("disableOutboundNat"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + disableOutboundNat = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AgentPoolWindowsProfile(disableOutboundNat, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DisableOutboundNat), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" disableOutboundNat: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DisableOutboundNat)) + { + builder.Append(" disableOutboundNat: "); + var boolValue = DisableOutboundNat.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(AgentPoolWindowsProfile)} does not support writing '{options.Format}' format."); + } + } + + AgentPoolWindowsProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAgentPoolWindowsProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AgentPoolWindowsProfile)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolWindowsProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolWindowsProfile.cs new file mode 100644 index 000000000000..f22bc75ada64 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolWindowsProfile.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The Windows agent pool's specific profile. + internal partial class AgentPoolWindowsProfile + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public AgentPoolWindowsProfile() + { + } + + /// Initializes a new instance of . + /// The default value is false. Outbound NAT can only be disabled if the cluster outboundType is NAT Gateway and the Windows agent pool does not have node public IP enabled. + /// Keeps track of any properties unknown to the library. + internal AgentPoolWindowsProfile(bool? disableOutboundNat, IDictionary serializedAdditionalRawData) + { + DisableOutboundNat = disableOutboundNat; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The default value is false. Outbound NAT can only be disabled if the cluster outboundType is NAT Gateway and the Windows agent pool does not have node public IP enabled. + [WirePath("disableOutboundNat")] + public bool? DisableOutboundNat { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ArtifactSource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ArtifactSource.cs new file mode 100644 index 000000000000..5b31f994f257 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ArtifactSource.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The source where the artifacts are downloaded from. + public readonly partial struct ArtifactSource : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ArtifactSource(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CacheValue = "Cache"; + private const string DirectValue = "Direct"; + + /// pull images from Azure Container Registry with cache. + public static ArtifactSource Cache { get; } = new ArtifactSource(CacheValue); + /// pull images from Microsoft Artifact Registry. + public static ArtifactSource Direct { get; } = new ArtifactSource(DirectValue); + /// Determines if two values are the same. + public static bool operator ==(ArtifactSource left, ArtifactSource right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ArtifactSource left, ArtifactSource right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ArtifactSource(string value) => new ArtifactSource(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ArtifactSource other && Equals(other); + /// + public bool Equals(ArtifactSource other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkPolicy.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkPolicy.cs index 1c5d4ee4d4a2..def12ed901ee 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkPolicy.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkPolicy.cs @@ -22,10 +22,13 @@ public ContainerServiceNetworkPolicy(string value) _value = value ?? throw new ArgumentNullException(nameof(value)); } + private const string NoneValue = "none"; private const string CalicoValue = "calico"; private const string AzureValue = "azure"; private const string CiliumValue = "cilium"; + /// Network policies will not be enforced. This is the default value when NetworkPolicy is not specified. + public static ContainerServiceNetworkPolicy None { get; } = new ContainerServiceNetworkPolicy(NoneValue); /// Use Calico network policies. See [differences between Azure and Calico policies](https://docs.microsoft.com/azure/aks/use-network-policies#differences-between-azure-and-calico-policies-and-their-capabilities) for more information. public static ContainerServiceNetworkPolicy Calico { get; } = new ContainerServiceNetworkPolicy(CalicoValue); /// Use Azure network policies. See [differences between Azure and Calico policies](https://docs.microsoft.com/azure/aks/use-network-policies#differences-between-azure-and-calico-policies-and-their-capabilities) for more information. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.Serialization.cs index 8c7481f491f7..48b5fa536234 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.Serialization.cs @@ -61,6 +61,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("networkDataplane"u8); writer.WriteStringValue(NetworkDataplane.Value.ToString()); } + if (Optional.IsDefined(AdvancedNetworking)) + { + writer.WritePropertyName("advancedNetworking"u8); + writer.WriteObjectValue(AdvancedNetworking, options); + } if (Optional.IsDefined(PodCidr)) { writer.WritePropertyName("podCidr"u8); @@ -168,6 +173,7 @@ internal static ContainerServiceNetworkProfile DeserializeContainerServiceNetwor ContainerServiceNetworkPolicy? networkPolicy = default; ContainerServiceNetworkMode? networkMode = default; NetworkDataplane? networkDataplane = default; + AdvancedNetworking advancedNetworking = default; string podCidr = default; string serviceCidr = default; string dnsServiceIP = default; @@ -227,6 +233,15 @@ internal static ContainerServiceNetworkProfile DeserializeContainerServiceNetwor networkDataplane = new NetworkDataplane(property.Value.GetString()); continue; } + if (property.NameEquals("advancedNetworking"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + advancedNetworking = AdvancedNetworking.DeserializeAdvancedNetworking(property.Value, options); + continue; + } if (property.NameEquals("podCidr"u8)) { podCidr = property.Value.GetString(); @@ -332,6 +347,7 @@ internal static ContainerServiceNetworkProfile DeserializeContainerServiceNetwor networkPolicy, networkMode, networkDataplane, + advancedNetworking, podCidr, serviceCidr, dnsServiceIP, @@ -431,6 +447,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AdvancedNetworking), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" advancedNetworking: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AdvancedNetworking)) + { + builder.Append(" advancedNetworking: "); + BicepSerializationHelpers.AppendChildObject(builder, AdvancedNetworking, options, 2, false, " advancedNetworking: "); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PodCidr), out propertyOverride); if (hasPropertyOverride) { diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs index 81d5eb5c1e36..ca25b5e02ba0 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs @@ -59,6 +59,7 @@ public ContainerServiceNetworkProfile() /// Network policy used for building the Kubernetes network. /// This cannot be specified if networkPlugin is anything other than 'azure'. /// Network dataplane used in the Kubernetes cluster. + /// Advanced Networking profile for enabling observability and security feature suite on a cluster. For more information see aka.ms/aksadvancednetworking. /// A CIDR notation IP range from which to assign pod IPs when kubenet is used. /// A CIDR notation IP range from which to assign service cluster IPs. It must not overlap with any Subnet IP ranges. /// An IP address assigned to the Kubernetes DNS service. It must be within the Kubernetes service address range specified in serviceCidr. @@ -70,13 +71,14 @@ public ContainerServiceNetworkProfile() /// One IPv4 CIDR is expected for single-stack networking. Two CIDRs, one for each IP family (IPv4/IPv6), is expected for dual-stack networking. They must not overlap with any Subnet IP ranges. /// IP families are used to determine single-stack or dual-stack clusters. For single-stack, the expected value is IPv4. For dual-stack, the expected values are IPv4 and IPv6. /// Keeps track of any properties unknown to the library. - internal ContainerServiceNetworkProfile(ContainerServiceNetworkPlugin? networkPlugin, ContainerServiceNetworkPluginMode? networkPluginMode, ContainerServiceNetworkPolicy? networkPolicy, ContainerServiceNetworkMode? networkMode, NetworkDataplane? networkDataplane, string podCidr, string serviceCidr, string dnsServiceIP, ContainerServiceOutboundType? outboundType, ContainerServiceLoadBalancerSku? loadBalancerSku, ManagedClusterLoadBalancerProfile loadBalancerProfile, ManagedClusterNatGatewayProfile natGatewayProfile, IList podCidrs, IList serviceCidrs, IList ipFamilies, IDictionary serializedAdditionalRawData) + internal ContainerServiceNetworkProfile(ContainerServiceNetworkPlugin? networkPlugin, ContainerServiceNetworkPluginMode? networkPluginMode, ContainerServiceNetworkPolicy? networkPolicy, ContainerServiceNetworkMode? networkMode, NetworkDataplane? networkDataplane, AdvancedNetworking advancedNetworking, string podCidr, string serviceCidr, string dnsServiceIP, ContainerServiceOutboundType? outboundType, ContainerServiceLoadBalancerSku? loadBalancerSku, ManagedClusterLoadBalancerProfile loadBalancerProfile, ManagedClusterNatGatewayProfile natGatewayProfile, IList podCidrs, IList serviceCidrs, IList ipFamilies, IDictionary serializedAdditionalRawData) { NetworkPlugin = networkPlugin; NetworkPluginMode = networkPluginMode; NetworkPolicy = networkPolicy; NetworkMode = networkMode; NetworkDataplane = networkDataplane; + AdvancedNetworking = advancedNetworking; PodCidr = podCidr; ServiceCidr = serviceCidr; DnsServiceIP = dnsServiceIP; @@ -105,6 +107,9 @@ internal ContainerServiceNetworkProfile(ContainerServiceNetworkPlugin? networkPl /// Network dataplane used in the Kubernetes cluster. [WirePath("networkDataplane")] public NetworkDataplane? NetworkDataplane { get; set; } + /// Advanced Networking profile for enabling observability and security feature suite on a cluster. For more information see aka.ms/aksadvancednetworking. + [WirePath("advancedNetworking")] + public AdvancedNetworking AdvancedNetworking { get; set; } /// A CIDR notation IP range from which to assign pod IPs when kubenet is used. [WirePath("podCidr")] public string PodCidr { get; set; } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOutboundType.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOutboundType.cs index 83a57bc5aa79..a606c6aa7f91 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOutboundType.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOutboundType.cs @@ -26,6 +26,7 @@ public ContainerServiceOutboundType(string value) private const string UserDefinedRoutingValue = "userDefinedRouting"; private const string ManagedNatGatewayValue = "managedNATGateway"; private const string UserAssignedNatGatewayValue = "userAssignedNATGateway"; + private const string NoneValue = "none"; /// The load balancer is used for egress through an AKS assigned public IP. This supports Kubernetes services of type 'loadBalancer'. For more information see [outbound type loadbalancer](https://docs.microsoft.com/azure/aks/egress-outboundtype#outbound-type-of-loadbalancer). public static ContainerServiceOutboundType LoadBalancer { get; } = new ContainerServiceOutboundType(LoadBalancerValue); @@ -35,6 +36,8 @@ public ContainerServiceOutboundType(string value) public static ContainerServiceOutboundType ManagedNatGateway { get; } = new ContainerServiceOutboundType(ManagedNatGatewayValue); /// The user-assigned NAT gateway associated to the cluster subnet is used for egress. This is an advanced scenario and requires proper network configuration. public static ContainerServiceOutboundType UserAssignedNatGateway { get; } = new ContainerServiceOutboundType(UserAssignedNatGatewayValue); + /// The AKS cluster is not set with any outbound-type. All AKS nodes follows Azure VM default outbound behavior. Please refer to https://azure.microsoft.com/en-us/updates/default-outbound-access-for-vms-in-azure-will-be-retired-transition-to-a-new-method-of-internet-access/. + public static ContainerServiceOutboundType None { get; } = new ContainerServiceOutboundType(NoneValue); /// Determines if two values are the same. public static bool operator ==(ContainerServiceOutboundType left, ContainerServiceOutboundType right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GpuDriver.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GpuDriver.cs new file mode 100644 index 000000000000..6a93ccd8a853 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GpuDriver.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Whether to install GPU drivers. When it's not specified, default is Install. + public readonly partial struct GpuDriver : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public GpuDriver(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InstallValue = "Install"; + private const string NoneValue = "None"; + + /// Install driver. + public static GpuDriver Install { get; } = new GpuDriver(InstallValue); + /// Skip driver install. + public static GpuDriver None { get; } = new GpuDriver(NoneValue); + /// Determines if two values are the same. + public static bool operator ==(GpuDriver left, GpuDriver right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(GpuDriver left, GpuDriver right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator GpuDriver(string value) => new GpuDriver(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is GpuDriver other && Equals(other); + /// + public bool Equals(GpuDriver other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GpuProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GpuProfile.Serialization.cs new file mode 100644 index 000000000000..74573e82aa61 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GpuProfile.Serialization.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class GpuProfile : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GpuProfile)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Driver)) + { + writer.WritePropertyName("driver"u8); + writer.WriteStringValue(Driver.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + GpuProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GpuProfile)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGpuProfile(document.RootElement, options); + } + + internal static GpuProfile DeserializeGpuProfile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + GpuDriver? driver = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("driver"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + driver = new GpuDriver(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GpuProfile(driver, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Driver), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" driver: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Driver)) + { + builder.Append(" driver: "); + builder.AppendLine($"'{Driver.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(GpuProfile)} does not support writing '{options.Format}' format."); + } + } + + GpuProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeGpuProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GpuProfile)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GpuProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GpuProfile.cs new file mode 100644 index 000000000000..34bfdd1823c8 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GpuProfile.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// GPU settings for the Agent Pool. + internal partial class GpuProfile + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public GpuProfile() + { + } + + /// Initializes a new instance of . + /// Whether to install GPU drivers. When it's not specified, default is Install. + /// Keeps track of any properties unknown to the library. + internal GpuProfile(GpuDriver? driver, IDictionary serializedAdditionalRawData) + { + Driver = driver; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Whether to install GPU drivers. When it's not specified, default is Install. + [WirePath("driver")] + public GpuDriver? Driver { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioEgressGateway.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioEgressGateway.Serialization.cs index 686b1c773dc0..eace2d90c16d 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioEgressGateway.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioEgressGateway.Serialization.cs @@ -8,7 +8,6 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Text.Json; using Azure.Core; @@ -38,17 +37,6 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("enabled"u8); writer.WriteBooleanValue(IsEnabled); - if (Optional.IsCollectionDefined(NodeSelector)) - { - writer.WritePropertyName("nodeSelector"u8); - writer.WriteStartObject(); - foreach (var item in NodeSelector) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -87,7 +75,6 @@ internal static IstioEgressGateway DeserializeIstioEgressGateway(JsonElement ele return null; } bool enabled = default; - IDictionary nodeSelector = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -97,27 +84,13 @@ internal static IstioEgressGateway DeserializeIstioEgressGateway(JsonElement ele enabled = property.Value.GetBoolean(); continue; } - if (property.NameEquals("nodeSelector"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - nodeSelector = dictionary; - continue; - } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new IstioEgressGateway(enabled, nodeSelector ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + return new IstioEgressGateway(enabled, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -144,43 +117,6 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.AppendLine($"{boolValue}"); } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NodeSelector), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nodeSelector: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(NodeSelector)) - { - if (NodeSelector.Any()) - { - builder.Append(" nodeSelector: "); - builder.AppendLine("{"); - foreach (var item in NodeSelector) - { - builder.Append($" '{item.Key}': "); - if (item.Value == null) - { - builder.Append("null"); - continue; - } - if (item.Value.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{item.Value}'''"); - } - else - { - builder.AppendLine($"'{item.Value}'"); - } - } - builder.AppendLine(" }"); - } - } - } - builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioEgressGateway.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioEgressGateway.cs index c58b696e03c7..a432004c3b86 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioEgressGateway.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioEgressGateway.cs @@ -50,17 +50,14 @@ public partial class IstioEgressGateway public IstioEgressGateway(bool isEnabled) { IsEnabled = isEnabled; - NodeSelector = new ChangeTrackingDictionary(); } /// Initializes a new instance of . /// Whether to enable the egress gateway. - /// NodeSelector for scheduling the egress gateway. /// Keeps track of any properties unknown to the library. - internal IstioEgressGateway(bool isEnabled, IDictionary nodeSelector, IDictionary serializedAdditionalRawData) + internal IstioEgressGateway(bool isEnabled, IDictionary serializedAdditionalRawData) { IsEnabled = isEnabled; - NodeSelector = nodeSelector; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -72,8 +69,5 @@ internal IstioEgressGateway() /// Whether to enable the egress gateway. [WirePath("enabled")] public bool IsEnabled { get; set; } - /// NodeSelector for scheduling the egress gateway. - [WirePath("nodeSelector")] - public IDictionary NodeSelector { get; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersion.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersion.Serialization.cs index 82648bb9b64e..7fdf4eb2d2e5 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersion.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersion.Serialization.cs @@ -46,6 +46,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("capabilities"u8); writer.WriteObjectValue(Capabilities, options); } + if (Optional.IsDefined(IsDefault)) + { + writer.WritePropertyName("isDefault"u8); + writer.WriteBooleanValue(IsDefault.Value); + } if (Optional.IsDefined(IsPreview)) { writer.WritePropertyName("isPreview"u8); @@ -101,6 +106,7 @@ internal static KubernetesVersion DeserializeKubernetesVersion(JsonElement eleme } string version = default; KubernetesVersionCapabilities capabilities = default; + bool? isDefault = default; bool? isPreview = default; IReadOnlyDictionary patchVersions = default; IDictionary serializedAdditionalRawData = default; @@ -121,6 +127,15 @@ internal static KubernetesVersion DeserializeKubernetesVersion(JsonElement eleme capabilities = KubernetesVersionCapabilities.DeserializeKubernetesVersionCapabilities(property.Value, options); continue; } + if (property.NameEquals("isDefault"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isDefault = property.Value.GetBoolean(); + continue; + } if (property.NameEquals("isPreview"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -150,7 +165,13 @@ internal static KubernetesVersion DeserializeKubernetesVersion(JsonElement eleme } } serializedAdditionalRawData = rawDataDictionary; - return new KubernetesVersion(version, capabilities, isPreview, patchVersions ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + return new KubernetesVersion( + version, + capabilities, + isDefault, + isPreview, + patchVersions ?? new ChangeTrackingDictionary(), + serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -205,6 +226,22 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsDefault), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" isDefault: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(IsDefault)) + { + builder.Append(" isDefault: "); + var boolValue = IsDefault.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsPreview), out propertyOverride); if (hasPropertyOverride) { diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersion.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersion.cs index 1eedcc878d7c..b7a4c82e4848 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersion.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersion.cs @@ -54,13 +54,15 @@ internal KubernetesVersion() /// Initializes a new instance of . /// major.minor version of Kubernetes release. /// Capabilities on this Kubernetes version. + /// Whether this version is default. /// Whether this version is in preview mode. /// Patch versions of Kubernetes release. /// Keeps track of any properties unknown to the library. - internal KubernetesVersion(string version, KubernetesVersionCapabilities capabilities, bool? isPreview, IReadOnlyDictionary patchVersions, IDictionary serializedAdditionalRawData) + internal KubernetesVersion(string version, KubernetesVersionCapabilities capabilities, bool? isDefault, bool? isPreview, IReadOnlyDictionary patchVersions, IDictionary serializedAdditionalRawData) { Version = version; Capabilities = capabilities; + IsDefault = isDefault; IsPreview = isPreview; PatchVersions = patchVersions; _serializedAdditionalRawData = serializedAdditionalRawData; @@ -78,6 +80,9 @@ public IReadOnlyList CapabilitiesSupportPlan get => Capabilities?.SupportPlan; } + /// Whether this version is default. + [WirePath("isDefault")] + public bool? IsDefault { get; } /// Whether this version is in preview mode. [WirePath("isPreview")] public bool? IsPreview { get; } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSOptionProperty.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineIPAddress.Serialization.cs similarity index 58% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSOptionProperty.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineIPAddress.Serialization.cs index 4796fc7e6210..e0e0e8ec1b0c 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSOptionProperty.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineIPAddress.Serialization.cs @@ -14,11 +14,11 @@ namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceOSOptionProperty : IUtf8JsonSerializable, IJsonModel + public partial class MachineIPAddress : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -29,16 +29,22 @@ void IJsonModel.Write(Utf8JsonWriter writer, M /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ContainerServiceOSOptionProperty)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(MachineIPAddress)} does not support writing '{format}' format."); } - writer.WritePropertyName("os-type"u8); - writer.WriteStringValue(OSType); - writer.WritePropertyName("enable-fips-image"u8); - writer.WriteBooleanValue(EnableFipsImage); + if (options.Format != "W" && Optional.IsDefined(Family)) + { + writer.WritePropertyName("family"u8); + writer.WriteStringValue(Family.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(IP)) + { + writer.WritePropertyName("ip"u8); + writer.WriteStringValue(IP); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -56,19 +62,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ContainerServiceOSOptionProperty IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + MachineIPAddress IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ContainerServiceOSOptionProperty)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(MachineIPAddress)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceOSOptionProperty(document.RootElement, options); + return DeserializeMachineIPAddress(document.RootElement, options); } - internal static ContainerServiceOSOptionProperty DeserializeContainerServiceOSOptionProperty(JsonElement element, ModelReaderWriterOptions options = null) + internal static MachineIPAddress DeserializeMachineIPAddress(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -76,20 +82,24 @@ internal static ContainerServiceOSOptionProperty DeserializeContainerServiceOSOp { return null; } - string osType = default; - bool enableFipsImage = default; + IPFamily? family = default; + string ip = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("os-type"u8)) + if (property.NameEquals("family"u8)) { - osType = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + family = new IPFamily(property.Value.GetString()); continue; } - if (property.NameEquals("enable-fips-image"u8)) + if (property.NameEquals("ip"u8)) { - enableFipsImage = property.Value.GetBoolean(); + ip = property.Value.GetString(); continue; } if (options.Format != "W") @@ -98,7 +108,7 @@ internal static ContainerServiceOSOptionProperty DeserializeContainerServiceOSOp } } serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceOSOptionProperty(osType, enableFipsImage, serializedAdditionalRawData); + return new MachineIPAddress(family, ip, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -112,49 +122,51 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.AppendLine("{"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OSType), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Family), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" os-type: "); + builder.Append(" family: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(OSType)) + if (Optional.IsDefined(Family)) { - builder.Append(" os-type: "); - if (OSType.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{OSType}'''"); - } - else - { - builder.AppendLine($"'{OSType}'"); - } + builder.Append(" family: "); + builder.AppendLine($"'{Family.Value.ToString()}'"); } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnableFipsImage), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IP), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" enable-fips-image: "); + builder.Append(" ip: "); builder.AppendLine(propertyOverride); } else { - builder.Append(" enable-fips-image: "); - var boolValue = EnableFipsImage == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); + if (Optional.IsDefined(IP)) + { + builder.Append(" ip: "); + if (IP.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{IP}'''"); + } + else + { + builder.AppendLine($"'{IP}'"); + } + } } builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { @@ -163,26 +175,26 @@ BinaryData IPersistableModel.Write(ModelReader case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(ContainerServiceOSOptionProperty)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(MachineIPAddress)} does not support writing '{options.Format}' format."); } } - ContainerServiceOSOptionProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + MachineIPAddress IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeContainerServiceOSOptionProperty(document.RootElement, options); + return DeserializeMachineIPAddress(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ContainerServiceOSOptionProperty)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(MachineIPAddress)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineIPAddress.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineIPAddress.cs new file mode 100644 index 000000000000..a23d7fb7aa6a --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineIPAddress.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The machine IP address details. + public partial class MachineIPAddress + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal MachineIPAddress() + { + } + + /// Initializes a new instance of . + /// To determine if address belongs IPv4 or IPv6 family. + /// IPv4 or IPv6 address of the machine. + /// Keeps track of any properties unknown to the library. + internal MachineIPAddress(IPFamily? family, string ip, IDictionary serializedAdditionalRawData) + { + Family = family; + IP = ip; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// To determine if address belongs IPv4 or IPv6 family. + [WirePath("family")] + public IPFamily? Family { get; } + /// IPv4 or IPv6 address of the machine. + [WirePath("ip")] + public string IP { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineListResult.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineListResult.Serialization.cs new file mode 100644 index 000000000000..ae09ec317a33 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineListResult.Serialization.cs @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class MachineListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MachineListResult)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MachineListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MachineListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMachineListResult(document.RootElement, options); + } + + internal static MachineListResult DeserializeMachineListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Uri nextLink = default; + IReadOnlyList value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MachineData.DeserializeMachineData(item, options)); + } + value = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MachineListResult(nextLink, value ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + builder.AppendLine($"'{NextLink.AbsoluteUri}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(MachineListResult)} does not support writing '{options.Format}' format."); + } + } + + MachineListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMachineListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MachineListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineListResult.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineListResult.cs new file mode 100644 index 000000000000..4f59799019c5 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineListResult.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The response from the List Machines operation. + internal partial class MachineListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal MachineListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The URL to get the next set of machine results. + /// The list of Machines in cluster. + /// Keeps track of any properties unknown to the library. + internal MachineListResult(Uri nextLink, IReadOnlyList value, IDictionary serializedAdditionalRawData) + { + NextLink = nextLink; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The URL to get the next set of machine results. + public Uri NextLink { get; } + /// The list of Machines in cluster. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineNetworkProperties.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineNetworkProperties.Serialization.cs new file mode 100644 index 000000000000..a2b3660419d7 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineNetworkProperties.Serialization.cs @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class MachineNetworkProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MachineNetworkProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsCollectionDefined(IPAddresses)) + { + writer.WritePropertyName("ipAddresses"u8); + writer.WriteStartArray(); + foreach (var item in IPAddresses) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MachineNetworkProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MachineNetworkProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMachineNetworkProperties(document.RootElement, options); + } + + internal static MachineNetworkProperties DeserializeMachineNetworkProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList ipAddresses = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("ipAddresses"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MachineIPAddress.DeserializeMachineIPAddress(item, options)); + } + ipAddresses = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MachineNetworkProperties(ipAddresses ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IPAddresses), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" ipAddresses: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(IPAddresses)) + { + if (IPAddresses.Any()) + { + builder.Append(" ipAddresses: "); + builder.AppendLine("["); + foreach (var item in IPAddresses) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " ipAddresses: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(MachineNetworkProperties)} does not support writing '{options.Format}' format."); + } + } + + MachineNetworkProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMachineNetworkProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MachineNetworkProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineNetworkProperties.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineNetworkProperties.cs new file mode 100644 index 000000000000..1e7ac382e543 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineNetworkProperties.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// network properties of the machine. + internal partial class MachineNetworkProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal MachineNetworkProperties() + { + IPAddresses = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// IPv4, IPv6 addresses of the machine. + /// Keeps track of any properties unknown to the library. + internal MachineNetworkProperties(IReadOnlyList ipAddresses, IDictionary serializedAdditionalRawData) + { + IPAddresses = ipAddresses; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// IPv4, IPv6 addresses of the machine. + [WirePath("ipAddresses")] + public IReadOnlyList IPAddresses { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineProperties.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineProperties.Serialization.cs new file mode 100644 index 000000000000..7dc4dceec42d --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineProperties.Serialization.cs @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class MachineProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MachineProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(Network)) + { + writer.WritePropertyName("network"u8); + writer.WriteObjectValue(Network, options); + } + if (options.Format != "W" && Optional.IsDefined(ResourceId)) + { + writer.WritePropertyName("resourceId"u8); + writer.WriteStringValue(ResourceId); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MachineProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MachineProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMachineProperties(document.RootElement, options); + } + + internal static MachineProperties DeserializeMachineProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + MachineNetworkProperties network = default; + ResourceIdentifier resourceId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("network"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + network = MachineNetworkProperties.DeserializeMachineNetworkProperties(property.Value, options); + continue; + } + if (property.NameEquals("resourceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MachineProperties(network, resourceId, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("NetworkIPAddresses", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" network: "); + builder.AppendLine("{"); + builder.Append(" ipAddresses: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(Network)) + { + builder.Append(" network: "); + BicepSerializationHelpers.AppendChildObject(builder, Network, options, 2, false, " network: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ResourceId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" resourceId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ResourceId)) + { + builder.Append(" resourceId: "); + builder.AppendLine($"'{ResourceId.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(MachineProperties)} does not support writing '{options.Format}' format."); + } + } + + MachineProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMachineProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MachineProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineProperties.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineProperties.cs new file mode 100644 index 000000000000..2015203bd683 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineProperties.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The properties of the machine. + public partial class MachineProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal MachineProperties() + { + } + + /// Initializes a new instance of . + /// network properties of the machine. + /// Azure resource id of the machine. It can be used to GET underlying VM Instance. + /// Keeps track of any properties unknown to the library. + internal MachineProperties(MachineNetworkProperties network, ResourceIdentifier resourceId, IDictionary serializedAdditionalRawData) + { + Network = network; + ResourceId = resourceId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// network properties of the machine. + internal MachineNetworkProperties Network { get; } + /// IPv4, IPv6 addresses of the machine. + [WirePath("network.ipAddresses")] + public IReadOnlyList NetworkIPAddresses + { + get => Network?.IPAddresses; + } + + /// Azure resource id of the machine. It can be used to GET underlying VM Instance. + [WirePath("resourceId")] + public ResourceIdentifier ResourceId { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.Serialization.cs index 54ecedfa5c07..4b304ce7b5f5 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.Serialization.cs @@ -62,12 +62,14 @@ internal static ManagedClusterAgentPoolProfile DeserializeManagedClusterAgentPoo return null; } string name = default; + ETag? etag = default; int? count = default; string vmSize = default; int? osDiskSizeGB = default; ContainerServiceOSDiskType? osDiskType = default; KubeletDiskType? kubeletDiskType = default; WorkloadRuntime? workloadRuntime = default; + string messageOfTheDay = default; ResourceIdentifier vnetSubnetId = default; ResourceIdentifier podSubnetId = default; int? maxPods = default; @@ -105,6 +107,9 @@ internal static ManagedClusterAgentPoolProfile DeserializeManagedClusterAgentPoo ResourceIdentifier capacityReservationGroupId = default; ResourceIdentifier hostGroupId = default; AgentPoolNetworkProfile networkProfile = default; + AgentPoolWindowsProfile windowsProfile = default; + AgentPoolSecurityProfile securityProfile = default; + GpuProfile gpuProfile = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -114,6 +119,15 @@ internal static ManagedClusterAgentPoolProfile DeserializeManagedClusterAgentPoo name = property.Value.GetString(); continue; } + if (property.NameEquals("eTag"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + etag = new ETag(property.Value.GetString()); + continue; + } if (property.NameEquals("count"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -164,6 +178,11 @@ internal static ManagedClusterAgentPoolProfile DeserializeManagedClusterAgentPoo workloadRuntime = new WorkloadRuntime(property.Value.GetString()); continue; } + if (property.NameEquals("messageOfTheDay"u8)) + { + messageOfTheDay = property.Value.GetString(); + continue; + } if (property.NameEquals("vnetSubnetID"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -501,6 +520,33 @@ internal static ManagedClusterAgentPoolProfile DeserializeManagedClusterAgentPoo networkProfile = AgentPoolNetworkProfile.DeserializeAgentPoolNetworkProfile(property.Value, options); continue; } + if (property.NameEquals("windowsProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + windowsProfile = AgentPoolWindowsProfile.DeserializeAgentPoolWindowsProfile(property.Value, options); + continue; + } + if (property.NameEquals("securityProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + securityProfile = AgentPoolSecurityProfile.DeserializeAgentPoolSecurityProfile(property.Value, options); + continue; + } + if (property.NameEquals("gpuProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + gpuProfile = GpuProfile.DeserializeGpuProfile(property.Value, options); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -508,12 +554,14 @@ internal static ManagedClusterAgentPoolProfile DeserializeManagedClusterAgentPoo } serializedAdditionalRawData = rawDataDictionary; return new ManagedClusterAgentPoolProfile( + etag, count, vmSize, osDiskSizeGB, osDiskType, kubeletDiskType, workloadRuntime, + messageOfTheDay, vnetSubnetId, podSubnetId, maxPods, @@ -551,6 +599,9 @@ internal static ManagedClusterAgentPoolProfile DeserializeManagedClusterAgentPoo capacityReservationGroupId, hostGroupId, networkProfile, + windowsProfile, + securityProfile, + gpuProfile, serializedAdditionalRawData, name); } @@ -589,6 +640,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ETag), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" eTag: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ETag)) + { + builder.Append(" eTag: "); + builder.AppendLine($"'{ETag.Value.ToString()}'"); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Count), out propertyOverride); if (hasPropertyOverride) { @@ -687,6 +753,29 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MessageOfTheDay), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" messageOfTheDay: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(MessageOfTheDay)) + { + builder.Append(" messageOfTheDay: "); + if (MessageOfTheDay.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{MessageOfTheDay}'''"); + } + else + { + builder.AppendLine($"'{MessageOfTheDay}'"); + } + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VnetSubnetId), out propertyOverride); if (hasPropertyOverride) { @@ -1371,6 +1460,57 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("DisableOutboundNat", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" windowsProfile: "); + builder.AppendLine("{"); + builder.Append(" disableOutboundNat: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(WindowsProfile)) + { + builder.Append(" windowsProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, WindowsProfile, options, 2, false, " windowsProfile: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SecurityProfile), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" securityProfile: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SecurityProfile)) + { + builder.Append(" securityProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, SecurityProfile, options, 2, false, " securityProfile: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("GpuDriver", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" gpuProfile: "); + builder.AppendLine("{"); + builder.Append(" driver: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(GpuProfile)) + { + builder.Append(" gpuProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, GpuProfile, options, 2, false, " gpuProfile: "); + } + } + builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs index 5814a5f2d5a7..73c343ca2d92 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs @@ -25,12 +25,14 @@ public ManagedClusterAgentPoolProfile(string name) } /// Initializes a new instance of . + /// Unique read-only string used to implement optimistic concurrency. The eTag value will change when the resource is updated. Specify an if-match or if-none-match header with the eTag value for a subsequent request to enable optimistic concurrency per the normal etag convention. /// Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. /// VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. /// OS Disk Size in GB to be used to specify the disk size for every machine in the master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. /// The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see [Ephemeral OS](https://docs.microsoft.com/azure/aks/cluster-configuration#ephemeral-os). /// Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. /// Determines the type of workload a node can run. + /// A base64-encoded string which will be written to /etc/motd after decoding. This allows customization of the message of the day for Linux nodes. It must not be specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be executed as a script). /// If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just nodes. This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. /// If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. /// The maximum number of pods that can run on a node. @@ -68,9 +70,12 @@ public ManagedClusterAgentPoolProfile(string name) /// AKS will associate the specified agent pool with the Capacity Reservation Group. /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. For more information see [Azure dedicated hosts](https://docs.microsoft.com/azure/virtual-machines/dedicated-hosts). /// Network-related settings of an agent pool. + /// The Windows agent pool's specific profile. + /// The security settings of an agent pool. + /// GPU settings for the Agent Pool. /// Keeps track of any properties unknown to the library. /// Windows agent pool names must be 6 characters or less. - internal ManagedClusterAgentPoolProfile(int? count, string vmSize, int? osDiskSizeInGB, ContainerServiceOSDiskType? osDiskType, KubeletDiskType? kubeletDiskType, WorkloadRuntime? workloadRuntime, ResourceIdentifier vnetSubnetId, ResourceIdentifier podSubnetId, int? maxPods, ContainerServiceOSType? osType, ContainerServiceOSSku? osSku, int? maxCount, int? minCount, bool? enableAutoScaling, ScaleDownMode? scaleDownMode, AgentPoolType? agentPoolType, AgentPoolMode? mode, string orchestratorVersion, string currentOrchestratorVersion, string nodeImageVersion, AgentPoolUpgradeSettings upgradeSettings, string provisioningState, ContainerServicePowerState powerState, IList availabilityZones, bool? enableNodePublicIP, ResourceIdentifier nodePublicIPPrefixId, ScaleSetPriority? scaleSetPriority, ScaleSetEvictionPolicy? scaleSetEvictionPolicy, float? spotMaxPrice, IDictionary tags, IDictionary nodeLabels, IList nodeTaints, ResourceIdentifier proximityPlacementGroupId, KubeletConfig kubeletConfig, LinuxOSConfig linuxOSConfig, bool? enableEncryptionAtHost, bool? enableUltraSsd, bool? enableFips, GpuInstanceProfile? gpuInstanceProfile, ContainerServiceCreationData creationData, ResourceIdentifier capacityReservationGroupId, ResourceIdentifier hostGroupId, AgentPoolNetworkProfile networkProfile, IDictionary serializedAdditionalRawData, string name) : base(count, vmSize, osDiskSizeInGB, osDiskType, kubeletDiskType, workloadRuntime, vnetSubnetId, podSubnetId, maxPods, osType, osSku, maxCount, minCount, enableAutoScaling, scaleDownMode, agentPoolType, mode, orchestratorVersion, currentOrchestratorVersion, nodeImageVersion, upgradeSettings, provisioningState, powerState, availabilityZones, enableNodePublicIP, nodePublicIPPrefixId, scaleSetPriority, scaleSetEvictionPolicy, spotMaxPrice, tags, nodeLabels, nodeTaints, proximityPlacementGroupId, kubeletConfig, linuxOSConfig, enableEncryptionAtHost, enableUltraSsd, enableFips, gpuInstanceProfile, creationData, capacityReservationGroupId, hostGroupId, networkProfile, serializedAdditionalRawData) + internal ManagedClusterAgentPoolProfile(ETag? etag, int? count, string vmSize, int? osDiskSizeInGB, ContainerServiceOSDiskType? osDiskType, KubeletDiskType? kubeletDiskType, WorkloadRuntime? workloadRuntime, string messageOfTheDay, ResourceIdentifier vnetSubnetId, ResourceIdentifier podSubnetId, int? maxPods, ContainerServiceOSType? osType, ContainerServiceOSSku? osSku, int? maxCount, int? minCount, bool? enableAutoScaling, ScaleDownMode? scaleDownMode, AgentPoolType? agentPoolType, AgentPoolMode? mode, string orchestratorVersion, string currentOrchestratorVersion, string nodeImageVersion, AgentPoolUpgradeSettings upgradeSettings, string provisioningState, ContainerServicePowerState powerState, IList availabilityZones, bool? enableNodePublicIP, ResourceIdentifier nodePublicIPPrefixId, ScaleSetPriority? scaleSetPriority, ScaleSetEvictionPolicy? scaleSetEvictionPolicy, float? spotMaxPrice, IDictionary tags, IDictionary nodeLabels, IList nodeTaints, ResourceIdentifier proximityPlacementGroupId, KubeletConfig kubeletConfig, LinuxOSConfig linuxOSConfig, bool? enableEncryptionAtHost, bool? enableUltraSsd, bool? enableFips, GpuInstanceProfile? gpuInstanceProfile, ContainerServiceCreationData creationData, ResourceIdentifier capacityReservationGroupId, ResourceIdentifier hostGroupId, AgentPoolNetworkProfile networkProfile, AgentPoolWindowsProfile windowsProfile, AgentPoolSecurityProfile securityProfile, GpuProfile gpuProfile, IDictionary serializedAdditionalRawData, string name) : base(etag, count, vmSize, osDiskSizeInGB, osDiskType, kubeletDiskType, workloadRuntime, messageOfTheDay, vnetSubnetId, podSubnetId, maxPods, osType, osSku, maxCount, minCount, enableAutoScaling, scaleDownMode, agentPoolType, mode, orchestratorVersion, currentOrchestratorVersion, nodeImageVersion, upgradeSettings, provisioningState, powerState, availabilityZones, enableNodePublicIP, nodePublicIPPrefixId, scaleSetPriority, scaleSetEvictionPolicy, spotMaxPrice, tags, nodeLabels, nodeTaints, proximityPlacementGroupId, kubeletConfig, linuxOSConfig, enableEncryptionAtHost, enableUltraSsd, enableFips, gpuInstanceProfile, creationData, capacityReservationGroupId, hostGroupId, networkProfile, windowsProfile, securityProfile, gpuProfile, serializedAdditionalRawData) { Name = name; } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.Serialization.cs index db1fb26d5b79..77a91ae21936 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.Serialization.cs @@ -36,6 +36,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(ManagedClusterAgentPoolProfileProperties)} does not support writing '{format}' format."); } + if (options.Format != "W" && Optional.IsDefined(ETag)) + { + writer.WritePropertyName("eTag"u8); + writer.WriteStringValue(ETag.Value.ToString()); + } if (Optional.IsDefined(Count)) { writer.WritePropertyName("count"u8); @@ -66,6 +71,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("workloadRuntime"u8); writer.WriteStringValue(WorkloadRuntime.Value.ToString()); } + if (Optional.IsDefined(MessageOfTheDay)) + { + writer.WritePropertyName("messageOfTheDay"u8); + writer.WriteStringValue(MessageOfTheDay); + } if (Optional.IsDefined(VnetSubnetId)) { writer.WritePropertyName("vnetSubnetID"u8); @@ -273,6 +283,21 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("networkProfile"u8); writer.WriteObjectValue(NetworkProfile, options); } + if (Optional.IsDefined(WindowsProfile)) + { + writer.WritePropertyName("windowsProfile"u8); + writer.WriteObjectValue(WindowsProfile, options); + } + if (Optional.IsDefined(SecurityProfile)) + { + writer.WritePropertyName("securityProfile"u8); + writer.WriteObjectValue(SecurityProfile, options); + } + if (Optional.IsDefined(GpuProfile)) + { + writer.WritePropertyName("gpuProfile"u8); + writer.WriteObjectValue(GpuProfile, options); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -310,12 +335,14 @@ internal static ManagedClusterAgentPoolProfileProperties DeserializeManagedClust { return null; } + ETag? etag = default; int? count = default; string vmSize = default; int? osDiskSizeGB = default; ContainerServiceOSDiskType? osDiskType = default; KubeletDiskType? kubeletDiskType = default; WorkloadRuntime? workloadRuntime = default; + string messageOfTheDay = default; ResourceIdentifier vnetSubnetId = default; ResourceIdentifier podSubnetId = default; int? maxPods = default; @@ -353,10 +380,22 @@ internal static ManagedClusterAgentPoolProfileProperties DeserializeManagedClust ResourceIdentifier capacityReservationGroupId = default; ResourceIdentifier hostGroupId = default; AgentPoolNetworkProfile networkProfile = default; + AgentPoolWindowsProfile windowsProfile = default; + AgentPoolSecurityProfile securityProfile = default; + GpuProfile gpuProfile = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("eTag"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + etag = new ETag(property.Value.GetString()); + continue; + } if (property.NameEquals("count"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -407,6 +446,11 @@ internal static ManagedClusterAgentPoolProfileProperties DeserializeManagedClust workloadRuntime = new WorkloadRuntime(property.Value.GetString()); continue; } + if (property.NameEquals("messageOfTheDay"u8)) + { + messageOfTheDay = property.Value.GetString(); + continue; + } if (property.NameEquals("vnetSubnetID"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -744,6 +788,33 @@ internal static ManagedClusterAgentPoolProfileProperties DeserializeManagedClust networkProfile = AgentPoolNetworkProfile.DeserializeAgentPoolNetworkProfile(property.Value, options); continue; } + if (property.NameEquals("windowsProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + windowsProfile = AgentPoolWindowsProfile.DeserializeAgentPoolWindowsProfile(property.Value, options); + continue; + } + if (property.NameEquals("securityProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + securityProfile = AgentPoolSecurityProfile.DeserializeAgentPoolSecurityProfile(property.Value, options); + continue; + } + if (property.NameEquals("gpuProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + gpuProfile = GpuProfile.DeserializeGpuProfile(property.Value, options); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -751,12 +822,14 @@ internal static ManagedClusterAgentPoolProfileProperties DeserializeManagedClust } serializedAdditionalRawData = rawDataDictionary; return new ManagedClusterAgentPoolProfileProperties( + etag, count, vmSize, osDiskSizeGB, osDiskType, kubeletDiskType, workloadRuntime, + messageOfTheDay, vnetSubnetId, podSubnetId, maxPods, @@ -794,6 +867,9 @@ internal static ManagedClusterAgentPoolProfileProperties DeserializeManagedClust capacityReservationGroupId, hostGroupId, networkProfile, + windowsProfile, + securityProfile, + gpuProfile, serializedAdditionalRawData); } @@ -808,6 +884,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.AppendLine("{"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ETag), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" eTag: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ETag)) + { + builder.Append(" eTag: "); + builder.AppendLine($"'{ETag.Value.ToString()}'"); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Count), out propertyOverride); if (hasPropertyOverride) { @@ -906,6 +997,29 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MessageOfTheDay), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" messageOfTheDay: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(MessageOfTheDay)) + { + builder.Append(" messageOfTheDay: "); + if (MessageOfTheDay.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{MessageOfTheDay}'''"); + } + else + { + builder.AppendLine($"'{MessageOfTheDay}'"); + } + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VnetSubnetId), out propertyOverride); if (hasPropertyOverride) { @@ -1590,6 +1704,57 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("DisableOutboundNat", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" windowsProfile: "); + builder.AppendLine("{"); + builder.Append(" disableOutboundNat: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(WindowsProfile)) + { + builder.Append(" windowsProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, WindowsProfile, options, 2, false, " windowsProfile: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SecurityProfile), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" securityProfile: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SecurityProfile)) + { + builder.Append(" securityProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, SecurityProfile, options, 2, false, " securityProfile: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("GpuDriver", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" gpuProfile: "); + builder.AppendLine("{"); + builder.Append(" driver: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(GpuProfile)) + { + builder.Append(" gpuProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, GpuProfile, options, 2, false, " gpuProfile: "); + } + } + builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs index b23edbb4a140..0902a8ae07fe 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs @@ -56,12 +56,14 @@ public ManagedClusterAgentPoolProfileProperties() } /// Initializes a new instance of . + /// Unique read-only string used to implement optimistic concurrency. The eTag value will change when the resource is updated. Specify an if-match or if-none-match header with the eTag value for a subsequent request to enable optimistic concurrency per the normal etag convention. /// Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. /// VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. /// OS Disk Size in GB to be used to specify the disk size for every machine in the master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. /// The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see [Ephemeral OS](https://docs.microsoft.com/azure/aks/cluster-configuration#ephemeral-os). /// Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. /// Determines the type of workload a node can run. + /// A base64-encoded string which will be written to /etc/motd after decoding. This allows customization of the message of the day for Linux nodes. It must not be specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be executed as a script). /// If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just nodes. This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. /// If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. /// The maximum number of pods that can run on a node. @@ -99,15 +101,20 @@ public ManagedClusterAgentPoolProfileProperties() /// AKS will associate the specified agent pool with the Capacity Reservation Group. /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. For more information see [Azure dedicated hosts](https://docs.microsoft.com/azure/virtual-machines/dedicated-hosts). /// Network-related settings of an agent pool. + /// The Windows agent pool's specific profile. + /// The security settings of an agent pool. + /// GPU settings for the Agent Pool. /// Keeps track of any properties unknown to the library. - internal ManagedClusterAgentPoolProfileProperties(int? count, string vmSize, int? osDiskSizeInGB, ContainerServiceOSDiskType? osDiskType, KubeletDiskType? kubeletDiskType, WorkloadRuntime? workloadRuntime, ResourceIdentifier vnetSubnetId, ResourceIdentifier podSubnetId, int? maxPods, ContainerServiceOSType? osType, ContainerServiceOSSku? osSku, int? maxCount, int? minCount, bool? enableAutoScaling, ScaleDownMode? scaleDownMode, AgentPoolType? agentPoolType, AgentPoolMode? mode, string orchestratorVersion, string currentOrchestratorVersion, string nodeImageVersion, AgentPoolUpgradeSettings upgradeSettings, string provisioningState, ContainerServicePowerState powerState, IList availabilityZones, bool? enableNodePublicIP, ResourceIdentifier nodePublicIPPrefixId, ScaleSetPriority? scaleSetPriority, ScaleSetEvictionPolicy? scaleSetEvictionPolicy, float? spotMaxPrice, IDictionary tags, IDictionary nodeLabels, IList nodeTaints, ResourceIdentifier proximityPlacementGroupId, KubeletConfig kubeletConfig, LinuxOSConfig linuxOSConfig, bool? enableEncryptionAtHost, bool? enableUltraSsd, bool? enableFips, GpuInstanceProfile? gpuInstanceProfile, ContainerServiceCreationData creationData, ResourceIdentifier capacityReservationGroupId, ResourceIdentifier hostGroupId, AgentPoolNetworkProfile networkProfile, IDictionary serializedAdditionalRawData) + internal ManagedClusterAgentPoolProfileProperties(ETag? etag, int? count, string vmSize, int? osDiskSizeInGB, ContainerServiceOSDiskType? osDiskType, KubeletDiskType? kubeletDiskType, WorkloadRuntime? workloadRuntime, string messageOfTheDay, ResourceIdentifier vnetSubnetId, ResourceIdentifier podSubnetId, int? maxPods, ContainerServiceOSType? osType, ContainerServiceOSSku? osSku, int? maxCount, int? minCount, bool? enableAutoScaling, ScaleDownMode? scaleDownMode, AgentPoolType? agentPoolType, AgentPoolMode? mode, string orchestratorVersion, string currentOrchestratorVersion, string nodeImageVersion, AgentPoolUpgradeSettings upgradeSettings, string provisioningState, ContainerServicePowerState powerState, IList availabilityZones, bool? enableNodePublicIP, ResourceIdentifier nodePublicIPPrefixId, ScaleSetPriority? scaleSetPriority, ScaleSetEvictionPolicy? scaleSetEvictionPolicy, float? spotMaxPrice, IDictionary tags, IDictionary nodeLabels, IList nodeTaints, ResourceIdentifier proximityPlacementGroupId, KubeletConfig kubeletConfig, LinuxOSConfig linuxOSConfig, bool? enableEncryptionAtHost, bool? enableUltraSsd, bool? enableFips, GpuInstanceProfile? gpuInstanceProfile, ContainerServiceCreationData creationData, ResourceIdentifier capacityReservationGroupId, ResourceIdentifier hostGroupId, AgentPoolNetworkProfile networkProfile, AgentPoolWindowsProfile windowsProfile, AgentPoolSecurityProfile securityProfile, GpuProfile gpuProfile, IDictionary serializedAdditionalRawData) { + ETag = etag; Count = count; VmSize = vmSize; OSDiskSizeInGB = osDiskSizeInGB; OSDiskType = osDiskType; KubeletDiskType = kubeletDiskType; WorkloadRuntime = workloadRuntime; + MessageOfTheDay = messageOfTheDay; VnetSubnetId = vnetSubnetId; PodSubnetId = podSubnetId; MaxPods = maxPods; @@ -145,9 +152,15 @@ internal ManagedClusterAgentPoolProfileProperties(int? count, string vmSize, int CapacityReservationGroupId = capacityReservationGroupId; HostGroupId = hostGroupId; NetworkProfile = networkProfile; + WindowsProfile = windowsProfile; + SecurityProfile = securityProfile; + GpuProfile = gpuProfile; _serializedAdditionalRawData = serializedAdditionalRawData; } + /// Unique read-only string used to implement optimistic concurrency. The eTag value will change when the resource is updated. Specify an if-match or if-none-match header with the eTag value for a subsequent request to enable optimistic concurrency per the normal etag convention. + [WirePath("eTag")] + public ETag? ETag { get; } /// Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. [WirePath("count")] public int? Count { get; set; } @@ -166,6 +179,9 @@ internal ManagedClusterAgentPoolProfileProperties(int? count, string vmSize, int /// Determines the type of workload a node can run. [WirePath("workloadRuntime")] public WorkloadRuntime? WorkloadRuntime { get; set; } + /// A base64-encoded string which will be written to /etc/motd after decoding. This allows customization of the message of the day for Linux nodes. It must not be specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be executed as a script). + [WirePath("messageOfTheDay")] + public string MessageOfTheDay { get; set; } /// If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just nodes. This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. [WirePath("vnetSubnetID")] public ResourceIdentifier VnetSubnetId { get; set; } @@ -301,5 +317,37 @@ public ResourceIdentifier CreationDataSourceResourceId /// Network-related settings of an agent pool. [WirePath("networkProfile")] public AgentPoolNetworkProfile NetworkProfile { get; set; } + /// The Windows agent pool's specific profile. + internal AgentPoolWindowsProfile WindowsProfile { get; set; } + /// The default value is false. Outbound NAT can only be disabled if the cluster outboundType is NAT Gateway and the Windows agent pool does not have node public IP enabled. + [WirePath("windowsProfile.disableOutboundNat")] + public bool? DisableOutboundNat + { + get => WindowsProfile is null ? default : WindowsProfile.DisableOutboundNat; + set + { + if (WindowsProfile is null) + WindowsProfile = new AgentPoolWindowsProfile(); + WindowsProfile.DisableOutboundNat = value; + } + } + + /// The security settings of an agent pool. + [WirePath("securityProfile")] + public AgentPoolSecurityProfile SecurityProfile { get; set; } + /// GPU settings for the Agent Pool. + internal GpuProfile GpuProfile { get; set; } + /// Whether to install GPU drivers. When it's not specified, default is Install. + [WirePath("gpuProfile.driver")] + public GpuDriver? GpuDriver + { + get => GpuProfile is null ? default : GpuProfile.Driver; + set + { + if (GpuProfile is null) + GpuProfile = new GpuProfile(); + GpuProfile.Driver = value; + } + } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoScalerProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoScalerProfile.Serialization.cs index 64ec1cc6e8da..ca58d90544a8 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoScalerProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoScalerProfile.Serialization.cs @@ -40,6 +40,21 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("balance-similar-node-groups"u8); writer.WriteStringValue(BalanceSimilarNodeGroups); } + if (Optional.IsDefined(DaemonsetEvictionForEmptyNodes)) + { + writer.WritePropertyName("daemonset-eviction-for-empty-nodes"u8); + writer.WriteBooleanValue(DaemonsetEvictionForEmptyNodes.Value); + } + if (Optional.IsDefined(DaemonsetEvictionForOccupiedNodes)) + { + writer.WritePropertyName("daemonset-eviction-for-occupied-nodes"u8); + writer.WriteBooleanValue(DaemonsetEvictionForOccupiedNodes.Value); + } + if (Optional.IsDefined(IgnoreDaemonsetsUtilization)) + { + writer.WritePropertyName("ignore-daemonsets-utilization"u8); + writer.WriteBooleanValue(IgnoreDaemonsetsUtilization.Value); + } if (Optional.IsDefined(Expander)) { writer.WritePropertyName("expander"u8); @@ -158,6 +173,9 @@ internal static ManagedClusterAutoScalerProfile DeserializeManagedClusterAutoSca return null; } string balanceSimilarNodeGroups = default; + bool? daemonsetEvictionForEmptyNodes = default; + bool? daemonsetEvictionForOccupiedNodes = default; + bool? ignoreDaemonsetsUtilization = default; AutoScaleExpander? expander = default; string maxEmptyBulkDelete = default; string maxGracefulTerminationSec = default; @@ -183,6 +201,33 @@ internal static ManagedClusterAutoScalerProfile DeserializeManagedClusterAutoSca balanceSimilarNodeGroups = property.Value.GetString(); continue; } + if (property.NameEquals("daemonset-eviction-for-empty-nodes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + daemonsetEvictionForEmptyNodes = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("daemonset-eviction-for-occupied-nodes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + daemonsetEvictionForOccupiedNodes = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("ignore-daemonsets-utilization"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ignoreDaemonsetsUtilization = property.Value.GetBoolean(); + continue; + } if (property.NameEquals("expander"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -275,6 +320,9 @@ internal static ManagedClusterAutoScalerProfile DeserializeManagedClusterAutoSca serializedAdditionalRawData = rawDataDictionary; return new ManagedClusterAutoScalerProfile( balanceSimilarNodeGroups, + daemonsetEvictionForEmptyNodes, + daemonsetEvictionForOccupiedNodes, + ignoreDaemonsetsUtilization, expander, maxEmptyBulkDelete, maxGracefulTerminationSec, @@ -328,6 +376,54 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DaemonsetEvictionForEmptyNodes), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" daemonset-eviction-for-empty-nodes: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DaemonsetEvictionForEmptyNodes)) + { + builder.Append(" daemonset-eviction-for-empty-nodes: "); + var boolValue = DaemonsetEvictionForEmptyNodes.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DaemonsetEvictionForOccupiedNodes), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" daemonset-eviction-for-occupied-nodes: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DaemonsetEvictionForOccupiedNodes)) + { + builder.Append(" daemonset-eviction-for-occupied-nodes: "); + var boolValue = DaemonsetEvictionForOccupiedNodes.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IgnoreDaemonsetsUtilization), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" ignore-daemonsets-utilization: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(IgnoreDaemonsetsUtilization)) + { + builder.Append(" ignore-daemonsets-utilization: "); + var boolValue = IgnoreDaemonsetsUtilization.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Expander), out propertyOverride); if (hasPropertyOverride) { diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoScalerProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoScalerProfile.cs index 4cd1ca0a37ba..f8ffaecf322d 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoScalerProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoScalerProfile.cs @@ -52,6 +52,9 @@ public ManagedClusterAutoScalerProfile() /// Initializes a new instance of . /// Valid values are 'true' and 'false'. + /// If set to true, all daemonset pods on empty nodes will be evicted before deletion of the node. If the daemonset pod cannot be evicted another node will be chosen for scaling. If set to false, the node will be deleted without ensuring that daemonset pods are deleted or evicted. + /// If set to true, all daemonset pods on occupied nodes will be evicted before deletion of the node. If the daemonset pod cannot be evicted another node will be chosen for scaling. If set to false, the node will be deleted without ensuring that daemonset pods are deleted or evicted. + /// If set to true, the resources used by daemonset will be taken into account when making scaling down decisions. /// If not specified, the default is 'random'. See [expanders](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-expanders) for more information. /// The default is 10. /// The default is 600. @@ -69,9 +72,12 @@ public ManagedClusterAutoScalerProfile() /// The default is true. /// The default is true. /// Keeps track of any properties unknown to the library. - internal ManagedClusterAutoScalerProfile(string balanceSimilarNodeGroups, AutoScaleExpander? expander, string maxEmptyBulkDelete, string maxGracefulTerminationSec, string maxNodeProvisionTime, string maxTotalUnreadyPercentage, string newPodScaleUpDelay, string okTotalUnreadyCount, string scanIntervalInSeconds, string scaleDownDelayAfterAdd, string scaleDownDelayAfterDelete, string scaleDownDelayAfterFailure, string scaleDownUnneededTime, string scaleDownUnreadyTime, string scaleDownUtilizationThreshold, string skipNodesWithLocalStorage, string skipNodesWithSystemPods, IDictionary serializedAdditionalRawData) + internal ManagedClusterAutoScalerProfile(string balanceSimilarNodeGroups, bool? daemonsetEvictionForEmptyNodes, bool? daemonsetEvictionForOccupiedNodes, bool? ignoreDaemonsetsUtilization, AutoScaleExpander? expander, string maxEmptyBulkDelete, string maxGracefulTerminationSec, string maxNodeProvisionTime, string maxTotalUnreadyPercentage, string newPodScaleUpDelay, string okTotalUnreadyCount, string scanIntervalInSeconds, string scaleDownDelayAfterAdd, string scaleDownDelayAfterDelete, string scaleDownDelayAfterFailure, string scaleDownUnneededTime, string scaleDownUnreadyTime, string scaleDownUtilizationThreshold, string skipNodesWithLocalStorage, string skipNodesWithSystemPods, IDictionary serializedAdditionalRawData) { BalanceSimilarNodeGroups = balanceSimilarNodeGroups; + DaemonsetEvictionForEmptyNodes = daemonsetEvictionForEmptyNodes; + DaemonsetEvictionForOccupiedNodes = daemonsetEvictionForOccupiedNodes; + IgnoreDaemonsetsUtilization = ignoreDaemonsetsUtilization; Expander = expander; MaxEmptyBulkDelete = maxEmptyBulkDelete; MaxGracefulTerminationSec = maxGracefulTerminationSec; @@ -94,6 +100,15 @@ internal ManagedClusterAutoScalerProfile(string balanceSimilarNodeGroups, AutoSc /// Valid values are 'true' and 'false'. [WirePath("balance-similar-node-groups")] public string BalanceSimilarNodeGroups { get; set; } + /// If set to true, all daemonset pods on empty nodes will be evicted before deletion of the node. If the daemonset pod cannot be evicted another node will be chosen for scaling. If set to false, the node will be deleted without ensuring that daemonset pods are deleted or evicted. + [WirePath("daemonset-eviction-for-empty-nodes")] + public bool? DaemonsetEvictionForEmptyNodes { get; set; } + /// If set to true, all daemonset pods on occupied nodes will be evicted before deletion of the node. If the daemonset pod cannot be evicted another node will be chosen for scaling. If set to false, the node will be deleted without ensuring that daemonset pods are deleted or evicted. + [WirePath("daemonset-eviction-for-occupied-nodes")] + public bool? DaemonsetEvictionForOccupiedNodes { get; set; } + /// If set to true, the resources used by daemonset will be taken into account when making scaling down decisions. + [WirePath("ignore-daemonsets-utilization")] + public bool? IgnoreDaemonsetsUtilization { get; set; } /// If not specified, the default is 'random'. See [expanders](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-expanders) for more information. [WirePath("expander")] public AutoScaleExpander? Expander { get; set; } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterBootstrapProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterBootstrapProfile.Serialization.cs new file mode 100644 index 000000000000..ddd49428e4b2 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterBootstrapProfile.Serialization.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class ManagedClusterBootstrapProfile : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterBootstrapProfile)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ArtifactSource)) + { + writer.WritePropertyName("artifactSource"u8); + writer.WriteStringValue(ArtifactSource.Value.ToString()); + } + if (Optional.IsDefined(ContainerRegistryId)) + { + writer.WritePropertyName("containerRegistryId"u8); + writer.WriteStringValue(ContainerRegistryId); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ManagedClusterBootstrapProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterBootstrapProfile)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterBootstrapProfile(document.RootElement, options); + } + + internal static ManagedClusterBootstrapProfile DeserializeManagedClusterBootstrapProfile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ArtifactSource? artifactSource = default; + ResourceIdentifier containerRegistryId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("artifactSource"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactSource = new ArtifactSource(property.Value.GetString()); + continue; + } + if (property.NameEquals("containerRegistryId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + containerRegistryId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedClusterBootstrapProfile(artifactSource, containerRegistryId, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ArtifactSource), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" artifactSource: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ArtifactSource)) + { + builder.Append(" artifactSource: "); + builder.AppendLine($"'{ArtifactSource.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ContainerRegistryId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" containerRegistryId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ContainerRegistryId)) + { + builder.Append(" containerRegistryId: "); + builder.AppendLine($"'{ContainerRegistryId.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ManagedClusterBootstrapProfile)} does not support writing '{options.Format}' format."); + } + } + + ManagedClusterBootstrapProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeManagedClusterBootstrapProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedClusterBootstrapProfile)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterBootstrapProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterBootstrapProfile.cs new file mode 100644 index 000000000000..e7b95028c2a0 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterBootstrapProfile.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The bootstrap profile. + public partial class ManagedClusterBootstrapProfile + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ManagedClusterBootstrapProfile() + { + } + + /// Initializes a new instance of . + /// The source where the artifacts are downloaded from. + /// The resource Id of Azure Container Registry. The registry must have private network access, premium SKU and zone redundancy. + /// Keeps track of any properties unknown to the library. + internal ManagedClusterBootstrapProfile(ArtifactSource? artifactSource, ResourceIdentifier containerRegistryId, IDictionary serializedAdditionalRawData) + { + ArtifactSource = artifactSource; + ContainerRegistryId = containerRegistryId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The source where the artifacts are downloaded from. + [WirePath("artifactSource")] + public ArtifactSource? ArtifactSource { get; set; } + /// The resource Id of Azure Container Registry. The registry must have private network access, premium SKU and zone redundancy. + [WirePath("containerRegistryId")] + public ResourceIdentifier ContainerRegistryId { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCostAnalysis.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCostAnalysis.Serialization.cs new file mode 100644 index 000000000000..fe5820f61d2b --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCostAnalysis.Serialization.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class ManagedClusterCostAnalysis : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterCostAnalysis)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ManagedClusterCostAnalysis IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterCostAnalysis)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterCostAnalysis(document.RootElement, options); + } + + internal static ManagedClusterCostAnalysis DeserializeManagedClusterCostAnalysis(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? enabled = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedClusterCostAnalysis(enabled, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Enabled), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Enabled)) + { + builder.Append(" enabled: "); + var boolValue = Enabled.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ManagedClusterCostAnalysis)} does not support writing '{options.Format}' format."); + } + } + + ManagedClusterCostAnalysis IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeManagedClusterCostAnalysis(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedClusterCostAnalysis)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCostAnalysis.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCostAnalysis.cs new file mode 100644 index 000000000000..63379cdd6fdf --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCostAnalysis.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The cost analysis configuration for the cluster. + internal partial class ManagedClusterCostAnalysis + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ManagedClusterCostAnalysis() + { + } + + /// Initializes a new instance of . + /// The Managed Cluster sku.tier must be set to 'Standard' or 'Premium' to enable this feature. Enabling this will add Kubernetes Namespace and Deployment details to the Cost Analysis views in the Azure portal. If not specified, the default is false. For more information see aka.ms/aks/docs/cost-analysis. + /// Keeps track of any properties unknown to the library. + internal ManagedClusterCostAnalysis(bool? enabled, IDictionary serializedAdditionalRawData) + { + Enabled = enabled; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The Managed Cluster sku.tier must be set to 'Standard' or 'Premium' to enable this feature. Enabling this will add Kubernetes Namespace and Deployment details to the Cost Analysis views in the Azure portal. If not specified, the default is false. For more information see aka.ms/aks/docs/cost-analysis. + [WirePath("enabled")] + public bool? Enabled { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfile.Serialization.cs new file mode 100644 index 000000000000..64f368711676 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfile.Serialization.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class ManagedClusterIngressProfile : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterIngressProfile)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(WebAppRouting)) + { + writer.WritePropertyName("webAppRouting"u8); + writer.WriteObjectValue(WebAppRouting, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ManagedClusterIngressProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterIngressProfile)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterIngressProfile(document.RootElement, options); + } + + internal static ManagedClusterIngressProfile DeserializeManagedClusterIngressProfile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ManagedClusterIngressProfileWebAppRouting webAppRouting = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("webAppRouting"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + webAppRouting = ManagedClusterIngressProfileWebAppRouting.DeserializeManagedClusterIngressProfileWebAppRouting(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedClusterIngressProfile(webAppRouting, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(WebAppRouting), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" webAppRouting: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(WebAppRouting)) + { + builder.Append(" webAppRouting: "); + BicepSerializationHelpers.AppendChildObject(builder, WebAppRouting, options, 2, false, " webAppRouting: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ManagedClusterIngressProfile)} does not support writing '{options.Format}' format."); + } + } + + ManagedClusterIngressProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeManagedClusterIngressProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedClusterIngressProfile)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfile.cs new file mode 100644 index 000000000000..de760f817d65 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfile.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Ingress profile for the container service cluster. + internal partial class ManagedClusterIngressProfile + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ManagedClusterIngressProfile() + { + } + + /// Initializes a new instance of . + /// App Routing settings for the ingress profile. You can find an overview and onboarding guide for this feature at https://learn.microsoft.com/en-us/azure/aks/app-routing?tabs=default%2Cdeploy-app-default. + /// Keeps track of any properties unknown to the library. + internal ManagedClusterIngressProfile(ManagedClusterIngressProfileWebAppRouting webAppRouting, IDictionary serializedAdditionalRawData) + { + WebAppRouting = webAppRouting; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// App Routing settings for the ingress profile. You can find an overview and onboarding guide for this feature at https://learn.microsoft.com/en-us/azure/aks/app-routing?tabs=default%2Cdeploy-app-default. + [WirePath("webAppRouting")] + public ManagedClusterIngressProfileWebAppRouting WebAppRouting { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfileWebAppRouting.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfileWebAppRouting.Serialization.cs new file mode 100644 index 000000000000..a64182dab78c --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfileWebAppRouting.Serialization.cs @@ -0,0 +1,263 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class ManagedClusterIngressProfileWebAppRouting : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterIngressProfileWebAppRouting)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } + if (Optional.IsCollectionDefined(DnsZoneResourceIds)) + { + writer.WritePropertyName("dnsZoneResourceIds"u8); + writer.WriteStartArray(); + foreach (var item in DnsZoneResourceIds) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + writer.WriteObjectValue(Identity, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ManagedClusterIngressProfileWebAppRouting IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterIngressProfileWebAppRouting)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterIngressProfileWebAppRouting(document.RootElement, options); + } + + internal static ManagedClusterIngressProfileWebAppRouting DeserializeManagedClusterIngressProfileWebAppRouting(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? enabled = default; + IList dnsZoneResourceIds = default; + ContainerServiceUserAssignedIdentity identity = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("dnsZoneResourceIds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(new ResourceIdentifier(item.GetString())); + } + } + dnsZoneResourceIds = array; + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = ContainerServiceUserAssignedIdentity.DeserializeContainerServiceUserAssignedIdentity(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedClusterIngressProfileWebAppRouting(enabled, dnsZoneResourceIds ?? new ChangeTrackingList(), identity, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Enabled), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Enabled)) + { + builder.Append(" enabled: "); + var boolValue = Enabled.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DnsZoneResourceIds), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" dnsZoneResourceIds: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(DnsZoneResourceIds)) + { + if (DnsZoneResourceIds.Any()) + { + builder.Append(" dnsZoneResourceIds: "); + builder.AppendLine("["); + foreach (var item in DnsZoneResourceIds) + { + if (item == null) + { + builder.Append("null"); + continue; + } + builder.AppendLine($" '{item.ToString()}'"); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Identity), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" identity: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Identity)) + { + builder.Append(" identity: "); + BicepSerializationHelpers.AppendChildObject(builder, Identity, options, 2, false, " identity: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ManagedClusterIngressProfileWebAppRouting)} does not support writing '{options.Format}' format."); + } + } + + ManagedClusterIngressProfileWebAppRouting IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeManagedClusterIngressProfileWebAppRouting(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedClusterIngressProfileWebAppRouting)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfileWebAppRouting.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfileWebAppRouting.cs new file mode 100644 index 000000000000..c042ea82a4e2 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfileWebAppRouting.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Application Routing add-on settings for the ingress profile. + public partial class ManagedClusterIngressProfileWebAppRouting + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ManagedClusterIngressProfileWebAppRouting() + { + DnsZoneResourceIds = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Whether to enable the Application Routing add-on. + /// Resource IDs of the DNS zones to be associated with the Application Routing add-on. Used only when Application Routing add-on is enabled. Public and private DNS zones can be in different resource groups, but all public DNS zones must be in the same resource group and all private DNS zones must be in the same resource group. + /// Managed identity of the Application Routing add-on. This is the identity that should be granted permissions, for example, to manage the associated Azure DNS resource and get certificates from Azure Key Vault. See [this overview of the add-on](https://learn.microsoft.com/en-us/azure/aks/web-app-routing?tabs=with-osm) for more instructions. + /// Keeps track of any properties unknown to the library. + internal ManagedClusterIngressProfileWebAppRouting(bool? enabled, IList dnsZoneResourceIds, ContainerServiceUserAssignedIdentity identity, IDictionary serializedAdditionalRawData) + { + Enabled = enabled; + DnsZoneResourceIds = dnsZoneResourceIds; + Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Whether to enable the Application Routing add-on. + [WirePath("enabled")] + public bool? Enabled { get; set; } + /// Resource IDs of the DNS zones to be associated with the Application Routing add-on. Used only when Application Routing add-on is enabled. Public and private DNS zones can be in different resource groups, but all public DNS zones must be in the same resource group and all private DNS zones must be in the same resource group. + [WirePath("dnsZoneResourceIds")] + public IList DnsZoneResourceIds { get; } + /// Managed identity of the Application Routing add-on. This is the identity that should be granted permissions, for example, to manage the associated Azure DNS resource and get certificates from Azure Key Vault. See [this overview of the add-on](https://learn.microsoft.com/en-us/azure/aks/web-app-routing?tabs=with-osm) for more instructions. + [WirePath("identity")] + public ContainerServiceUserAssignedIdentity Identity { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.Serialization.cs index 9835a59fa46d..f77cd11c0987 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.Serialization.cs @@ -52,7 +52,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("outboundIPs"u8); writer.WriteObjectValue(OutboundIPs, options); } - if (Optional.IsCollectionDefined(EffectiveOutboundIPs)) + if (options.Format != "W" && Optional.IsCollectionDefined(EffectiveOutboundIPs)) { writer.WritePropertyName("effectiveOutboundIPs"u8); writer.WriteStartArray(); @@ -122,7 +122,7 @@ internal static ManagedClusterLoadBalancerProfile DeserializeManagedClusterLoadB ManagedClusterLoadBalancerProfileManagedOutboundIPs managedOutboundIPs = default; ManagedClusterLoadBalancerProfileOutboundIPPrefixes outboundIPPrefixes = default; ManagedClusterLoadBalancerProfileOutboundIPs outboundIPs = default; - IList effectiveOutboundIPs = default; + IReadOnlyList effectiveOutboundIPs = default; int? allocatedOutboundPorts = default; int? idleTimeoutInMinutes = default; bool? enableMultipleStandardLoadBalancers = default; diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.cs index a40f522564dc..8387020b24af 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.cs @@ -62,7 +62,7 @@ public ManagedClusterLoadBalancerProfile() /// Enable multiple standard load balancers per AKS cluster or not. /// The type of the managed inbound Load Balancer BackendPool. /// Keeps track of any properties unknown to the library. - internal ManagedClusterLoadBalancerProfile(ManagedClusterLoadBalancerProfileManagedOutboundIPs managedOutboundIPs, ManagedClusterLoadBalancerProfileOutboundIPPrefixes outboundIPPrefixes, ManagedClusterLoadBalancerProfileOutboundIPs outboundIPs, IList effectiveOutboundIPs, int? allocatedOutboundPorts, int? idleTimeoutInMinutes, bool? enableMultipleStandardLoadBalancers, ManagedClusterLoadBalancerBackendPoolType? backendPoolType, IDictionary serializedAdditionalRawData) + internal ManagedClusterLoadBalancerProfile(ManagedClusterLoadBalancerProfileManagedOutboundIPs managedOutboundIPs, ManagedClusterLoadBalancerProfileOutboundIPPrefixes outboundIPPrefixes, ManagedClusterLoadBalancerProfileOutboundIPs outboundIPs, IReadOnlyList effectiveOutboundIPs, int? allocatedOutboundPorts, int? idleTimeoutInMinutes, bool? enableMultipleStandardLoadBalancers, ManagedClusterLoadBalancerBackendPoolType? backendPoolType, IDictionary serializedAdditionalRawData) { ManagedOutboundIPs = managedOutboundIPs; OutboundIPPrefixes = outboundIPPrefixes; @@ -108,7 +108,7 @@ public IList OutboundPublicIPs /// The effective outbound IP resources of the cluster load balancer. [WirePath("effectiveOutboundIPs")] - public IList EffectiveOutboundIPs { get; } + public IReadOnlyList EffectiveOutboundIPs { get; } /// The desired number of allocated SNAT ports per VM. Allowed values are in the range of 0 to 64000 (inclusive). The default value is 0 which results in Azure dynamically allocating ports. [WirePath("allocatedOutboundPorts")] public int? AllocatedOutboundPorts { get; set; } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMetricsProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMetricsProfile.Serialization.cs new file mode 100644 index 000000000000..916275a9c3e8 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMetricsProfile.Serialization.cs @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class ManagedClusterMetricsProfile : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterMetricsProfile)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(CostAnalysis)) + { + writer.WritePropertyName("costAnalysis"u8); + writer.WriteObjectValue(CostAnalysis, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ManagedClusterMetricsProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterMetricsProfile)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterMetricsProfile(document.RootElement, options); + } + + internal static ManagedClusterMetricsProfile DeserializeManagedClusterMetricsProfile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ManagedClusterCostAnalysis costAnalysis = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("costAnalysis"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + costAnalysis = ManagedClusterCostAnalysis.DeserializeManagedClusterCostAnalysis(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedClusterMetricsProfile(costAnalysis, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("CostAnalysisEnabled", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" costAnalysis: "); + builder.AppendLine("{"); + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(CostAnalysis)) + { + builder.Append(" costAnalysis: "); + BicepSerializationHelpers.AppendChildObject(builder, CostAnalysis, options, 2, false, " costAnalysis: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ManagedClusterMetricsProfile)} does not support writing '{options.Format}' format."); + } + } + + ManagedClusterMetricsProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeManagedClusterMetricsProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedClusterMetricsProfile)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMetricsProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMetricsProfile.cs new file mode 100644 index 000000000000..32d90c17d3ff --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMetricsProfile.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The metrics profile for the ManagedCluster. + internal partial class ManagedClusterMetricsProfile + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ManagedClusterMetricsProfile() + { + } + + /// Initializes a new instance of . + /// The cost analysis configuration for the cluster. + /// Keeps track of any properties unknown to the library. + internal ManagedClusterMetricsProfile(ManagedClusterCostAnalysis costAnalysis, IDictionary serializedAdditionalRawData) + { + CostAnalysis = costAnalysis; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The cost analysis configuration for the cluster. + internal ManagedClusterCostAnalysis CostAnalysis { get; set; } + /// The Managed Cluster sku.tier must be set to 'Standard' or 'Premium' to enable this feature. Enabling this will add Kubernetes Namespace and Deployment details to the Cost Analysis views in the Azure portal. If not specified, the default is false. For more information see aka.ms/aks/docs/cost-analysis. + [WirePath("costAnalysis.enabled")] + public bool? CostAnalysisEnabled + { + get => CostAnalysis is null ? default : CostAnalysis.Enabled; + set + { + if (CostAnalysis is null) + CostAnalysis = new ManagedClusterCostAnalysis(); + CostAnalysis.Enabled = value; + } + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNatGatewayProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNatGatewayProfile.Serialization.cs index f4855f3718a6..c34423ab1833 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNatGatewayProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNatGatewayProfile.Serialization.cs @@ -42,7 +42,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("managedOutboundIPProfile"u8); writer.WriteObjectValue(ManagedOutboundIPProfile, options); } - if (Optional.IsCollectionDefined(EffectiveOutboundIPs)) + if (options.Format != "W" && Optional.IsCollectionDefined(EffectiveOutboundIPs)) { writer.WritePropertyName("effectiveOutboundIPs"u8); writer.WriteStartArray(); @@ -95,7 +95,7 @@ internal static ManagedClusterNatGatewayProfile DeserializeManagedClusterNatGate return null; } ManagedClusterManagedOutboundIPProfile managedOutboundIPProfile = default; - IList effectiveOutboundIPs = default; + IReadOnlyList effectiveOutboundIPs = default; int? idleTimeoutInMinutes = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNatGatewayProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNatGatewayProfile.cs index 047d979ffec0..70c6a33d445b 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNatGatewayProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNatGatewayProfile.cs @@ -57,7 +57,7 @@ public ManagedClusterNatGatewayProfile() /// The effective outbound IP resources of the cluster NAT gateway. /// Desired outbound flow idle timeout in minutes. Allowed values are in the range of 4 to 120 (inclusive). The default value is 4 minutes. /// Keeps track of any properties unknown to the library. - internal ManagedClusterNatGatewayProfile(ManagedClusterManagedOutboundIPProfile managedOutboundIPProfile, IList effectiveOutboundIPs, int? idleTimeoutInMinutes, IDictionary serializedAdditionalRawData) + internal ManagedClusterNatGatewayProfile(ManagedClusterManagedOutboundIPProfile managedOutboundIPProfile, IReadOnlyList effectiveOutboundIPs, int? idleTimeoutInMinutes, IDictionary serializedAdditionalRawData) { ManagedOutboundIPProfile = managedOutboundIPProfile; EffectiveOutboundIPs = effectiveOutboundIPs; @@ -82,7 +82,7 @@ public int? ManagedOutboundIPCount /// The effective outbound IP resources of the cluster NAT gateway. [WirePath("effectiveOutboundIPs")] - public IList EffectiveOutboundIPs { get; } + public IReadOnlyList EffectiveOutboundIPs { get; } /// Desired outbound flow idle timeout in minutes. Allowed values are in the range of 4 to 120 (inclusive). The default value is 4 minutes. [WirePath("idleTimeoutInMinutes")] public int? IdleTimeoutInMinutes { get; set; } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeOSUpgradeChannel.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeOSUpgradeChannel.cs index 5fd9240d2cc8..662e9289216a 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeOSUpgradeChannel.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeOSUpgradeChannel.cs @@ -25,6 +25,7 @@ public ManagedClusterNodeOSUpgradeChannel(string value) private const string NoneValue = "None"; private const string UnmanagedValue = "Unmanaged"; private const string NodeImageValue = "NodeImage"; + private const string SecurityPatchValue = "SecurityPatch"; /// No attempt to update your machines OS will be made either by OS or by rolling VHDs. This means you are responsible for your security updates. public static ManagedClusterNodeOSUpgradeChannel None { get; } = new ManagedClusterNodeOSUpgradeChannel(NoneValue); @@ -32,6 +33,8 @@ public ManagedClusterNodeOSUpgradeChannel(string value) public static ManagedClusterNodeOSUpgradeChannel Unmanaged { get; } = new ManagedClusterNodeOSUpgradeChannel(UnmanagedValue); /// AKS will update the nodes with a newly patched VHD containing security fixes and bugfixes on a weekly cadence. With the VHD update machines will be rolling reimaged to that VHD following maintenance windows and surge settings. No extra VHD cost is incurred when choosing this option as AKS hosts the images. public static ManagedClusterNodeOSUpgradeChannel NodeImage { get; } = new ManagedClusterNodeOSUpgradeChannel(NodeImageValue); + /// AKS downloads and updates the nodes with tested security updates. These updates honor the maintenance window settings and produce a new VHD that is used on new nodes. On some occasions it's not possible to apply the updates in place, in such cases the existing nodes will also be re-imaged to the newly produced VHD in order to apply the changes. This option incurs an extra cost of hosting the new Security Patch VHDs in your resource group for just in time consumption. + public static ManagedClusterNodeOSUpgradeChannel SecurityPatch { get; } = new ManagedClusterNodeOSUpgradeChannel(SecurityPatchValue); /// Determines if two values are the same. public static bool operator ==(ManagedClusterNodeOSUpgradeChannel left, ManagedClusterNodeOSUpgradeChannel right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeResourceGroupProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeResourceGroupProfile.Serialization.cs new file mode 100644 index 000000000000..bfcb18ea5ef9 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeResourceGroupProfile.Serialization.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class ManagedClusterNodeResourceGroupProfile : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterNodeResourceGroupProfile)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(RestrictionLevel)) + { + writer.WritePropertyName("restrictionLevel"u8); + writer.WriteStringValue(RestrictionLevel.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ManagedClusterNodeResourceGroupProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterNodeResourceGroupProfile)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterNodeResourceGroupProfile(document.RootElement, options); + } + + internal static ManagedClusterNodeResourceGroupProfile DeserializeManagedClusterNodeResourceGroupProfile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RestrictionLevel? restrictionLevel = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("restrictionLevel"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + restrictionLevel = new RestrictionLevel(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedClusterNodeResourceGroupProfile(restrictionLevel, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RestrictionLevel), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" restrictionLevel: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RestrictionLevel)) + { + builder.Append(" restrictionLevel: "); + builder.AppendLine($"'{RestrictionLevel.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ManagedClusterNodeResourceGroupProfile)} does not support writing '{options.Format}' format."); + } + } + + ManagedClusterNodeResourceGroupProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeManagedClusterNodeResourceGroupProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedClusterNodeResourceGroupProfile)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeResourceGroupProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeResourceGroupProfile.cs new file mode 100644 index 000000000000..c81245ee27f2 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeResourceGroupProfile.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Node resource group lockdown profile for a managed cluster. + internal partial class ManagedClusterNodeResourceGroupProfile + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ManagedClusterNodeResourceGroupProfile() + { + } + + /// Initializes a new instance of . + /// The restriction level applied to the cluster's node resource group. If not specified, the default is 'Unrestricted'. + /// Keeps track of any properties unknown to the library. + internal ManagedClusterNodeResourceGroupProfile(RestrictionLevel? restrictionLevel, IDictionary serializedAdditionalRawData) + { + RestrictionLevel = restrictionLevel; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The restriction level applied to the cluster's node resource group. If not specified, the default is 'Unrestricted'. + [WirePath("restrictionLevel")] + public RestrictionLevel? RestrictionLevel { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfile.Serialization.cs index e7681b75528a..f0c7f5ddc71d 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfile.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Linq; using System.Text; using System.Text.Json; using Azure.Core; @@ -55,6 +56,16 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("imageCleaner"u8); writer.WriteObjectValue(ImageCleaner, options); } + if (Optional.IsCollectionDefined(CustomCATrustCertificates)) + { + writer.WritePropertyName("customCATrustCertificates"u8); + writer.WriteStartArray(); + foreach (var item in CustomCATrustCertificates) + { + writer.WriteBase64StringValue(item, "D"); + } + writer.WriteEndArray(); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -96,6 +107,7 @@ internal static ManagedClusterSecurityProfile DeserializeManagedClusterSecurityP ManagedClusterSecurityProfileKeyVaultKms azureKeyVaultKms = default; ManagedClusterSecurityProfileWorkloadIdentity workloadIdentity = default; ManagedClusterSecurityProfileImageCleaner imageCleaner = default; + IList customCATrustCertificates = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -136,13 +148,33 @@ internal static ManagedClusterSecurityProfile DeserializeManagedClusterSecurityP imageCleaner = ManagedClusterSecurityProfileImageCleaner.DeserializeManagedClusterSecurityProfileImageCleaner(property.Value, options); continue; } + if (property.NameEquals("customCATrustCertificates"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetBytesFromBase64("D")); + } + customCATrustCertificates = array; + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterSecurityProfile(defender, azureKeyVaultKms, workloadIdentity, imageCleaner, serializedAdditionalRawData); + return new ManagedClusterSecurityProfile( + defender, + azureKeyVaultKms, + workloadIdentity, + imageCleaner, + customCATrustCertificates ?? new ChangeTrackingList(), + serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -219,6 +251,34 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CustomCATrustCertificates), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" customCATrustCertificates: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(CustomCATrustCertificates)) + { + if (CustomCATrustCertificates.Any()) + { + builder.Append(" customCATrustCertificates: "); + builder.AppendLine("["); + foreach (var item in CustomCATrustCertificates) + { + if (item == null) + { + builder.Append("null"); + continue; + } + builder.AppendLine($" '{item.ToString()}'"); + } + builder.AppendLine(" ]"); + } + } + } + builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfile.cs index 65d99a578005..9153021ea6fa 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfile.cs @@ -48,6 +48,7 @@ public partial class ManagedClusterSecurityProfile /// Initializes a new instance of . public ManagedClusterSecurityProfile() { + CustomCATrustCertificates = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -55,13 +56,15 @@ public ManagedClusterSecurityProfile() /// Azure Key Vault [key management service](https://kubernetes.io/docs/tasks/administer-cluster/kms-provider/) settings for the security profile. /// Workload identity settings for the security profile. Workload identity enables Kubernetes applications to access Azure cloud resources securely with Azure AD. See https://aka.ms/aks/wi for more details. /// Image Cleaner settings for the security profile. + /// A list of up to 10 base64 encoded CAs that will be added to the trust store on all nodes in the cluster. For more information see [Custom CA Trust Certificates](https://learn.microsoft.com/en-us/azure/aks/custom-certificate-authority). /// Keeps track of any properties unknown to the library. - internal ManagedClusterSecurityProfile(ManagedClusterSecurityProfileDefender defender, ManagedClusterSecurityProfileKeyVaultKms azureKeyVaultKms, ManagedClusterSecurityProfileWorkloadIdentity workloadIdentity, ManagedClusterSecurityProfileImageCleaner imageCleaner, IDictionary serializedAdditionalRawData) + internal ManagedClusterSecurityProfile(ManagedClusterSecurityProfileDefender defender, ManagedClusterSecurityProfileKeyVaultKms azureKeyVaultKms, ManagedClusterSecurityProfileWorkloadIdentity workloadIdentity, ManagedClusterSecurityProfileImageCleaner imageCleaner, IList customCATrustCertificates, IDictionary serializedAdditionalRawData) { Defender = defender; AzureKeyVaultKms = azureKeyVaultKms; WorkloadIdentity = workloadIdentity; ImageCleaner = imageCleaner; + CustomCATrustCertificates = customCATrustCertificates; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -89,5 +92,8 @@ public bool? IsWorkloadIdentityEnabled /// Image Cleaner settings for the security profile. [WirePath("imageCleaner")] public ManagedClusterSecurityProfileImageCleaner ImageCleaner { get; set; } + /// A list of up to 10 base64 encoded CAs that will be added to the trust store on all nodes in the cluster. For more information see [Custom CA Trust Certificates](https://learn.microsoft.com/en-us/azure/aks/custom-certificate-authority). + [WirePath("customCATrustCertificates")] + public IList CustomCATrustCertificates { get; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/RestrictionLevel.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/RestrictionLevel.cs new file mode 100644 index 000000000000..df1e65439664 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/RestrictionLevel.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The restriction level applied to the cluster's node resource group. If not specified, the default is 'Unrestricted'. + public readonly partial struct RestrictionLevel : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RestrictionLevel(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnrestrictedValue = "Unrestricted"; + private const string ReadOnlyValue = "ReadOnly"; + + /// All RBAC permissions are allowed on the managed node resource group. + public static RestrictionLevel Unrestricted { get; } = new RestrictionLevel(UnrestrictedValue); + /// Only */read RBAC permissions allowed on the managed node resource group. + public static RestrictionLevel ReadOnly { get; } = new RestrictionLevel(ReadOnlyValue); + /// Determines if two values are the same. + public static bool operator ==(RestrictionLevel left, RestrictionLevel right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RestrictionLevel left, RestrictionLevel right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator RestrictionLevel(string value) => new RestrictionLevel(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RestrictionLevel other && Equals(other); + /// + public bool Equals(RestrictionLevel other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileResource.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileResource.Serialization.cs deleted file mode 100644 index 506123d852f4..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileResource.Serialization.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; - -namespace Azure.ResourceManager.ContainerService -{ - public partial class OSOptionProfileResource : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - OSOptionProfileData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); - - OSOptionProfileData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/AgentPoolsRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/AgentPoolsRestOperations.cs index 4700f59edb16..89f421e1aa31 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/AgentPoolsRestOperations.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/AgentPoolsRestOperations.cs @@ -32,7 +32,7 @@ public AgentPoolsRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-10-01"; + _apiVersion = apiVersion ?? "2025-01-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -328,7 +328,7 @@ public Response Get(string subscriptionId, string } } - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, ContainerServiceAgentPoolData data) + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, ContainerServiceAgentPoolData data, string ifMatch, string ifNoneMatch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -344,7 +344,7 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, return uri; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, ContainerServiceAgentPoolData data) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, ContainerServiceAgentPoolData data, string ifMatch, string ifNoneMatch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -361,6 +361,14 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r uri.AppendPath(agentPoolName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } + if (ifNoneMatch != null) + { + request.Headers.Add("If-None-Match", ifNoneMatch); + } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); @@ -376,10 +384,12 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r /// The name of the managed cluster resource. /// The name of the agent pool. /// The agent pool to create or update. + /// The request should only proceed if an entity matches this string. + /// The request should only proceed if no entity matches this string. /// The cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, ContainerServiceAgentPoolData data, CancellationToken cancellationToken = default) + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, ContainerServiceAgentPoolData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -387,7 +397,7 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName, data); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName, data, ifMatch, ifNoneMatch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -405,10 +415,12 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re /// The name of the managed cluster resource. /// The name of the agent pool. /// The agent pool to create or update. + /// The request should only proceed if an entity matches this string. + /// The request should only proceed if no entity matches this string. /// The cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, ContainerServiceAgentPoolData data, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, ContainerServiceAgentPoolData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -416,7 +428,7 @@ public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName, data); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName, data, ifMatch, ifNoneMatch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -428,7 +440,7 @@ public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, } } - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName) + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, bool? ignorePodDisruptionBudget, string ifMatch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -441,10 +453,14 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath("/agentPools/", false); uri.AppendPath(agentPoolName, true); uri.AppendQuery("api-version", _apiVersion, true); + if (ignorePodDisruptionBudget != null) + { + uri.AppendQuery("ignore-pod-disruption-budget", ignorePodDisruptionBudget.Value, true); + } return uri; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, bool? ignorePodDisruptionBudget, string ifMatch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -460,7 +476,15 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath("/agentPools/", false); uri.AppendPath(agentPoolName, true); uri.AppendQuery("api-version", _apiVersion, true); + if (ignorePodDisruptionBudget != null) + { + uri.AppendQuery("ignore-pod-disruption-budget", ignorePodDisruptionBudget.Value, true); + } request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; @@ -471,17 +495,19 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG /// The name of the resource group. The name is case insensitive. /// The name of the managed cluster resource. /// The name of the agent pool. + /// ignore-pod-disruption-budget=true to delete those pods on a node without considering Pod Disruption Budget. + /// The request should only proceed if an entity matches this string. /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, CancellationToken cancellationToken = default) + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, bool? ignorePodDisruptionBudget = null, string ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName, ignorePodDisruptionBudget, ifMatch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -498,17 +524,19 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr /// The name of the resource group. The name is case insensitive. /// The name of the managed cluster resource. /// The name of the agent pool. + /// ignore-pod-disruption-budget=true to delete those pods on a node without considering Pod Disruption Budget. + /// The request should only proceed if an entity matches this string. /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, CancellationToken cancellationToken = default) + public Response Delete(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, bool? ignorePodDisruptionBudget = null, string ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName, ignorePodDisruptionBudget, ifMatch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -626,6 +654,106 @@ public Response GetUpgradeProfile(string subscripti } } + internal RequestUriBuilder CreateDeleteMachinesRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, AgentPoolDeleteMachinesParameter machines) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/agentPools/", false); + uri.AppendPath(agentPoolName, true); + uri.AppendPath("/deleteMachines", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteMachinesRequest(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, AgentPoolDeleteMachinesParameter machines) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/agentPools/", false); + uri.AppendPath(agentPoolName, true); + uri.AppendPath("/deleteMachines", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(machines, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Deletes specific machines in an agent pool. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The name of the agent pool. + /// A list of machines from the agent pool to be deleted. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteMachinesAsync(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, AgentPoolDeleteMachinesParameter machines, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); + Argument.AssertNotNull(machines, nameof(machines)); + + using var message = CreateDeleteMachinesRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName, machines); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes specific machines in an agent pool. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The name of the agent pool. + /// A list of machines from the agent pool to be deleted. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response DeleteMachines(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, AgentPoolDeleteMachinesParameter machines, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); + Argument.AssertNotNull(machines, nameof(machines)); + + using var message = CreateDeleteMachinesRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName, machines); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + internal RequestUriBuilder CreateGetAvailableAgentPoolVersionsRequestUri(string subscriptionId, string resourceGroupName, string resourceName) { var uri = new RawRequestUriBuilder(); diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/MachinesRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/MachinesRestOperations.cs new file mode 100644 index 000000000000..bb5b637e8c47 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/MachinesRestOperations.cs @@ -0,0 +1,341 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ContainerService.Models; + +namespace Azure.ResourceManager.ContainerService +{ + internal partial class MachinesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of MachinesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public MachinesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2025-01-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/agentPools/", false); + uri.AppendPath(agentPoolName, true); + uri.AppendPath("/machines", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/agentPools/", false); + uri.AppendPath(agentPoolName, true); + uri.AppendPath("/machines", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a list of machines in the specified agent pool. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The name of the agent pool. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MachineListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = MachineListResult.DeserializeMachineListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of machines in the specified agent pool. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The name of the agent pool. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MachineListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = MachineListResult.DeserializeMachineListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, string machineName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/agentPools/", false); + uri.AppendPath(agentPoolName, true); + uri.AppendPath("/machines/", false); + uri.AppendPath(machineName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, string machineName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/agentPools/", false); + uri.AppendPath(agentPoolName, true); + uri.AppendPath("/machines/", false); + uri.AppendPath(machineName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a specific machine in the specified agent pool. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The name of the agent pool. + /// host name of the machine. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, string machineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); + Argument.AssertNotNullOrEmpty(machineName, nameof(machineName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName, machineName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MachineData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = MachineData.DeserializeMachineData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((MachineData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a specific machine in the specified agent pool. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The name of the agent pool. + /// host name of the machine. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, string machineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); + Argument.AssertNotNullOrEmpty(machineName, nameof(machineName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName, machineName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MachineData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = MachineData.DeserializeMachineData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((MachineData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a list of machines in the specified agent pool. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The name of the agent pool. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, resourceName, agentPoolName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MachineListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = MachineListResult.DeserializeMachineListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of machines in the specified agent pool. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The name of the agent pool. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, resourceName, agentPoolName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MachineListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = MachineListResult.DeserializeMachineListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/MaintenanceConfigurationsRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/MaintenanceConfigurationsRestOperations.cs index 85c36138e890..a19fa8298e77 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/MaintenanceConfigurationsRestOperations.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/MaintenanceConfigurationsRestOperations.cs @@ -32,7 +32,7 @@ public MaintenanceConfigurationsRestOperations(HttpPipeline pipeline, string app { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-10-01"; + _apiVersion = apiVersion ?? "2025-01-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ManagedClustersRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ManagedClustersRestOperations.cs index cd05eefd8423..b75923518665 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ManagedClustersRestOperations.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ManagedClustersRestOperations.cs @@ -32,108 +32,10 @@ public ManagedClustersRestOperations(HttpPipeline pipeline, string applicationId { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-10-01"; + _apiVersion = apiVersion ?? "2025-01-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateGetOSOptionsRequestUri(string subscriptionId, AzureLocation location, ResourceType? resourceType) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.ContainerService/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/osOptions/default", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (resourceType != null) - { - uri.AppendQuery("resource-type", resourceType.Value, true); - } - return uri; - } - - internal HttpMessage CreateGetOSOptionsRequest(string subscriptionId, AzureLocation location, ResourceType? resourceType) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.ContainerService/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/osOptions/default", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (resourceType != null) - { - uri.AppendQuery("resource-type", resourceType.Value, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Gets supported OS options in the specified subscription. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// The resource type for which the OS options needs to be returned. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> GetOSOptionsAsync(string subscriptionId, AzureLocation location, ResourceType? resourceType = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateGetOSOptionsRequest(subscriptionId, location, resourceType); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - OSOptionProfileData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = OSOptionProfileData.DeserializeOSOptionProfileData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((OSOptionProfileData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets supported OS options in the specified subscription. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// The resource type for which the OS options needs to be returned. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response GetOSOptions(string subscriptionId, AzureLocation location, ResourceType? resourceType = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateGetOSOptionsRequest(subscriptionId, location, resourceType); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - OSOptionProfileData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = OSOptionProfileData.DeserializeOSOptionProfileData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((OSOptionProfileData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - internal RequestUriBuilder CreateListKubernetesVersionsRequestUri(string subscriptionId, AzureLocation location) { var uri = new RawRequestUriBuilder(); @@ -1000,7 +902,7 @@ public Response Get(string subscriptionId, s } } - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceManagedClusterData data) + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceManagedClusterData data, string ifMatch, string ifNoneMatch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -1014,7 +916,7 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, return uri; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceManagedClusterData data) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceManagedClusterData data, string ifMatch, string ifNoneMatch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1029,6 +931,14 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r uri.AppendPath(resourceName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } + if (ifNoneMatch != null) + { + request.Headers.Add("If-None-Match", ifNoneMatch); + } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); @@ -1043,17 +953,19 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r /// The name of the resource group. The name is case insensitive. /// The name of the managed cluster resource. /// The managed cluster to create or update. + /// The request should only proceed if an entity matches this string. + /// The request should only proceed if no entity matches this string. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceManagedClusterData data, CancellationToken cancellationToken = default) + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceManagedClusterData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, resourceName, data); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, resourceName, data, ifMatch, ifNoneMatch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1070,17 +982,19 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re /// The name of the resource group. The name is case insensitive. /// The name of the managed cluster resource. /// The managed cluster to create or update. + /// The request should only proceed if an entity matches this string. + /// The request should only proceed if no entity matches this string. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceManagedClusterData data, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceManagedClusterData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, resourceName, data); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, resourceName, data, ifMatch, ifNoneMatch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -1092,7 +1006,7 @@ public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, } } - internal RequestUriBuilder CreateUpdateTagsRequestUri(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceTagsObject containerServiceTagsObject) + internal RequestUriBuilder CreateUpdateTagsRequestUri(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceTagsObject containerServiceTagsObject, string ifMatch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -1106,7 +1020,7 @@ internal RequestUriBuilder CreateUpdateTagsRequestUri(string subscriptionId, str return uri; } - internal HttpMessage CreateUpdateTagsRequest(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceTagsObject containerServiceTagsObject) + internal HttpMessage CreateUpdateTagsRequest(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceTagsObject containerServiceTagsObject, string ifMatch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1121,6 +1035,10 @@ internal HttpMessage CreateUpdateTagsRequest(string subscriptionId, string resou uri.AppendPath(resourceName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); @@ -1135,17 +1053,18 @@ internal HttpMessage CreateUpdateTagsRequest(string subscriptionId, string resou /// The name of the resource group. The name is case insensitive. /// The name of the managed cluster resource. /// Parameters supplied to the Update Managed Cluster Tags operation. + /// The request should only proceed if an entity matches this string. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task UpdateTagsAsync(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceTagsObject containerServiceTagsObject, CancellationToken cancellationToken = default) + public async Task UpdateTagsAsync(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceTagsObject containerServiceTagsObject, string ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); Argument.AssertNotNull(containerServiceTagsObject, nameof(containerServiceTagsObject)); - using var message = CreateUpdateTagsRequest(subscriptionId, resourceGroupName, resourceName, containerServiceTagsObject); + using var message = CreateUpdateTagsRequest(subscriptionId, resourceGroupName, resourceName, containerServiceTagsObject, ifMatch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1161,17 +1080,18 @@ public async Task UpdateTagsAsync(string subscriptionId, string resour /// The name of the resource group. The name is case insensitive. /// The name of the managed cluster resource. /// Parameters supplied to the Update Managed Cluster Tags operation. + /// The request should only proceed if an entity matches this string. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response UpdateTags(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceTagsObject containerServiceTagsObject, CancellationToken cancellationToken = default) + public Response UpdateTags(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceTagsObject containerServiceTagsObject, string ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); Argument.AssertNotNull(containerServiceTagsObject, nameof(containerServiceTagsObject)); - using var message = CreateUpdateTagsRequest(subscriptionId, resourceGroupName, resourceName, containerServiceTagsObject); + using var message = CreateUpdateTagsRequest(subscriptionId, resourceGroupName, resourceName, containerServiceTagsObject, ifMatch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -1182,7 +1102,7 @@ public Response UpdateTags(string subscriptionId, string resourceGroupName, stri } } - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string resourceName) + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string ifMatch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -1196,7 +1116,7 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string resourceName) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string resourceName, string ifMatch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1211,6 +1131,10 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath(resourceName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; @@ -1220,16 +1144,17 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the managed cluster resource. + /// The request should only proceed if an entity matches this string. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string resourceName, string ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName, ifMatch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1245,16 +1170,17 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the managed cluster resource. + /// The request should only proceed if an entity matches this string. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + public Response Delete(string subscriptionId, string resourceGroupName, string resourceName, string ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName, ifMatch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs index 69d51fb6d1d0..e97303d4414b 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs @@ -32,7 +32,7 @@ public PrivateEndpointConnectionsRestOperations(HttpPipeline pipeline, string ap { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-10-01"; + _apiVersion = apiVersion ?? "2025-01-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs index b7313ad968ed..9d2ae708bec0 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs @@ -32,7 +32,7 @@ public PrivateLinkResourcesRestOperations(HttpPipeline pipeline, string applicat { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-10-01"; + _apiVersion = apiVersion ?? "2025-01-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ResolvePrivateLinkServiceIdRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ResolvePrivateLinkServiceIdRestOperations.cs index f7680dc72cdc..67c531a57a92 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ResolvePrivateLinkServiceIdRestOperations.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ResolvePrivateLinkServiceIdRestOperations.cs @@ -32,7 +32,7 @@ public ResolvePrivateLinkServiceIdRestOperations(HttpPipeline pipeline, string a { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-10-01"; + _apiVersion = apiVersion ?? "2025-01-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/SnapshotsRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/SnapshotsRestOperations.cs index 54f88932263d..00e76f00ac99 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/SnapshotsRestOperations.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/SnapshotsRestOperations.cs @@ -32,7 +32,7 @@ public SnapshotsRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-10-01"; + _apiVersion = apiVersion ?? "2025-01-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/TrustedAccessRoleBindingsRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/TrustedAccessRoleBindingsRestOperations.cs index 0ac7e97fa71c..bff6907c8012 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/TrustedAccessRoleBindingsRestOperations.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/TrustedAccessRoleBindingsRestOperations.cs @@ -32,7 +32,7 @@ public TrustedAccessRoleBindingsRestOperations(HttpPipeline pipeline, string app { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-10-01"; + _apiVersion = apiVersion ?? "2025-01-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/TrustedAccessRolesRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/TrustedAccessRolesRestOperations.cs index 5e561646f440..1b4d2684edbb 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/TrustedAccessRolesRestOperations.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/TrustedAccessRolesRestOperations.cs @@ -32,7 +32,7 @@ public TrustedAccessRolesRestOperations(HttpPipeline pipeline, string applicatio { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-10-01"; + _apiVersion = apiVersion ?? "2025-01-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/autorest.md b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/autorest.md index c904c624099b..bb994b961d52 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/autorest.md +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/autorest.md @@ -8,7 +8,7 @@ azure-arm: true csharp: true library-name: ContainerService namespace: Azure.ResourceManager.ContainerService -require: https://github.com/Azure/azure-rest-api-specs/blob/8e674dd2a88ae73868c6fa7593a0ba4371e45991/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/readme.md #tag: package-2023-10 output-folder: $(this-folder)/Generated clear-output-folder: true diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/Azure.ResourceManager.DurableTask.sln b/sdk/durabletask/Azure.ResourceManager.DurableTask/Azure.ResourceManager.DurableTask.sln new file mode 100644 index 000000000000..4564bbd5499e --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/Azure.ResourceManager.DurableTask.sln @@ -0,0 +1,56 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29709.97 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.DurableTask.Samples", "samples\Azure.ResourceManager.DurableTask.Samples.csproj", "{7A2DFF15-5746-49F4-BD0F-C6C35337088A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.DurableTask", "src\Azure.ResourceManager.DurableTask.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.DurableTask.Tests", "tests\Azure.ResourceManager.DurableTask.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU + {7A2DFF15-5746-49F4-BD0F-C6C35337088A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7A2DFF15-5746-49F4-BD0F-C6C35337088A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7A2DFF15-5746-49F4-BD0F-C6C35337088A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7A2DFF15-5746-49F4-BD0F-C6C35337088A}.Release|Any CPU.Build.0 = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE} + EndGlobalSection +EndGlobal diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/CHANGELOG.md b/sdk/durabletask/Azure.ResourceManager.DurableTask/CHANGELOG.md new file mode 100644 index 000000000000..8b33f0fedccc --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes \ No newline at end of file diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/Directory.Build.props b/sdk/durabletask/Azure.ResourceManager.DurableTask/Directory.Build.props new file mode 100644 index 000000000000..63bd836ad44b --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/README.md b/sdk/durabletask/Azure.ResourceManager.DurableTask/README.md new file mode 100644 index 000000000000..61c6950f4999 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/README.md @@ -0,0 +1,80 @@ +# Microsoft Azure DurableTask management client library for .NET + +**[Describe the service briefly first.]** + +This library follows the [new Azure SDK guidelines](https://azure.github.io/azure-sdk/general_introduction.html), and provides many core capabilities: + + - Support MSAL.NET, Azure.Identity is out of box for supporting MSAL.NET. + - Support [OpenTelemetry](https://opentelemetry.io/) for distributed tracing. + - HTTP pipeline with custom policies. + - Better error-handling. + - Support uniform telemetry across all languages. + +## Getting started + +### Install the package + +Install the Microsoft Azure DurableTask management library for .NET with [NuGet](https://www.nuget.org/): + +```dotnetcli +dotnet add package Azure.ResourceManager.DurableTask --prerelease +``` + +### Prerequisites + +* You must have an [Microsoft Azure subscription](https://azure.microsoft.com/free/dotnet/). + +### Authenticate the Client + +To create an authenticated client and start interacting with Microsoft Azure resources, see the [quickstart guide here](https://github.com/Azure/azure-sdk-for-net/blob/main/doc/dev/mgmt_quickstart.md). + +## Key concepts + +Key concepts of the Microsoft Azure SDK for .NET can be found [here](https://azure.github.io/azure-sdk/dotnet_introduction.html) + +## Documentation + +Documentation is available to help you learn how to use this package: + +- [Quickstart](https://github.com/Azure/azure-sdk-for-net/blob/main/doc/dev/mgmt_quickstart.md). +- [API References](https://learn.microsoft.com/dotnet/api/?view=azure-dotnet). +- [Authentication](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/README.md). + +## Examples + +Code samples for using the management library for .NET can be found in the following locations +- [.NET Management Library Code Samples](https://aka.ms/azuresdk-net-mgmt-samples) + +## Troubleshooting + +- File an issue via [GitHub Issues](https://github.com/Azure/azure-sdk-for-net/issues). +- Check [previous questions](https://stackoverflow.com/questions/tagged/azure+.net) or ask new ones on Stack Overflow using Azure and .NET tags. + +## Next steps + +For more information about Microsoft Azure SDK, see [this website](https://azure.github.io/azure-sdk/). + +## Contributing + +For details on contributing to this repository, see the [contributing +guide][cg]. + +This project welcomes contributions and suggestions. Most contributions +require you to agree to a Contributor License Agreement (CLA) declaring +that you have the right to, and actually do, grant us the rights to use +your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine +whether you need to provide a CLA and decorate the PR appropriately +(for example, label, comment). Follow the instructions provided by the +bot. You'll only need to do this action once across all repositories +using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For +more information, see the [Code of Conduct FAQ][coc_faq] or contact + with any other questions or comments. + + +[cg]: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/resourcemanager/Azure.ResourceManager/docs/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ \ No newline at end of file diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/api/Azure.ResourceManager.DurableTask.net8.0.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/api/Azure.ResourceManager.DurableTask.net8.0.cs new file mode 100644 index 000000000000..ede053490d5f --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/api/Azure.ResourceManager.DurableTask.net8.0.cs @@ -0,0 +1,270 @@ +namespace Azure.ResourceManager.DurableTask +{ + public static partial class DurableTaskExtensions + { + public static Azure.Response GetScheduler(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetSchedulerAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DurableTask.SchedulerResource GetSchedulerResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DurableTask.SchedulerCollection GetSchedulers(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetSchedulers(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetSchedulersAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DurableTask.TaskHubResource GetTaskHubResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class SchedulerCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected SchedulerCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string schedulerName, Azure.ResourceManager.DurableTask.SchedulerData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string schedulerName, Azure.ResourceManager.DurableTask.SchedulerData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class SchedulerData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SchedulerData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.DurableTask.Models.SchedulerProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.SchedulerData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.SchedulerData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SchedulerResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected SchedulerResource() { } + public virtual Azure.ResourceManager.DurableTask.SchedulerData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string schedulerName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetTaskHub(string taskHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetTaskHubAsync(string taskHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DurableTask.TaskHubCollection GetTaskHubs() { throw null; } + public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.DurableTask.SchedulerData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.SchedulerData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DurableTask.Models.SchedulerPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DurableTask.Models.SchedulerPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class TaskHubCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected TaskHubCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string taskHubName, Azure.ResourceManager.DurableTask.TaskHubData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string taskHubName, Azure.ResourceManager.DurableTask.TaskHubData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string taskHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string taskHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string taskHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string taskHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string taskHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string taskHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class TaskHubData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public TaskHubData() { } + public Azure.ResourceManager.DurableTask.Models.TaskHubProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.TaskHubData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.TaskHubData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class TaskHubResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected TaskHubResource() { } + public virtual Azure.ResourceManager.DurableTask.TaskHubData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string schedulerName, string taskHubName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.DurableTask.TaskHubData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.TaskHubData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DurableTask.TaskHubData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DurableTask.TaskHubData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.DurableTask.Mocking +{ + public partial class MockableDurableTaskArmClient : Azure.ResourceManager.ArmResource + { + protected MockableDurableTaskArmClient() { } + public virtual Azure.ResourceManager.DurableTask.SchedulerResource GetSchedulerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DurableTask.TaskHubResource GetTaskHubResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableDurableTaskResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableDurableTaskResourceGroupResource() { } + public virtual Azure.Response GetScheduler(string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSchedulerAsync(string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DurableTask.SchedulerCollection GetSchedulers() { throw null; } + } + public partial class MockableDurableTaskSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableDurableTaskSubscriptionResource() { } + public virtual Azure.Pageable GetSchedulers(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSchedulersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.DurableTask.Models +{ + public static partial class ArmDurableTaskModelFactory + { + public static Azure.ResourceManager.DurableTask.SchedulerData SchedulerData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.DurableTask.Models.SchedulerProperties properties = null) { throw null; } + public static Azure.ResourceManager.DurableTask.Models.SchedulerProperties SchedulerProperties(Azure.ResourceManager.DurableTask.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.DurableTask.Models.ProvisioningState?), string endpoint = null, System.Collections.Generic.IEnumerable ipAllowlist = null, Azure.ResourceManager.DurableTask.Models.SchedulerSku sku = null) { throw null; } + public static Azure.ResourceManager.DurableTask.Models.SchedulerPropertiesUpdate SchedulerPropertiesUpdate(Azure.ResourceManager.DurableTask.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.DurableTask.Models.ProvisioningState?), string endpoint = null, System.Collections.Generic.IEnumerable ipAllowlist = null, Azure.ResourceManager.DurableTask.Models.SchedulerSkuUpdate sku = null) { throw null; } + public static Azure.ResourceManager.DurableTask.Models.SchedulerSku SchedulerSku(string name = null, int? capacity = default(int?), Azure.ResourceManager.DurableTask.Models.RedundancyState? redundancyState = default(Azure.ResourceManager.DurableTask.Models.RedundancyState?)) { throw null; } + public static Azure.ResourceManager.DurableTask.Models.SchedulerSkuUpdate SchedulerSkuUpdate(string name = null, int? capacity = default(int?), Azure.ResourceManager.DurableTask.Models.RedundancyState? redundancyState = default(Azure.ResourceManager.DurableTask.Models.RedundancyState?)) { throw null; } + public static Azure.ResourceManager.DurableTask.TaskHubData TaskHubData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.DurableTask.Models.TaskHubProperties properties = null) { throw null; } + public static Azure.ResourceManager.DurableTask.Models.TaskHubProperties TaskHubProperties(Azure.ResourceManager.DurableTask.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.DurableTask.Models.ProvisioningState?), System.Uri dashboardUri = null) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.DurableTask.Models.ProvisioningState Accepted { get { throw null; } } + public static Azure.ResourceManager.DurableTask.Models.ProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.DurableTask.Models.ProvisioningState Deleting { get { throw null; } } + public static Azure.ResourceManager.DurableTask.Models.ProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.DurableTask.Models.ProvisioningState Provisioning { get { throw null; } } + public static Azure.ResourceManager.DurableTask.Models.ProvisioningState Succeeded { get { throw null; } } + public static Azure.ResourceManager.DurableTask.Models.ProvisioningState Updating { get { throw null; } } + public bool Equals(Azure.ResourceManager.DurableTask.Models.ProvisioningState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.DurableTask.Models.ProvisioningState left, Azure.ResourceManager.DurableTask.Models.ProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.DurableTask.Models.ProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DurableTask.Models.ProvisioningState left, Azure.ResourceManager.DurableTask.Models.ProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct RedundancyState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public RedundancyState(string value) { throw null; } + public static Azure.ResourceManager.DurableTask.Models.RedundancyState None { get { throw null; } } + public static Azure.ResourceManager.DurableTask.Models.RedundancyState Zone { get { throw null; } } + public bool Equals(Azure.ResourceManager.DurableTask.Models.RedundancyState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.DurableTask.Models.RedundancyState left, Azure.ResourceManager.DurableTask.Models.RedundancyState right) { throw null; } + public static implicit operator Azure.ResourceManager.DurableTask.Models.RedundancyState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DurableTask.Models.RedundancyState left, Azure.ResourceManager.DurableTask.Models.RedundancyState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class SchedulerPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SchedulerPatch() { } + public Azure.ResourceManager.DurableTask.Models.SchedulerPropertiesUpdate Properties { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.Models.SchedulerPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.Models.SchedulerPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SchedulerProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SchedulerProperties(System.Collections.Generic.IEnumerable ipAllowlist, Azure.ResourceManager.DurableTask.Models.SchedulerSku sku) { } + public string Endpoint { get { throw null; } } + public System.Collections.Generic.IList IPAllowlist { get { throw null; } } + public Azure.ResourceManager.DurableTask.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.DurableTask.Models.SchedulerSku Sku { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.Models.SchedulerProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.Models.SchedulerProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SchedulerPropertiesUpdate : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SchedulerPropertiesUpdate() { } + public string Endpoint { get { throw null; } } + public System.Collections.Generic.IList IPAllowlist { get { throw null; } } + public Azure.ResourceManager.DurableTask.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.DurableTask.Models.SchedulerSkuUpdate Sku { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.Models.SchedulerPropertiesUpdate System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.Models.SchedulerPropertiesUpdate System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SchedulerSku : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SchedulerSku(string name) { } + public int? Capacity { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public Azure.ResourceManager.DurableTask.Models.RedundancyState? RedundancyState { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.Models.SchedulerSku System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.Models.SchedulerSku System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SchedulerSkuUpdate : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SchedulerSkuUpdate() { } + public int? Capacity { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public Azure.ResourceManager.DurableTask.Models.RedundancyState? RedundancyState { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.Models.SchedulerSkuUpdate System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.Models.SchedulerSkuUpdate System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class TaskHubProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public TaskHubProperties() { } + public System.Uri DashboardUri { get { throw null; } } + public Azure.ResourceManager.DurableTask.Models.ProvisioningState? ProvisioningState { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.Models.TaskHubProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.Models.TaskHubProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/api/Azure.ResourceManager.DurableTask.netstandard2.0.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/api/Azure.ResourceManager.DurableTask.netstandard2.0.cs new file mode 100644 index 000000000000..ede053490d5f --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/api/Azure.ResourceManager.DurableTask.netstandard2.0.cs @@ -0,0 +1,270 @@ +namespace Azure.ResourceManager.DurableTask +{ + public static partial class DurableTaskExtensions + { + public static Azure.Response GetScheduler(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetSchedulerAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DurableTask.SchedulerResource GetSchedulerResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DurableTask.SchedulerCollection GetSchedulers(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetSchedulers(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetSchedulersAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DurableTask.TaskHubResource GetTaskHubResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class SchedulerCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected SchedulerCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string schedulerName, Azure.ResourceManager.DurableTask.SchedulerData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string schedulerName, Azure.ResourceManager.DurableTask.SchedulerData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class SchedulerData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SchedulerData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.DurableTask.Models.SchedulerProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.SchedulerData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.SchedulerData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SchedulerResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected SchedulerResource() { } + public virtual Azure.ResourceManager.DurableTask.SchedulerData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string schedulerName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetTaskHub(string taskHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetTaskHubAsync(string taskHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DurableTask.TaskHubCollection GetTaskHubs() { throw null; } + public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.DurableTask.SchedulerData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.SchedulerData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DurableTask.Models.SchedulerPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DurableTask.Models.SchedulerPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class TaskHubCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected TaskHubCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string taskHubName, Azure.ResourceManager.DurableTask.TaskHubData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string taskHubName, Azure.ResourceManager.DurableTask.TaskHubData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string taskHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string taskHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string taskHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string taskHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string taskHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string taskHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class TaskHubData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public TaskHubData() { } + public Azure.ResourceManager.DurableTask.Models.TaskHubProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.TaskHubData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.TaskHubData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class TaskHubResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected TaskHubResource() { } + public virtual Azure.ResourceManager.DurableTask.TaskHubData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string schedulerName, string taskHubName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.DurableTask.TaskHubData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.TaskHubData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DurableTask.TaskHubData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DurableTask.TaskHubData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.DurableTask.Mocking +{ + public partial class MockableDurableTaskArmClient : Azure.ResourceManager.ArmResource + { + protected MockableDurableTaskArmClient() { } + public virtual Azure.ResourceManager.DurableTask.SchedulerResource GetSchedulerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DurableTask.TaskHubResource GetTaskHubResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableDurableTaskResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableDurableTaskResourceGroupResource() { } + public virtual Azure.Response GetScheduler(string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSchedulerAsync(string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DurableTask.SchedulerCollection GetSchedulers() { throw null; } + } + public partial class MockableDurableTaskSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableDurableTaskSubscriptionResource() { } + public virtual Azure.Pageable GetSchedulers(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSchedulersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.DurableTask.Models +{ + public static partial class ArmDurableTaskModelFactory + { + public static Azure.ResourceManager.DurableTask.SchedulerData SchedulerData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.DurableTask.Models.SchedulerProperties properties = null) { throw null; } + public static Azure.ResourceManager.DurableTask.Models.SchedulerProperties SchedulerProperties(Azure.ResourceManager.DurableTask.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.DurableTask.Models.ProvisioningState?), string endpoint = null, System.Collections.Generic.IEnumerable ipAllowlist = null, Azure.ResourceManager.DurableTask.Models.SchedulerSku sku = null) { throw null; } + public static Azure.ResourceManager.DurableTask.Models.SchedulerPropertiesUpdate SchedulerPropertiesUpdate(Azure.ResourceManager.DurableTask.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.DurableTask.Models.ProvisioningState?), string endpoint = null, System.Collections.Generic.IEnumerable ipAllowlist = null, Azure.ResourceManager.DurableTask.Models.SchedulerSkuUpdate sku = null) { throw null; } + public static Azure.ResourceManager.DurableTask.Models.SchedulerSku SchedulerSku(string name = null, int? capacity = default(int?), Azure.ResourceManager.DurableTask.Models.RedundancyState? redundancyState = default(Azure.ResourceManager.DurableTask.Models.RedundancyState?)) { throw null; } + public static Azure.ResourceManager.DurableTask.Models.SchedulerSkuUpdate SchedulerSkuUpdate(string name = null, int? capacity = default(int?), Azure.ResourceManager.DurableTask.Models.RedundancyState? redundancyState = default(Azure.ResourceManager.DurableTask.Models.RedundancyState?)) { throw null; } + public static Azure.ResourceManager.DurableTask.TaskHubData TaskHubData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.DurableTask.Models.TaskHubProperties properties = null) { throw null; } + public static Azure.ResourceManager.DurableTask.Models.TaskHubProperties TaskHubProperties(Azure.ResourceManager.DurableTask.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.DurableTask.Models.ProvisioningState?), System.Uri dashboardUri = null) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.DurableTask.Models.ProvisioningState Accepted { get { throw null; } } + public static Azure.ResourceManager.DurableTask.Models.ProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.DurableTask.Models.ProvisioningState Deleting { get { throw null; } } + public static Azure.ResourceManager.DurableTask.Models.ProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.DurableTask.Models.ProvisioningState Provisioning { get { throw null; } } + public static Azure.ResourceManager.DurableTask.Models.ProvisioningState Succeeded { get { throw null; } } + public static Azure.ResourceManager.DurableTask.Models.ProvisioningState Updating { get { throw null; } } + public bool Equals(Azure.ResourceManager.DurableTask.Models.ProvisioningState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.DurableTask.Models.ProvisioningState left, Azure.ResourceManager.DurableTask.Models.ProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.DurableTask.Models.ProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DurableTask.Models.ProvisioningState left, Azure.ResourceManager.DurableTask.Models.ProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct RedundancyState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public RedundancyState(string value) { throw null; } + public static Azure.ResourceManager.DurableTask.Models.RedundancyState None { get { throw null; } } + public static Azure.ResourceManager.DurableTask.Models.RedundancyState Zone { get { throw null; } } + public bool Equals(Azure.ResourceManager.DurableTask.Models.RedundancyState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.DurableTask.Models.RedundancyState left, Azure.ResourceManager.DurableTask.Models.RedundancyState right) { throw null; } + public static implicit operator Azure.ResourceManager.DurableTask.Models.RedundancyState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DurableTask.Models.RedundancyState left, Azure.ResourceManager.DurableTask.Models.RedundancyState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class SchedulerPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SchedulerPatch() { } + public Azure.ResourceManager.DurableTask.Models.SchedulerPropertiesUpdate Properties { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.Models.SchedulerPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.Models.SchedulerPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SchedulerProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SchedulerProperties(System.Collections.Generic.IEnumerable ipAllowlist, Azure.ResourceManager.DurableTask.Models.SchedulerSku sku) { } + public string Endpoint { get { throw null; } } + public System.Collections.Generic.IList IPAllowlist { get { throw null; } } + public Azure.ResourceManager.DurableTask.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.DurableTask.Models.SchedulerSku Sku { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.Models.SchedulerProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.Models.SchedulerProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SchedulerPropertiesUpdate : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SchedulerPropertiesUpdate() { } + public string Endpoint { get { throw null; } } + public System.Collections.Generic.IList IPAllowlist { get { throw null; } } + public Azure.ResourceManager.DurableTask.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.DurableTask.Models.SchedulerSkuUpdate Sku { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.Models.SchedulerPropertiesUpdate System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.Models.SchedulerPropertiesUpdate System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SchedulerSku : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SchedulerSku(string name) { } + public int? Capacity { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public Azure.ResourceManager.DurableTask.Models.RedundancyState? RedundancyState { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.Models.SchedulerSku System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.Models.SchedulerSku System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SchedulerSkuUpdate : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SchedulerSkuUpdate() { } + public int? Capacity { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public Azure.ResourceManager.DurableTask.Models.RedundancyState? RedundancyState { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.Models.SchedulerSkuUpdate System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.Models.SchedulerSkuUpdate System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class TaskHubProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public TaskHubProperties() { } + public System.Uri DashboardUri { get { throw null; } } + public Azure.ResourceManager.DurableTask.Models.ProvisioningState? ProvisioningState { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.Models.TaskHubProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.Models.TaskHubProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/assets.json b/sdk/durabletask/Azure.ResourceManager.DurableTask/assets.json new file mode 100644 index 000000000000..56671aacf0f5 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/assets.json @@ -0,0 +1,7 @@ + +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "net", + "TagPrefix": "net/durabletask/Azure.ResourceManager.DurableTask", + "Tag": "" +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Azure.ResourceManager.DurableTask.Samples.csproj b/sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Azure.ResourceManager.DurableTask.Samples.csproj new file mode 100644 index 000000000000..536ac11ce49a --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Azure.ResourceManager.DurableTask.Samples.csproj @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_SchedulerCollection.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_SchedulerCollection.cs new file mode 100644 index 000000000000..59fb120a856d --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_SchedulerCollection.cs @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.DurableTask.Models; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.DurableTask.Samples +{ + public partial class Sample_SchedulerCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_SchedulersCreateOrUpdate() + { + // Generated from example definition: 2024-10-01-preview/Schedulers_CreateOrUpdate.json + // this example is just showing the usage of "Scheduler_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "EE9BD735-67CE-4A90-89C4-439D3F6A4C93"; + string resourceGroupName = "rgopenapi"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SchedulerResource + SchedulerCollection collection = resourceGroupResource.GetSchedulers(); + + // invoke the operation + string schedulerName = "testscheduler"; + SchedulerData data = new SchedulerData(new AzureLocation("northcentralus")) + { + Properties = new SchedulerProperties(new string[] { "10.0.0.0/8" }, new SchedulerSku("Dedicated")), + Tags = +{ +["key7131"] = "ryohwcoiccwsnewjigfmijz", +["key2138"] = "fjaeecgnvqd" +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, schedulerName, data); + SchedulerResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SchedulerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_SchedulersGet() + { + // Generated from example definition: 2024-10-01-preview/Schedulers_Get.json + // this example is just showing the usage of "Scheduler_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "EE9BD735-67CE-4A90-89C4-439D3F6A4C93"; + string resourceGroupName = "rgopenapi"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SchedulerResource + SchedulerCollection collection = resourceGroupResource.GetSchedulers(); + + // invoke the operation + string schedulerName = "testscheduler"; + SchedulerResource result = await collection.GetAsync(schedulerName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SchedulerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_SchedulersListByResourceGroup() + { + // Generated from example definition: 2024-10-01-preview/Schedulers_ListByResourceGroup.json + // this example is just showing the usage of "Scheduler_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "EE9BD735-67CE-4A90-89C4-439D3F6A4C93"; + string resourceGroupName = "rgopenapi"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SchedulerResource + SchedulerCollection collection = resourceGroupResource.GetSchedulers(); + + // invoke the operation and iterate over the result + await foreach (SchedulerResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SchedulerData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_SchedulersGet() + { + // Generated from example definition: 2024-10-01-preview/Schedulers_Get.json + // this example is just showing the usage of "Scheduler_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "EE9BD735-67CE-4A90-89C4-439D3F6A4C93"; + string resourceGroupName = "rgopenapi"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SchedulerResource + SchedulerCollection collection = resourceGroupResource.GetSchedulers(); + + // invoke the operation + string schedulerName = "testscheduler"; + bool result = await collection.ExistsAsync(schedulerName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_SchedulersGet() + { + // Generated from example definition: 2024-10-01-preview/Schedulers_Get.json + // this example is just showing the usage of "Scheduler_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "EE9BD735-67CE-4A90-89C4-439D3F6A4C93"; + string resourceGroupName = "rgopenapi"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SchedulerResource + SchedulerCollection collection = resourceGroupResource.GetSchedulers(); + + // invoke the operation + string schedulerName = "testscheduler"; + NullableResponse response = await collection.GetIfExistsAsync(schedulerName); + SchedulerResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SchedulerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_SchedulerResource.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_SchedulerResource.cs new file mode 100644 index 000000000000..a5db61e7fbeb --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_SchedulerResource.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.DurableTask.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.DurableTask.Samples +{ + public partial class Sample_SchedulerResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_SchedulersGet() + { + // Generated from example definition: 2024-10-01-preview/Schedulers_Get.json + // this example is just showing the usage of "Scheduler_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SchedulerResource created on azure + // for more information of creating SchedulerResource, please refer to the document of SchedulerResource + string subscriptionId = "EE9BD735-67CE-4A90-89C4-439D3F6A4C93"; + string resourceGroupName = "rgopenapi"; + string schedulerName = "testscheduler"; + ResourceIdentifier schedulerResourceId = SchedulerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schedulerName); + SchedulerResource scheduler = client.GetSchedulerResource(schedulerResourceId); + + // invoke the operation + SchedulerResource result = await scheduler.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SchedulerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Delete_SchedulersDelete() + { + // Generated from example definition: 2024-10-01-preview/Schedulers_Delete.json + // this example is just showing the usage of "Scheduler_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SchedulerResource created on azure + // for more information of creating SchedulerResource, please refer to the document of SchedulerResource + string subscriptionId = "EE9BD735-67CE-4A90-89C4-439D3F6A4C93"; + string resourceGroupName = "rgopenapi"; + string schedulerName = "testscheduler"; + ResourceIdentifier schedulerResourceId = SchedulerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schedulerName); + SchedulerResource scheduler = client.GetSchedulerResource(schedulerResourceId); + + // invoke the operation + await scheduler.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_SchedulersUpdate() + { + // Generated from example definition: 2024-10-01-preview/Schedulers_Update.json + // this example is just showing the usage of "Scheduler_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SchedulerResource created on azure + // for more information of creating SchedulerResource, please refer to the document of SchedulerResource + string subscriptionId = "EE9BD735-67CE-4A90-89C4-439D3F6A4C93"; + string resourceGroupName = "rgopenapi"; + string schedulerName = "testscheduler"; + ResourceIdentifier schedulerResourceId = SchedulerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schedulerName); + SchedulerResource scheduler = client.GetSchedulerResource(schedulerResourceId); + + // invoke the operation + SchedulerPatch patch = new SchedulerPatch + { + Properties = new SchedulerPropertiesUpdate + { + IPAllowlist = { "10.0.0.0/8" }, + Sku = new SchedulerSkuUpdate + { + Name = "Dedicated", + Capacity = 10, + }, + }, + Tags = +{ +["key8653"] = "lr" +}, + }; + ArmOperation lro = await scheduler.UpdateAsync(WaitUntil.Completed, patch); + SchedulerResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SchedulerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs new file mode 100644 index 000000000000..ed50efa434ea --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.DurableTask.Samples +{ + public partial class Sample_SubscriptionResourceExtensions + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetSchedulers_SchedulersListBySubscription() + { + // Generated from example definition: 2024-10-01-preview/Schedulers_ListBySubscription.json + // this example is just showing the usage of "Scheduler_ListBySubscription" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "EE9BD735-67CE-4A90-89C4-439D3F6A4C93"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (SchedulerResource item in subscriptionResource.GetSchedulersAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SchedulerData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_TaskHubCollection.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_TaskHubCollection.cs new file mode 100644 index 000000000000..b84dc3556b78 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_TaskHubCollection.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.DurableTask.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.DurableTask.Samples +{ + public partial class Sample_TaskHubCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_TaskHubsCreateOrUpdate() + { + // Generated from example definition: 2024-10-01-preview/TaskHubs_CreateOrUpdate.json + // this example is just showing the usage of "TaskHub_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SchedulerResource created on azure + // for more information of creating SchedulerResource, please refer to the document of SchedulerResource + string subscriptionId = "EE9BD735-67CE-4A90-89C4-439D3F6A4C93"; + string resourceGroupName = "rgopenapi"; + string schedulerName = "testscheduler"; + ResourceIdentifier schedulerResourceId = SchedulerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schedulerName); + SchedulerResource scheduler = client.GetSchedulerResource(schedulerResourceId); + + // get the collection of this TaskHubResource + TaskHubCollection collection = scheduler.GetTaskHubs(); + + // invoke the operation + string taskHubName = "testtaskhub"; + TaskHubData data = new TaskHubData + { + Properties = new TaskHubProperties(), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, taskHubName, data); + TaskHubResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + TaskHubData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_TaskHubsGet() + { + // Generated from example definition: 2024-10-01-preview/TaskHubs_Get.json + // this example is just showing the usage of "TaskHub_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SchedulerResource created on azure + // for more information of creating SchedulerResource, please refer to the document of SchedulerResource + string subscriptionId = "EE9BD735-67CE-4A90-89C4-439D3F6A4C93"; + string resourceGroupName = "rgopenapi"; + string schedulerName = "testscheduler"; + ResourceIdentifier schedulerResourceId = SchedulerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schedulerName); + SchedulerResource scheduler = client.GetSchedulerResource(schedulerResourceId); + + // get the collection of this TaskHubResource + TaskHubCollection collection = scheduler.GetTaskHubs(); + + // invoke the operation + string taskHubName = "testtuskhub"; + TaskHubResource result = await collection.GetAsync(taskHubName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + TaskHubData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_TaskHubsListByScheduler() + { + // Generated from example definition: 2024-10-01-preview/TaskHubs_ListByScheduler.json + // this example is just showing the usage of "TaskHub_ListByScheduler" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SchedulerResource created on azure + // for more information of creating SchedulerResource, please refer to the document of SchedulerResource + string subscriptionId = "EE9BD735-67CE-4A90-89C4-439D3F6A4C93"; + string resourceGroupName = "rgopenapi"; + string schedulerName = "testtaskhub"; + ResourceIdentifier schedulerResourceId = SchedulerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schedulerName); + SchedulerResource scheduler = client.GetSchedulerResource(schedulerResourceId); + + // get the collection of this TaskHubResource + TaskHubCollection collection = scheduler.GetTaskHubs(); + + // invoke the operation and iterate over the result + await foreach (TaskHubResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + TaskHubData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_TaskHubsGet() + { + // Generated from example definition: 2024-10-01-preview/TaskHubs_Get.json + // this example is just showing the usage of "TaskHub_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SchedulerResource created on azure + // for more information of creating SchedulerResource, please refer to the document of SchedulerResource + string subscriptionId = "EE9BD735-67CE-4A90-89C4-439D3F6A4C93"; + string resourceGroupName = "rgopenapi"; + string schedulerName = "testscheduler"; + ResourceIdentifier schedulerResourceId = SchedulerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schedulerName); + SchedulerResource scheduler = client.GetSchedulerResource(schedulerResourceId); + + // get the collection of this TaskHubResource + TaskHubCollection collection = scheduler.GetTaskHubs(); + + // invoke the operation + string taskHubName = "testtuskhub"; + bool result = await collection.ExistsAsync(taskHubName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_TaskHubsGet() + { + // Generated from example definition: 2024-10-01-preview/TaskHubs_Get.json + // this example is just showing the usage of "TaskHub_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SchedulerResource created on azure + // for more information of creating SchedulerResource, please refer to the document of SchedulerResource + string subscriptionId = "EE9BD735-67CE-4A90-89C4-439D3F6A4C93"; + string resourceGroupName = "rgopenapi"; + string schedulerName = "testscheduler"; + ResourceIdentifier schedulerResourceId = SchedulerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schedulerName); + SchedulerResource scheduler = client.GetSchedulerResource(schedulerResourceId); + + // get the collection of this TaskHubResource + TaskHubCollection collection = scheduler.GetTaskHubs(); + + // invoke the operation + string taskHubName = "testtuskhub"; + NullableResponse response = await collection.GetIfExistsAsync(taskHubName); + TaskHubResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + TaskHubData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_TaskHubResource.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_TaskHubResource.cs new file mode 100644 index 000000000000..3ffd0e10a057 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_TaskHubResource.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.DurableTask.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.DurableTask.Samples +{ + public partial class Sample_TaskHubResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_TaskHubsGet() + { + // Generated from example definition: 2024-10-01-preview/TaskHubs_Get.json + // this example is just showing the usage of "TaskHub_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this TaskHubResource created on azure + // for more information of creating TaskHubResource, please refer to the document of TaskHubResource + string subscriptionId = "EE9BD735-67CE-4A90-89C4-439D3F6A4C93"; + string resourceGroupName = "rgopenapi"; + string schedulerName = "testscheduler"; + string taskHubName = "testtuskhub"; + ResourceIdentifier taskHubResourceId = TaskHubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schedulerName, taskHubName); + TaskHubResource taskHub = client.GetTaskHubResource(taskHubResourceId); + + // invoke the operation + TaskHubResource result = await taskHub.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + TaskHubData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Delete_TaskHubsDelete() + { + // Generated from example definition: 2024-10-01-preview/TaskHubs_Delete.json + // this example is just showing the usage of "TaskHub_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this TaskHubResource created on azure + // for more information of creating TaskHubResource, please refer to the document of TaskHubResource + string subscriptionId = "EE9BD735-67CE-4A90-89C4-439D3F6A4C93"; + string resourceGroupName = "rgopenapi"; + string schedulerName = "testscheduler"; + string taskHubName = "testtuskhub"; + ResourceIdentifier taskHubResourceId = TaskHubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schedulerName, taskHubName); + TaskHubResource taskHub = client.GetTaskHubResource(taskHubResourceId); + + // invoke the operation + await taskHub.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_TaskHubsCreateOrUpdate() + { + // Generated from example definition: 2024-10-01-preview/TaskHubs_CreateOrUpdate.json + // this example is just showing the usage of "TaskHub_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this TaskHubResource created on azure + // for more information of creating TaskHubResource, please refer to the document of TaskHubResource + string subscriptionId = "EE9BD735-67CE-4A90-89C4-439D3F6A4C93"; + string resourceGroupName = "rgopenapi"; + string schedulerName = "testscheduler"; + string taskHubName = "testtaskhub"; + ResourceIdentifier taskHubResourceId = TaskHubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schedulerName, taskHubName); + TaskHubResource taskHub = client.GetTaskHubResource(taskHubResourceId); + + // invoke the operation + TaskHubData data = new TaskHubData + { + Properties = new TaskHubProperties(), + }; + ArmOperation lro = await taskHub.UpdateAsync(WaitUntil.Completed, data); + TaskHubResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + TaskHubData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Azure.ResourceManager.DurableTask.csproj b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Azure.ResourceManager.DurableTask.csproj new file mode 100644 index 000000000000..eef34dffbc5f --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Azure.ResourceManager.DurableTask.csproj @@ -0,0 +1,8 @@ + + + Azure Resource Manager client SDK for Azure resource provider DurableTask. + 1.0.0-beta.1 + azure;management;arm;resource manager;durabletask + Azure.ResourceManager.DurableTask + + diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/ArmDurableTaskModelFactory.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/ArmDurableTaskModelFactory.cs new file mode 100644 index 000000000000..03debd566c37 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/ArmDurableTaskModelFactory.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DurableTask.Models +{ + /// Model factory for models. + public static partial class ArmDurableTaskModelFactory + { + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static TaskHubData TaskHubData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, TaskHubProperties properties = null) + { + return new TaskHubData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The status of the last operation. + /// URL of the durable task scheduler dashboard. + /// A new instance for mocking. + public static TaskHubProperties TaskHubProperties(ProvisioningState? provisioningState = null, Uri dashboardUri = null) + { + return new TaskHubProperties(provisioningState, dashboardUri, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static SchedulerData SchedulerData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, SchedulerProperties properties = null) + { + tags ??= new Dictionary(); + + return new SchedulerData( + id, + name, + resourceType, + systemData, + tags, + location, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The status of the last operation. + /// URL of the durable task scheduler. + /// IP allow list for durable task scheduler. Values can be IPv4, IPv6 or CIDR. + /// SKU of the durable task scheduler. + /// A new instance for mocking. + public static SchedulerProperties SchedulerProperties(ProvisioningState? provisioningState = null, string endpoint = null, IEnumerable ipAllowlist = null, SchedulerSku sku = null) + { + ipAllowlist ??= new List(); + + return new SchedulerProperties(provisioningState, endpoint, ipAllowlist?.ToList(), sku, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The name of the SKU. + /// The SKU capacity. This allows scale out/in for the resource and impacts zone redundancy. + /// Indicates whether the current SKU configuration is zone redundant. + /// A new instance for mocking. + public static SchedulerSku SchedulerSku(string name = null, int? capacity = null, RedundancyState? redundancyState = null) + { + return new SchedulerSku(name, capacity, redundancyState, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The status of the last operation. + /// URL of the durable task scheduler. + /// IP allow list for durable task scheduler. Values can be IPv4, IPv6 or CIDR. + /// SKU of the durable task scheduler. + /// A new instance for mocking. + public static SchedulerPropertiesUpdate SchedulerPropertiesUpdate(ProvisioningState? provisioningState = null, string endpoint = null, IEnumerable ipAllowlist = null, SchedulerSkuUpdate sku = null) + { + ipAllowlist ??= new List(); + + return new SchedulerPropertiesUpdate(provisioningState, endpoint, ipAllowlist?.ToList(), sku, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The name of the SKU. + /// The SKU capacity. This allows scale out/in for the resource and impacts zone redundancy. + /// Indicates whether the current SKU configuration is zone redundant. + /// A new instance for mocking. + public static SchedulerSkuUpdate SchedulerSkuUpdate(string name = null, int? capacity = null, RedundancyState? redundancyState = null) + { + return new SchedulerSkuUpdate(name, capacity, redundancyState, serializedAdditionalRawData: null); + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Extensions/DurableTaskExtensions.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Extensions/DurableTaskExtensions.cs new file mode 100644 index 000000000000..59b95fb5863a --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Extensions/DurableTaskExtensions.cs @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.ResourceManager.DurableTask.Mocking; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.DurableTask +{ + /// A class to add extension methods to Azure.ResourceManager.DurableTask. + public static partial class DurableTaskExtensions + { + private static MockableDurableTaskArmClient GetMockableDurableTaskArmClient(ArmClient client) + { + return client.GetCachedClient(client0 => new MockableDurableTaskArmClient(client0)); + } + + private static MockableDurableTaskResourceGroupResource GetMockableDurableTaskResourceGroupResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableDurableTaskResourceGroupResource(client, resource.Id)); + } + + private static MockableDurableTaskSubscriptionResource GetMockableDurableTaskSubscriptionResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableDurableTaskSubscriptionResource(client, resource.Id)); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static SchedulerResource GetSchedulerResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableDurableTaskArmClient(client).GetSchedulerResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static TaskHubResource GetTaskHubResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableDurableTaskArmClient(client).GetTaskHubResource(id); + } + + /// + /// Gets a collection of SchedulerResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// is null. + /// An object representing collection of SchedulerResources and their operations over a SchedulerResource. + public static SchedulerCollection GetSchedulers(this ResourceGroupResource resourceGroupResource) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableDurableTaskResourceGroupResource(resourceGroupResource).GetSchedulers(); + } + + /// + /// Get a Scheduler + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the Scheduler. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetSchedulerAsync(this ResourceGroupResource resourceGroupResource, string schedulerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return await GetMockableDurableTaskResourceGroupResource(resourceGroupResource).GetSchedulerAsync(schedulerName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a Scheduler + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the Scheduler. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetScheduler(this ResourceGroupResource resourceGroupResource, string schedulerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableDurableTaskResourceGroupResource(resourceGroupResource).GetScheduler(schedulerName, cancellationToken); + } + + /// + /// List Schedulers by subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DurableTask/schedulers + /// + /// + /// Operation Id + /// Scheduler_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetSchedulersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableDurableTaskSubscriptionResource(subscriptionResource).GetSchedulersAsync(cancellationToken); + } + + /// + /// List Schedulers by subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DurableTask/schedulers + /// + /// + /// Operation Id + /// Scheduler_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetSchedulers(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableDurableTaskSubscriptionResource(subscriptionResource).GetSchedulers(cancellationToken); + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Extensions/MockableDurableTaskArmClient.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Extensions/MockableDurableTaskArmClient.cs new file mode 100644 index 000000000000..066b094f4491 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Extensions/MockableDurableTaskArmClient.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.DurableTask.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableDurableTaskArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDurableTaskArmClient() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal MockableDurableTaskArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableDurableTaskArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SchedulerResource GetSchedulerResource(ResourceIdentifier id) + { + SchedulerResource.ValidateResourceId(id); + return new SchedulerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual TaskHubResource GetTaskHubResource(ResourceIdentifier id) + { + TaskHubResource.ValidateResourceId(id); + return new TaskHubResource(Client, id); + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Extensions/MockableDurableTaskResourceGroupResource.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Extensions/MockableDurableTaskResourceGroupResource.cs new file mode 100644 index 000000000000..7f7eb5e71b35 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Extensions/MockableDurableTaskResourceGroupResource.cs @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.DurableTask.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableDurableTaskResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDurableTaskResourceGroupResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal MockableDurableTaskResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of SchedulerResources in the ResourceGroupResource. + /// An object representing collection of SchedulerResources and their operations over a SchedulerResource. + public virtual SchedulerCollection GetSchedulers() + { + return GetCachedClient(client => new SchedulerCollection(client, Id)); + } + + /// + /// Get a Scheduler + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Scheduler. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSchedulerAsync(string schedulerName, CancellationToken cancellationToken = default) + { + return await GetSchedulers().GetAsync(schedulerName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a Scheduler + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Scheduler. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetScheduler(string schedulerName, CancellationToken cancellationToken = default) + { + return GetSchedulers().Get(schedulerName, cancellationToken); + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Extensions/MockableDurableTaskSubscriptionResource.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Extensions/MockableDurableTaskSubscriptionResource.cs new file mode 100644 index 000000000000..b46b8c12f2a9 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Extensions/MockableDurableTaskSubscriptionResource.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DurableTask.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableDurableTaskSubscriptionResource : ArmResource + { + private ClientDiagnostics _schedulerClientDiagnostics; + private SchedulersRestOperations _schedulerRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableDurableTaskSubscriptionResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal MockableDurableTaskSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics SchedulerClientDiagnostics => _schedulerClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DurableTask", SchedulerResource.ResourceType.Namespace, Diagnostics); + private SchedulersRestOperations SchedulerRestClient => _schedulerRestClient ??= new SchedulersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SchedulerResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List Schedulers by subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DurableTask/schedulers + /// + /// + /// Operation Id + /// Scheduler_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSchedulersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SchedulerRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SchedulerRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SchedulerResource(Client, SchedulerData.DeserializeSchedulerData(e)), SchedulerClientDiagnostics, Pipeline, "MockableDurableTaskSubscriptionResource.GetSchedulers", "value", "nextLink", cancellationToken); + } + + /// + /// List Schedulers by subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DurableTask/schedulers + /// + /// + /// Operation Id + /// Scheduler_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSchedulers(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SchedulerRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SchedulerRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SchedulerResource(Client, SchedulerData.DeserializeSchedulerData(e)), SchedulerClientDiagnostics, Pipeline, "MockableDurableTaskSubscriptionResource.GetSchedulers", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/Argument.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/Argument.cs new file mode 100644 index 000000000000..d15981d33b18 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/Argument.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DurableTask +{ + internal static class Argument + { + public static void AssertNotNull(T value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + } + + public static void AssertNotNull(T? value, string name) + where T : struct + { + if (!value.HasValue) + { + throw new ArgumentNullException(name); + } + } + + public static void AssertNotNullOrEmpty(IEnumerable value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value is ICollection collectionOfT && collectionOfT.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + if (value is ICollection collection && collection.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + using IEnumerator e = value.GetEnumerator(); + if (!e.MoveNext()) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + } + + public static void AssertNotNullOrEmpty(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value.Length == 0) + { + throw new ArgumentException("Value cannot be an empty string.", name); + } + } + + public static void AssertNotNullOrWhiteSpace(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (string.IsNullOrWhiteSpace(value)) + { + throw new ArgumentException("Value cannot be empty or contain only white-space characters.", name); + } + } + + public static void AssertNotDefault(ref T value, string name) + where T : struct, IEquatable + { + if (value.Equals(default)) + { + throw new ArgumentException("Value cannot be empty.", name); + } + } + + public static void AssertInRange(T value, T minimum, T maximum, string name) + where T : notnull, IComparable + { + if (minimum.CompareTo(value) > 0) + { + throw new ArgumentOutOfRangeException(name, "Value is less than the minimum allowed."); + } + if (maximum.CompareTo(value) < 0) + { + throw new ArgumentOutOfRangeException(name, "Value is greater than the maximum allowed."); + } + } + + public static void AssertEnumDefined(Type enumType, object value, string name) + { + if (!Enum.IsDefined(enumType, value)) + { + throw new ArgumentException($"Value not defined for {enumType.FullName}.", name); + } + } + + public static T CheckNotNull(T value, string name) + where T : class + { + AssertNotNull(value, name); + return value; + } + + public static string CheckNotNullOrEmpty(string value, string name) + { + AssertNotNullOrEmpty(value, name); + return value; + } + + public static void AssertNull(T value, string name, string message = null) + { + if (value != null) + { + throw new ArgumentException(message ?? "Value must be null.", name); + } + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/ChangeTrackingDictionary.cs new file mode 100644 index 000000000000..001cb5f61046 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/ChangeTrackingDictionary.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DurableTask +{ + internal class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary where TKey : notnull + { + private IDictionary _innerDictionary; + + public ChangeTrackingDictionary() + { + } + + public ChangeTrackingDictionary(IDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(dictionary); + } + + public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(); + foreach (var pair in dictionary) + { + _innerDictionary.Add(pair); + } + } + + public bool IsUndefined => _innerDictionary == null; + + public int Count => IsUndefined ? 0 : EnsureDictionary().Count; + + public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly; + + public ICollection Keys => IsUndefined ? Array.Empty() : EnsureDictionary().Keys; + + public ICollection Values => IsUndefined ? Array.Empty() : EnsureDictionary().Values; + + public TValue this[TKey key] + { + get + { + if (IsUndefined) + { + throw new KeyNotFoundException(nameof(key)); + } + return EnsureDictionary()[key]; + } + set + { + EnsureDictionary()[key] = value; + } + } + + IEnumerable IReadOnlyDictionary.Keys => Keys; + + IEnumerable IReadOnlyDictionary.Values => Values; + + public IEnumerator> GetEnumerator() + { + if (IsUndefined) + { + IEnumerator> enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureDictionary().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(KeyValuePair item) + { + EnsureDictionary().Add(item); + } + + public void Clear() + { + EnsureDictionary().Clear(); + } + + public bool Contains(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Contains(item); + } + + public void CopyTo(KeyValuePair[] array, int index) + { + if (IsUndefined) + { + return; + } + EnsureDictionary().CopyTo(array, index); + } + + public bool Remove(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(item); + } + + public void Add(TKey key, TValue value) + { + EnsureDictionary().Add(key, value); + } + + public bool ContainsKey(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().ContainsKey(key); + } + + public bool Remove(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(key); + } + + public bool TryGetValue(TKey key, out TValue value) + { + if (IsUndefined) + { + value = default; + return false; + } + return EnsureDictionary().TryGetValue(key, out value); + } + + public IDictionary EnsureDictionary() + { + return _innerDictionary ??= new Dictionary(); + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/ChangeTrackingList.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/ChangeTrackingList.cs new file mode 100644 index 000000000000..5ce8ee7ec441 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/ChangeTrackingList.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.DurableTask +{ + internal class ChangeTrackingList : IList, IReadOnlyList + { + private IList _innerList; + + public ChangeTrackingList() + { + } + + public ChangeTrackingList(IList innerList) + { + if (innerList != null) + { + _innerList = innerList; + } + } + + public ChangeTrackingList(IReadOnlyList innerList) + { + if (innerList != null) + { + _innerList = innerList.ToList(); + } + } + + public bool IsUndefined => _innerList == null; + + public int Count => IsUndefined ? 0 : EnsureList().Count; + + public bool IsReadOnly => IsUndefined ? false : EnsureList().IsReadOnly; + + public T this[int index] + { + get + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + return EnsureList()[index]; + } + set + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList()[index] = value; + } + } + + public void Reset() + { + _innerList = null; + } + + public IEnumerator GetEnumerator() + { + if (IsUndefined) + { + IEnumerator enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureList().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(T item) + { + EnsureList().Add(item); + } + + public void Clear() + { + EnsureList().Clear(); + } + + public bool Contains(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Contains(item); + } + + public void CopyTo(T[] array, int arrayIndex) + { + if (IsUndefined) + { + return; + } + EnsureList().CopyTo(array, arrayIndex); + } + + public bool Remove(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Remove(item); + } + + public int IndexOf(T item) + { + if (IsUndefined) + { + return -1; + } + return EnsureList().IndexOf(item); + } + + public void Insert(int index, T item) + { + EnsureList().Insert(index, item); + } + + public void RemoveAt(int index) + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList().RemoveAt(index); + } + + public IList EnsureList() + { + return _innerList ??= new List(); + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/ModelSerializationExtensions.cs new file mode 100644 index 000000000000..7548acaf9b19 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/ModelSerializationExtensions.cs @@ -0,0 +1,399 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.Text.Json; +using System.Xml; +using Azure.Core; + +namespace Azure.ResourceManager.DurableTask +{ + internal static class ModelSerializationExtensions + { + internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions { MaxDepth = 256 }; + internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); + + public static object GetObject(this JsonElement element) + { + switch (element.ValueKind) + { + case JsonValueKind.String: + return element.GetString(); + case JsonValueKind.Number: + if (element.TryGetInt32(out int intValue)) + { + return intValue; + } + if (element.TryGetInt64(out long longValue)) + { + return longValue; + } + return element.GetDouble(); + case JsonValueKind.True: + return true; + case JsonValueKind.False: + return false; + case JsonValueKind.Undefined: + case JsonValueKind.Null: + return null; + case JsonValueKind.Object: + var dictionary = new Dictionary(); + foreach (var jsonProperty in element.EnumerateObject()) + { + dictionary.Add(jsonProperty.Name, jsonProperty.Value.GetObject()); + } + return dictionary; + case JsonValueKind.Array: + var list = new List(); + foreach (var item in element.EnumerateArray()) + { + list.Add(item.GetObject()); + } + return list.ToArray(); + default: + throw new NotSupportedException($"Not supported value kind {element.ValueKind}"); + } + } + + public static byte[] GetBytesFromBase64(this JsonElement element, string format) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + + return format switch + { + "U" => TypeFormatters.FromBase64UrlString(element.GetRequiredString()), + "D" => element.GetBytesFromBase64(), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + } + + public static DateTimeOffset GetDateTimeOffset(this JsonElement element, string format) => format switch + { + "U" when element.ValueKind == JsonValueKind.Number => DateTimeOffset.FromUnixTimeSeconds(element.GetInt64()), + _ => TypeFormatters.ParseDateTimeOffset(element.GetString(), format) + }; + + public static TimeSpan GetTimeSpan(this JsonElement element, string format) => TypeFormatters.ParseTimeSpan(element.GetString(), format); + + public static char GetChar(this JsonElement element) + { + if (element.ValueKind == JsonValueKind.String) + { + var text = element.GetString(); + if (text == null || text.Length != 1) + { + throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); + } + return text[0]; + } + else + { + throw new NotSupportedException($"Cannot convert {element.ValueKind} to a char"); + } + } + + [Conditional("DEBUG")] + public static void ThrowNonNullablePropertyIsNull(this JsonProperty property) + { + throw new JsonException($"A property '{property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); + } + + public static string GetRequiredString(this JsonElement element) + { + var value = element.GetString(); + if (value == null) + { + throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{element.ValueKind}'."); + } + return value; + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTime value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, TimeSpan value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, char value) + { + writer.WriteStringValue(value.ToString(CultureInfo.InvariantCulture)); + } + + public static void WriteBase64StringValue(this Utf8JsonWriter writer, byte[] value, string format) + { + if (value == null) + { + writer.WriteNullValue(); + return; + } + switch (format) + { + case "U": + writer.WriteStringValue(TypeFormatters.ToBase64UrlString(value)); + break; + case "D": + writer.WriteBase64StringValue(value); + break; + default: + throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)); + } + } + + public static void WriteNumberValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + if (format != "U") + { + throw new ArgumentOutOfRangeException(nameof(format), "Only 'U' format is supported when writing a DateTimeOffset as a Number."); + } + writer.WriteNumberValue(value.ToUnixTimeSeconds()); + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, T value, ModelReaderWriterOptions options = null) + { + switch (value) + { + case null: + writer.WriteNullValue(); + break; + case IJsonModel jsonModel: + jsonModel.Write(writer, options ?? WireOptions); + break; + case IUtf8JsonSerializable serializable: + serializable.Write(writer); + break; + case byte[] bytes: + writer.WriteBase64StringValue(bytes); + break; + case BinaryData bytes0: + writer.WriteBase64StringValue(bytes0); + break; + case JsonElement json: + json.WriteTo(writer); + break; + case int i: + writer.WriteNumberValue(i); + break; + case decimal d: + writer.WriteNumberValue(d); + break; + case double d0: + if (double.IsNaN(d0)) + { + writer.WriteStringValue("NaN"); + } + else + { + writer.WriteNumberValue(d0); + } + break; + case float f: + writer.WriteNumberValue(f); + break; + case long l: + writer.WriteNumberValue(l); + break; + case string s: + writer.WriteStringValue(s); + break; + case bool b: + writer.WriteBooleanValue(b); + break; + case Guid g: + writer.WriteStringValue(g); + break; + case DateTimeOffset dateTimeOffset: + writer.WriteStringValue(dateTimeOffset, "O"); + break; + case DateTime dateTime: + writer.WriteStringValue(dateTime, "O"); + break; + case IEnumerable> enumerable: + writer.WriteStartObject(); + foreach (var pair in enumerable) + { + writer.WritePropertyName(pair.Key); + writer.WriteObjectValue(pair.Value, options); + } + writer.WriteEndObject(); + break; + case IEnumerable objectEnumerable: + writer.WriteStartArray(); + foreach (var item in objectEnumerable) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + break; + case TimeSpan timeSpan: + writer.WriteStringValue(timeSpan, "P"); + break; + default: + throw new NotSupportedException($"Not supported type {value.GetType()}"); + } + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, object value, ModelReaderWriterOptions options = null) + { + writer.WriteObjectValue(value, options); + } + + internal static class TypeFormatters + { + private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; + public const string DefaultNumberFormat = "G"; + + public static string ToString(bool value) => value ? "true" : "false"; + + public static string ToString(DateTime value, string format) => value.Kind switch + { + DateTimeKind.Utc => ToString((DateTimeOffset)value, format), + _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Azure SDK requires it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") + }; + + public static string ToString(DateTimeOffset value, string format) => format switch + { + "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), + "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), + "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "R" => value.ToString("r", CultureInfo.InvariantCulture), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(TimeSpan value, string format) => format switch + { + "P" => XmlConvert.ToString(value), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(byte[] value, string format) => format switch + { + "U" => ToBase64UrlString(value), + "D" => Convert.ToBase64String(value), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + + public static string ToBase64UrlString(byte[] value) + { + int numWholeOrPartialInputBlocks = checked(value.Length + 2) / 3; + int size = checked(numWholeOrPartialInputBlocks * 4); + char[] output = new char[size]; + + int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); + + int i = 0; + for (; i < numBase64Chars; i++) + { + char ch = output[i]; + if (ch == '+') + { + output[i] = '-'; + } + else + { + if (ch == '/') + { + output[i] = '_'; + } + else + { + if (ch == '=') + { + break; + } + } + } + } + + return new string(output, 0, i); + } + + public static byte[] FromBase64UrlString(string value) + { + int paddingCharsToAdd = (value.Length % 4) switch + { + 0 => 0, + 2 => 2, + 3 => 1, + _ => throw new InvalidOperationException("Malformed input") + }; + char[] output = new char[(value.Length + paddingCharsToAdd)]; + int i = 0; + for (; i < value.Length; i++) + { + char ch = value[i]; + if (ch == '-') + { + output[i] = '+'; + } + else + { + if (ch == '_') + { + output[i] = '/'; + } + else + { + output[i] = ch; + } + } + } + + for (; i < output.Length; i++) + { + output[i] = '='; + } + + return Convert.FromBase64CharArray(output, 0, output.Length); + } + + public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch + { + "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), + _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) + }; + + public static TimeSpan ParseTimeSpan(string value, string format) => format switch + { + "P" => XmlConvert.ToTimeSpan(value), + _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) + }; + + public static string ConvertToString(object value, string format = null) => value switch + { + null => "null", + string s => s, + bool b => ToString(b), + int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), + byte[] b0 when format != null => ToString(b0, format), + IEnumerable s0 => string.Join(",", s0), + DateTimeOffset dateTime when format != null => ToString(dateTime, format), + TimeSpan timeSpan when format != null => ToString(timeSpan, format), + TimeSpan timeSpan0 => XmlConvert.ToString(timeSpan0), + Guid guid => guid.ToString(), + BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), + _ => value.ToString() + }; + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/Optional.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/Optional.cs new file mode 100644 index 000000000000..dd8a99d7dd47 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/Optional.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; + +namespace Azure.ResourceManager.DurableTask +{ + internal static class Optional + { + public static bool IsCollectionDefined(IEnumerable collection) + { + return !(collection is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined); + } + + public static bool IsCollectionDefined(IDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsCollectionDefined(IReadOnlyDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsDefined(T? value) + where T : struct + { + return value.HasValue; + } + + public static bool IsDefined(object value) + { + return value != null; + } + + public static bool IsDefined(JsonElement value) + { + return value.ValueKind != JsonValueKind.Undefined; + } + + public static bool IsDefined(string value) + { + return value != null; + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/Utf8JsonRequestContent.cs new file mode 100644 index 000000000000..491ccbbaaf8c --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/Utf8JsonRequestContent.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.IO; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.DurableTask +{ + internal class Utf8JsonRequestContent : RequestContent + { + private readonly MemoryStream _stream; + private readonly RequestContent _content; + + public Utf8JsonRequestContent() + { + _stream = new MemoryStream(); + _content = Create(_stream); + JsonWriter = new Utf8JsonWriter(_stream); + } + + public Utf8JsonWriter JsonWriter { get; } + + public override async Task WriteToAsync(Stream stream, CancellationToken cancellationToken = default) + { + await JsonWriter.FlushAsync().ConfigureAwait(false); + await _content.WriteToAsync(stream, cancellationToken).ConfigureAwait(false); + } + + public override void WriteTo(Stream stream, CancellationToken cancellationToken = default) + { + JsonWriter.Flush(); + _content.WriteTo(stream, cancellationToken); + } + + public override bool TryComputeLength(out long length) + { + length = JsonWriter.BytesCommitted + JsonWriter.BytesPending; + return true; + } + + public override void Dispose() + { + JsonWriter.Dispose(); + _content.Dispose(); + _stream.Dispose(); + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/LongRunningOperation/DurableTaskArmOperation.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/LongRunningOperation/DurableTaskArmOperation.cs new file mode 100644 index 000000000000..34ba48f6a7cb --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/LongRunningOperation/DurableTaskArmOperation.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DurableTask +{ +#pragma warning disable SA1649 // File name should match first type name + internal class DurableTaskArmOperation : ArmOperation +#pragma warning restore SA1649 // File name should match first type name + { + private readonly OperationInternal _operation; + private readonly RehydrationToken? _completeRehydrationToken; + private readonly NextLinkOperationImplementation _nextLinkOperation; + private readonly string _operationId; + + /// Initializes a new instance of DurableTaskArmOperation for mocking. + protected DurableTaskArmOperation() + { + } + + internal DurableTaskArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal DurableTaskArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, bool skipApiVersionOverride = false, string apiVersionOverrideValue = null) + { + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); + if (nextLinkOperation is NextLinkOperationImplementation nextLinkOperationValue) + { + _nextLinkOperation = nextLinkOperationValue; + _operationId = _nextLinkOperation.OperationId; + } + else + { + _completeRehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(request.Method, request.Uri.ToUri(), response, finalStateVia); + _operationId = GetOperationId(_completeRehydrationToken); + } + _operation = new OperationInternal(nextLinkOperation, clientDiagnostics, response, "DurableTaskArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + } + + private string GetOperationId(RehydrationToken? rehydrationToken) + { + if (rehydrationToken is null) + { + return null; + } + var lroDetails = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json).ToObjectFromJson>(); + return lroDetails["id"]; + } + /// + public override string Id => _operationId ?? NextLinkOperationImplementation.NotSet; + + /// + public override RehydrationToken? GetRehydrationToken() => _nextLinkOperation?.GetRehydrationToken() ?? _completeRehydrationToken; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.RawResponse; + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override Response WaitForCompletionResponse(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponse(cancellationToken); + + /// + public override Response WaitForCompletionResponse(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponse(pollingInterval, cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/LongRunningOperation/DurableTaskArmOperationOfT.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/LongRunningOperation/DurableTaskArmOperationOfT.cs new file mode 100644 index 000000000000..dbab97aea54e --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/LongRunningOperation/DurableTaskArmOperationOfT.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DurableTask +{ +#pragma warning disable SA1649 // File name should match first type name + internal class DurableTaskArmOperation : ArmOperation +#pragma warning restore SA1649 // File name should match first type name + { + private readonly OperationInternal _operation; + private readonly RehydrationToken? _completeRehydrationToken; + private readonly NextLinkOperationImplementation _nextLinkOperation; + private readonly string _operationId; + + /// Initializes a new instance of DurableTaskArmOperation for mocking. + protected DurableTaskArmOperation() + { + } + + internal DurableTaskArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response.GetRawResponse(), response.Value); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal DurableTaskArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, bool skipApiVersionOverride = false, string apiVersionOverrideValue = null) + { + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); + if (nextLinkOperation is NextLinkOperationImplementation nextLinkOperationValue) + { + _nextLinkOperation = nextLinkOperationValue; + _operationId = _nextLinkOperation.OperationId; + } + else + { + _completeRehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(request.Method, request.Uri.ToUri(), response, finalStateVia); + _operationId = GetOperationId(_completeRehydrationToken); + } + _operation = new OperationInternal(NextLinkOperationImplementation.Create(source, nextLinkOperation), clientDiagnostics, response, "DurableTaskArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + } + + private string GetOperationId(RehydrationToken? rehydrationToken) + { + if (rehydrationToken is null) + { + return null; + } + var lroDetails = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json).ToObjectFromJson>(); + return lroDetails["id"]; + } + /// + public override string Id => _operationId ?? NextLinkOperationImplementation.NotSet; + + /// + public override RehydrationToken? GetRehydrationToken() => _nextLinkOperation?.GetRehydrationToken() ?? _completeRehydrationToken; + + /// + public override T Value => _operation.Value; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.RawResponse; + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override Response WaitForCompletion(CancellationToken cancellationToken = default) => _operation.WaitForCompletion(cancellationToken); + + /// + public override Response WaitForCompletion(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletion(pollingInterval, cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/LongRunningOperation/SchedulerOperationSource.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/LongRunningOperation/SchedulerOperationSource.cs new file mode 100644 index 000000000000..42ece9ff12c1 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/LongRunningOperation/SchedulerOperationSource.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.ClientModel.Primitives; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.DurableTask +{ + internal class SchedulerOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal SchedulerOperationSource(ArmClient client) + { + _client = client; + } + + SchedulerResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content); + return new SchedulerResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content); + return await Task.FromResult(new SchedulerResource(_client, data)).ConfigureAwait(false); + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/LongRunningOperation/TaskHubOperationSource.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/LongRunningOperation/TaskHubOperationSource.cs new file mode 100644 index 000000000000..cf7b9d83c7b6 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/LongRunningOperation/TaskHubOperationSource.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.ClientModel.Primitives; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.DurableTask +{ + internal class TaskHubOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal TaskHubOperationSource(ArmClient client) + { + _client = client; + } + + TaskHubResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content); + return new TaskHubResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content); + return await Task.FromResult(new TaskHubResource(_client, data)).ConfigureAwait(false); + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/ProvisioningState.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/ProvisioningState.cs new file mode 100644 index 000000000000..2705a701b11f --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/ProvisioningState.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DurableTask.Models +{ + /// The status of the current operation. + public readonly partial struct ProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + private const string ProvisioningValue = "Provisioning"; + private const string UpdatingValue = "Updating"; + private const string DeletingValue = "Deleting"; + private const string AcceptedValue = "Accepted"; + + /// Resource has been created. + public static ProvisioningState Succeeded { get; } = new ProvisioningState(SucceededValue); + /// Resource creation failed. + public static ProvisioningState Failed { get; } = new ProvisioningState(FailedValue); + /// Resource creation was canceled. + public static ProvisioningState Canceled { get; } = new ProvisioningState(CanceledValue); + /// The resource is being provisioned. + public static ProvisioningState Provisioning { get; } = new ProvisioningState(ProvisioningValue); + /// The resource is updating. + public static ProvisioningState Updating { get; } = new ProvisioningState(UpdatingValue); + /// The resource is being deleted. + public static ProvisioningState Deleting { get; } = new ProvisioningState(DeletingValue); + /// The resource create request has been accepted. + public static ProvisioningState Accepted { get; } = new ProvisioningState(AcceptedValue); + /// Determines if two values are the same. + public static bool operator ==(ProvisioningState left, ProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ProvisioningState left, ProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ProvisioningState(string value) => new ProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ProvisioningState other && Equals(other); + /// + public bool Equals(ProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/RedundancyState.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/RedundancyState.cs new file mode 100644 index 000000000000..cab76ba363c0 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/RedundancyState.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DurableTask.Models +{ + /// The state of the resource redundancy. + public readonly partial struct RedundancyState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RedundancyState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "None"; + private const string ZoneValue = "Zone"; + + /// The resource is not redundant. + public static RedundancyState None { get; } = new RedundancyState(NoneValue); + /// The resource is zone redundant. + public static RedundancyState Zone { get; } = new RedundancyState(ZoneValue); + /// Determines if two values are the same. + public static bool operator ==(RedundancyState left, RedundancyState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RedundancyState left, RedundancyState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator RedundancyState(string value) => new RedundancyState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RedundancyState other && Equals(other); + /// + public bool Equals(RedundancyState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerListResult.Serialization.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerListResult.Serialization.cs new file mode 100644 index 000000000000..807d24dc9971 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerListResult.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DurableTask.Models +{ + internal partial class SchedulerListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SchedulerListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SchedulerListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SchedulerListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSchedulerListResult(document.RootElement, options); + } + + internal static SchedulerListResult DeserializeSchedulerListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SchedulerData.DeserializeSchedulerData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SchedulerListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SchedulerListResult)} does not support writing '{options.Format}' format."); + } + } + + SchedulerListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSchedulerListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SchedulerListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerListResult.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerListResult.cs new file mode 100644 index 000000000000..85a9ef186815 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.DurableTask.Models +{ + /// The response of a Scheduler list operation. + internal partial class SchedulerListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The Scheduler items on this page. + /// is null. + internal SchedulerListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The Scheduler items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal SchedulerListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SchedulerListResult() + { + } + + /// The Scheduler items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerPatch.Serialization.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerPatch.Serialization.cs new file mode 100644 index 000000000000..f7210c8c994d --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerPatch.Serialization.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DurableTask.Models +{ + public partial class SchedulerPatch : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SchedulerPatch)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SchedulerPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SchedulerPatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSchedulerPatch(document.RootElement, options); + } + + internal static SchedulerPatch DeserializeSchedulerPatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + SchedulerPropertiesUpdate properties = default; + IDictionary tags = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = SchedulerPropertiesUpdate.DeserializeSchedulerPropertiesUpdate(property.Value, options); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SchedulerPatch(properties, tags ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SchedulerPatch)} does not support writing '{options.Format}' format."); + } + } + + SchedulerPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSchedulerPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SchedulerPatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerPatch.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerPatch.cs new file mode 100644 index 000000000000..1ba9640a8146 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerPatch.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DurableTask.Models +{ + /// The update request model for the Scheduler resource. + public partial class SchedulerPatch + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public SchedulerPatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The resource-specific properties for this resource. + /// Resource tags. + /// Keeps track of any properties unknown to the library. + internal SchedulerPatch(SchedulerPropertiesUpdate properties, IDictionary tags, IDictionary serializedAdditionalRawData) + { + Properties = properties; + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public SchedulerPropertiesUpdate Properties { get; set; } + /// Resource tags. + public IDictionary Tags { get; } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerProperties.Serialization.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerProperties.Serialization.cs new file mode 100644 index 000000000000..2133da08804c --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerProperties.Serialization.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DurableTask.Models +{ + public partial class SchedulerProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SchedulerProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(Endpoint)) + { + writer.WritePropertyName("endpoint"u8); + writer.WriteStringValue(Endpoint); + } + writer.WritePropertyName("ipAllowlist"u8); + writer.WriteStartArray(); + foreach (var item in IPAllowlist) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku, options); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SchedulerProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SchedulerProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSchedulerProperties(document.RootElement, options); + } + + internal static SchedulerProperties DeserializeSchedulerProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ProvisioningState? provisioningState = default; + string endpoint = default; + IList ipAllowlist = default; + SchedulerSku sku = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("endpoint"u8)) + { + endpoint = property.Value.GetString(); + continue; + } + if (property.NameEquals("ipAllowlist"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + ipAllowlist = array; + continue; + } + if (property.NameEquals("sku"u8)) + { + sku = SchedulerSku.DeserializeSchedulerSku(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SchedulerProperties(provisioningState, endpoint, ipAllowlist, sku, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SchedulerProperties)} does not support writing '{options.Format}' format."); + } + } + + SchedulerProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSchedulerProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SchedulerProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerProperties.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerProperties.cs new file mode 100644 index 000000000000..622f09dfc0bb --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerProperties.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.DurableTask.Models +{ + /// Details of the Scheduler. + public partial class SchedulerProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// IP allow list for durable task scheduler. Values can be IPv4, IPv6 or CIDR. + /// SKU of the durable task scheduler. + /// or is null. + public SchedulerProperties(IEnumerable ipAllowlist, SchedulerSku sku) + { + Argument.AssertNotNull(ipAllowlist, nameof(ipAllowlist)); + Argument.AssertNotNull(sku, nameof(sku)); + + IPAllowlist = ipAllowlist.ToList(); + Sku = sku; + } + + /// Initializes a new instance of . + /// The status of the last operation. + /// URL of the durable task scheduler. + /// IP allow list for durable task scheduler. Values can be IPv4, IPv6 or CIDR. + /// SKU of the durable task scheduler. + /// Keeps track of any properties unknown to the library. + internal SchedulerProperties(ProvisioningState? provisioningState, string endpoint, IList ipAllowlist, SchedulerSku sku, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + Endpoint = endpoint; + IPAllowlist = ipAllowlist; + Sku = sku; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SchedulerProperties() + { + } + + /// The status of the last operation. + public ProvisioningState? ProvisioningState { get; } + /// URL of the durable task scheduler. + public string Endpoint { get; } + /// IP allow list for durable task scheduler. Values can be IPv4, IPv6 or CIDR. + public IList IPAllowlist { get; } + /// SKU of the durable task scheduler. + public SchedulerSku Sku { get; set; } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerPropertiesUpdate.Serialization.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerPropertiesUpdate.Serialization.cs new file mode 100644 index 000000000000..d6ea1112424f --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerPropertiesUpdate.Serialization.cs @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DurableTask.Models +{ + public partial class SchedulerPropertiesUpdate : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SchedulerPropertiesUpdate)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(Endpoint)) + { + writer.WritePropertyName("endpoint"u8); + writer.WriteStringValue(Endpoint); + } + if (Optional.IsCollectionDefined(IPAllowlist)) + { + writer.WritePropertyName("ipAllowlist"u8); + writer.WriteStartArray(); + foreach (var item in IPAllowlist) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SchedulerPropertiesUpdate IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SchedulerPropertiesUpdate)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSchedulerPropertiesUpdate(document.RootElement, options); + } + + internal static SchedulerPropertiesUpdate DeserializeSchedulerPropertiesUpdate(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ProvisioningState? provisioningState = default; + string endpoint = default; + IList ipAllowlist = default; + SchedulerSkuUpdate sku = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("endpoint"u8)) + { + endpoint = property.Value.GetString(); + continue; + } + if (property.NameEquals("ipAllowlist"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + ipAllowlist = array; + continue; + } + if (property.NameEquals("sku"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = SchedulerSkuUpdate.DeserializeSchedulerSkuUpdate(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SchedulerPropertiesUpdate(provisioningState, endpoint, ipAllowlist ?? new ChangeTrackingList(), sku, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SchedulerPropertiesUpdate)} does not support writing '{options.Format}' format."); + } + } + + SchedulerPropertiesUpdate IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSchedulerPropertiesUpdate(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SchedulerPropertiesUpdate)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerPropertiesUpdate.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerPropertiesUpdate.cs new file mode 100644 index 000000000000..d366144b270e --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerPropertiesUpdate.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DurableTask.Models +{ + /// The Scheduler resource properties to be updated. + public partial class SchedulerPropertiesUpdate + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public SchedulerPropertiesUpdate() + { + IPAllowlist = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The status of the last operation. + /// URL of the durable task scheduler. + /// IP allow list for durable task scheduler. Values can be IPv4, IPv6 or CIDR. + /// SKU of the durable task scheduler. + /// Keeps track of any properties unknown to the library. + internal SchedulerPropertiesUpdate(ProvisioningState? provisioningState, string endpoint, IList ipAllowlist, SchedulerSkuUpdate sku, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + Endpoint = endpoint; + IPAllowlist = ipAllowlist; + Sku = sku; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The status of the last operation. + public ProvisioningState? ProvisioningState { get; } + /// URL of the durable task scheduler. + public string Endpoint { get; } + /// IP allow list for durable task scheduler. Values can be IPv4, IPv6 or CIDR. + public IList IPAllowlist { get; } + /// SKU of the durable task scheduler. + public SchedulerSkuUpdate Sku { get; set; } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerSku.Serialization.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerSku.Serialization.cs new file mode 100644 index 000000000000..e9a1ac002035 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerSku.Serialization.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DurableTask.Models +{ + public partial class SchedulerSku : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SchedulerSku)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + if (Optional.IsDefined(Capacity)) + { + writer.WritePropertyName("capacity"u8); + writer.WriteNumberValue(Capacity.Value); + } + if (options.Format != "W" && Optional.IsDefined(RedundancyState)) + { + writer.WritePropertyName("redundancyState"u8); + writer.WriteStringValue(RedundancyState.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SchedulerSku IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SchedulerSku)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSchedulerSku(document.RootElement, options); + } + + internal static SchedulerSku DeserializeSchedulerSku(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + int? capacity = default; + RedundancyState? redundancyState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("capacity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + capacity = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("redundancyState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + redundancyState = new RedundancyState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SchedulerSku(name, capacity, redundancyState, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SchedulerSku)} does not support writing '{options.Format}' format."); + } + } + + SchedulerSku IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSchedulerSku(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SchedulerSku)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerSku.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerSku.cs new file mode 100644 index 000000000000..9da3588373ca --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerSku.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DurableTask.Models +{ + /// The SKU (Stock Keeping Unit) assigned to this durable task scheduler. + public partial class SchedulerSku + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The name of the SKU. + /// is null. + public SchedulerSku(string name) + { + Argument.AssertNotNull(name, nameof(name)); + + Name = name; + } + + /// Initializes a new instance of . + /// The name of the SKU. + /// The SKU capacity. This allows scale out/in for the resource and impacts zone redundancy. + /// Indicates whether the current SKU configuration is zone redundant. + /// Keeps track of any properties unknown to the library. + internal SchedulerSku(string name, int? capacity, RedundancyState? redundancyState, IDictionary serializedAdditionalRawData) + { + Name = name; + Capacity = capacity; + RedundancyState = redundancyState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SchedulerSku() + { + } + + /// The name of the SKU. + public string Name { get; set; } + /// The SKU capacity. This allows scale out/in for the resource and impacts zone redundancy. + public int? Capacity { get; set; } + /// Indicates whether the current SKU configuration is zone redundant. + public RedundancyState? RedundancyState { get; } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerSkuUpdate.Serialization.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerSkuUpdate.Serialization.cs new file mode 100644 index 000000000000..758a088411bc --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerSkuUpdate.Serialization.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DurableTask.Models +{ + public partial class SchedulerSkuUpdate : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SchedulerSkuUpdate)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Capacity)) + { + writer.WritePropertyName("capacity"u8); + writer.WriteNumberValue(Capacity.Value); + } + if (options.Format != "W" && Optional.IsDefined(RedundancyState)) + { + writer.WritePropertyName("redundancyState"u8); + writer.WriteStringValue(RedundancyState.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SchedulerSkuUpdate IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SchedulerSkuUpdate)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSchedulerSkuUpdate(document.RootElement, options); + } + + internal static SchedulerSkuUpdate DeserializeSchedulerSkuUpdate(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + int? capacity = default; + RedundancyState? redundancyState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("capacity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + capacity = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("redundancyState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + redundancyState = new RedundancyState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SchedulerSkuUpdate(name, capacity, redundancyState, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SchedulerSkuUpdate)} does not support writing '{options.Format}' format."); + } + } + + SchedulerSkuUpdate IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSchedulerSkuUpdate(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SchedulerSkuUpdate)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerSkuUpdate.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerSkuUpdate.cs new file mode 100644 index 000000000000..9b2280a02d6e --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerSkuUpdate.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DurableTask.Models +{ + /// The SKU (Stock Keeping Unit) properties to be updated. + public partial class SchedulerSkuUpdate + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public SchedulerSkuUpdate() + { + } + + /// Initializes a new instance of . + /// The name of the SKU. + /// The SKU capacity. This allows scale out/in for the resource and impacts zone redundancy. + /// Indicates whether the current SKU configuration is zone redundant. + /// Keeps track of any properties unknown to the library. + internal SchedulerSkuUpdate(string name, int? capacity, RedundancyState? redundancyState, IDictionary serializedAdditionalRawData) + { + Name = name; + Capacity = capacity; + RedundancyState = redundancyState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The name of the SKU. + public string Name { get; set; } + /// The SKU capacity. This allows scale out/in for the resource and impacts zone redundancy. + public int? Capacity { get; set; } + /// Indicates whether the current SKU configuration is zone redundant. + public RedundancyState? RedundancyState { get; } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/TaskHubListResult.Serialization.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/TaskHubListResult.Serialization.cs new file mode 100644 index 000000000000..706f23c82194 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/TaskHubListResult.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DurableTask.Models +{ + internal partial class TaskHubListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TaskHubListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TaskHubListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TaskHubListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTaskHubListResult(document.RootElement, options); + } + + internal static TaskHubListResult DeserializeTaskHubListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(TaskHubData.DeserializeTaskHubData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TaskHubListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TaskHubListResult)} does not support writing '{options.Format}' format."); + } + } + + TaskHubListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTaskHubListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TaskHubListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/TaskHubListResult.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/TaskHubListResult.cs new file mode 100644 index 000000000000..a15dd30e019b --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/TaskHubListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.DurableTask.Models +{ + /// The response of a TaskHub list operation. + internal partial class TaskHubListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The TaskHub items on this page. + /// is null. + internal TaskHubListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The TaskHub items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal TaskHubListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TaskHubListResult() + { + } + + /// The TaskHub items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/TaskHubProperties.Serialization.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/TaskHubProperties.Serialization.cs new file mode 100644 index 000000000000..a11a47a6a039 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/TaskHubProperties.Serialization.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DurableTask.Models +{ + public partial class TaskHubProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TaskHubProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(DashboardUri)) + { + writer.WritePropertyName("dashboardUrl"u8); + writer.WriteStringValue(DashboardUri.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TaskHubProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TaskHubProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTaskHubProperties(document.RootElement, options); + } + + internal static TaskHubProperties DeserializeTaskHubProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ProvisioningState? provisioningState = default; + Uri dashboardUrl = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("dashboardUrl"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dashboardUrl = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TaskHubProperties(provisioningState, dashboardUrl, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TaskHubProperties)} does not support writing '{options.Format}' format."); + } + } + + TaskHubProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTaskHubProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TaskHubProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/TaskHubProperties.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/TaskHubProperties.cs new file mode 100644 index 000000000000..97074a8f32f9 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/TaskHubProperties.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DurableTask.Models +{ + /// The properties of Task Hub. + public partial class TaskHubProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public TaskHubProperties() + { + } + + /// Initializes a new instance of . + /// The status of the last operation. + /// URL of the durable task scheduler dashboard. + /// Keeps track of any properties unknown to the library. + internal TaskHubProperties(ProvisioningState? provisioningState, Uri dashboardUri, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + DashboardUri = dashboardUri; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The status of the last operation. + public ProvisioningState? ProvisioningState { get; } + /// URL of the durable task scheduler dashboard. + public Uri DashboardUri { get; } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/ProviderConstants.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/ProviderConstants.cs new file mode 100644 index 000000000000..6cb750df8d05 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/ProviderConstants.cs @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DurableTask +{ + internal static class ProviderConstants + { + public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly); + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/RestOperations/SchedulersRestOperations.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/RestOperations/SchedulersRestOperations.cs new file mode 100644 index 000000000000..21e9f86cbb77 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/RestOperations/SchedulersRestOperations.cs @@ -0,0 +1,723 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DurableTask.Models; + +namespace Azure.ResourceManager.DurableTask +{ + internal partial class SchedulersRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of SchedulersRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public SchedulersRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2024-10-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string schedulerName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DurableTask/schedulers/", false); + uri.AppendPath(schedulerName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string schedulerName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DurableTask/schedulers/", false); + uri.AppendPath(schedulerName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a Scheduler. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string schedulerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, schedulerName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SchedulerData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = SchedulerData.DeserializeSchedulerData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SchedulerData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a Scheduler. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string schedulerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, schedulerName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SchedulerData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = SchedulerData.DeserializeSchedulerData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SchedulerData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string schedulerName, SchedulerData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DurableTask/schedulers/", false); + uri.AppendPath(schedulerName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string schedulerName, SchedulerData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DurableTask/schedulers/", false); + uri.AppendPath(schedulerName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create or update a Scheduler. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// Resource create parameters. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string schedulerName, SchedulerData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, schedulerName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create or update a Scheduler. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// Resource create parameters. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string schedulerName, SchedulerData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, schedulerName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string schedulerName, SchedulerPatch patch) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DurableTask/schedulers/", false); + uri.AppendPath(schedulerName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string schedulerName, SchedulerPatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DurableTask/schedulers/", false); + uri.AppendPath(schedulerName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update a Scheduler. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string schedulerName, SchedulerPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, schedulerName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a Scheduler. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string schedulerName, SchedulerPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, schedulerName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string schedulerName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DurableTask/schedulers/", false); + uri.AppendPath(schedulerName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string schedulerName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DurableTask/schedulers/", false); + uri.AppendPath(schedulerName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a Scheduler. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string schedulerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, schedulerName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a Scheduler. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string schedulerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, schedulerName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DurableTask/schedulers", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DurableTask/schedulers", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Schedulers by resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SchedulerListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = SchedulerListResult.DeserializeSchedulerListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Schedulers by resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SchedulerListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = SchedulerListResult.DeserializeSchedulerListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.DurableTask/schedulers", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.DurableTask/schedulers", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Schedulers by subscription. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SchedulerListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = SchedulerListResult.DeserializeSchedulerListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Schedulers by subscription. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscription(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SchedulerListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = SchedulerListResult.DeserializeSchedulerListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Schedulers by resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SchedulerListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = SchedulerListResult.DeserializeSchedulerListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Schedulers by resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SchedulerListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = SchedulerListResult.DeserializeSchedulerListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Schedulers by subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SchedulerListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = SchedulerListResult.DeserializeSchedulerListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Schedulers by subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SchedulerListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = SchedulerListResult.DeserializeSchedulerListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/RestOperations/TaskHubsRestOperations.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/RestOperations/TaskHubsRestOperations.cs new file mode 100644 index 000000000000..5dea474a259b --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/RestOperations/TaskHubsRestOperations.cs @@ -0,0 +1,513 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DurableTask.Models; + +namespace Azure.ResourceManager.DurableTask +{ + internal partial class TaskHubsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of TaskHubsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public TaskHubsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2024-10-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string schedulerName, string taskHubName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DurableTask/schedulers/", false); + uri.AppendPath(schedulerName, true); + uri.AppendPath("/taskHubs/", false); + uri.AppendPath(taskHubName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string schedulerName, string taskHubName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DurableTask/schedulers/", false); + uri.AppendPath(schedulerName, true); + uri.AppendPath("/taskHubs/", false); + uri.AppendPath(taskHubName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a Task Hub. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// The name of the TaskHub. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string schedulerName, string taskHubName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + Argument.AssertNotNullOrEmpty(taskHubName, nameof(taskHubName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, schedulerName, taskHubName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TaskHubData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = TaskHubData.DeserializeTaskHubData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TaskHubData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a Task Hub. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// The name of the TaskHub. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string schedulerName, string taskHubName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + Argument.AssertNotNullOrEmpty(taskHubName, nameof(taskHubName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, schedulerName, taskHubName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TaskHubData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = TaskHubData.DeserializeTaskHubData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TaskHubData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string schedulerName, string taskHubName, TaskHubData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DurableTask/schedulers/", false); + uri.AppendPath(schedulerName, true); + uri.AppendPath("/taskHubs/", false); + uri.AppendPath(taskHubName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string schedulerName, string taskHubName, TaskHubData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DurableTask/schedulers/", false); + uri.AppendPath(schedulerName, true); + uri.AppendPath("/taskHubs/", false); + uri.AppendPath(taskHubName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create or Update a Task Hub. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// The name of the TaskHub. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string schedulerName, string taskHubName, TaskHubData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + Argument.AssertNotNullOrEmpty(taskHubName, nameof(taskHubName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, schedulerName, taskHubName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create or Update a Task Hub. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// The name of the TaskHub. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string schedulerName, string taskHubName, TaskHubData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + Argument.AssertNotNullOrEmpty(taskHubName, nameof(taskHubName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, schedulerName, taskHubName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string schedulerName, string taskHubName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DurableTask/schedulers/", false); + uri.AppendPath(schedulerName, true); + uri.AppendPath("/taskHubs/", false); + uri.AppendPath(taskHubName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string schedulerName, string taskHubName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DurableTask/schedulers/", false); + uri.AppendPath(schedulerName, true); + uri.AppendPath("/taskHubs/", false); + uri.AppendPath(taskHubName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a Task Hub. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// The name of the TaskHub. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string schedulerName, string taskHubName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + Argument.AssertNotNullOrEmpty(taskHubName, nameof(taskHubName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, schedulerName, taskHubName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a Task Hub. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// The name of the TaskHub. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string schedulerName, string taskHubName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + Argument.AssertNotNullOrEmpty(taskHubName, nameof(taskHubName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, schedulerName, taskHubName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySchedulerRequestUri(string subscriptionId, string resourceGroupName, string schedulerName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DurableTask/schedulers/", false); + uri.AppendPath(schedulerName, true); + uri.AppendPath("/taskHubs", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListBySchedulerRequest(string subscriptionId, string resourceGroupName, string schedulerName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DurableTask/schedulers/", false); + uri.AppendPath(schedulerName, true); + uri.AppendPath("/taskHubs", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Task Hubs. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListBySchedulerAsync(string subscriptionId, string resourceGroupName, string schedulerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + + using var message = CreateListBySchedulerRequest(subscriptionId, resourceGroupName, schedulerName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TaskHubListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = TaskHubListResult.DeserializeTaskHubListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Task Hubs. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByScheduler(string subscriptionId, string resourceGroupName, string schedulerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + + using var message = CreateListBySchedulerRequest(subscriptionId, resourceGroupName, schedulerName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TaskHubListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = TaskHubListResult.DeserializeTaskHubListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySchedulerNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string schedulerName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListBySchedulerNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string schedulerName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Task Hubs. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListBySchedulerNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string schedulerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + + using var message = CreateListBySchedulerNextPageRequest(nextLink, subscriptionId, resourceGroupName, schedulerName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TaskHubListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = TaskHubListResult.DeserializeTaskHubListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Task Hubs. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListBySchedulerNextPage(string nextLink, string subscriptionId, string resourceGroupName, string schedulerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + + using var message = CreateListBySchedulerNextPageRequest(nextLink, subscriptionId, resourceGroupName, schedulerName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TaskHubListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = TaskHubListResult.DeserializeTaskHubListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerCollection.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerCollection.cs new file mode 100644 index 000000000000..e99481ec7eda --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerCollection.cs @@ -0,0 +1,494 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.DurableTask +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetSchedulers method from an instance of . + /// + public partial class SchedulerCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _schedulerClientDiagnostics; + private readonly SchedulersRestOperations _schedulerRestClient; + + /// Initializes a new instance of the class for mocking. + protected SchedulerCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal SchedulerCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _schedulerClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DurableTask", SchedulerResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(SchedulerResource.ResourceType, out string schedulerApiVersion); + _schedulerRestClient = new SchedulersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, schedulerApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + } + + /// + /// Create or update a Scheduler + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the Scheduler. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string schedulerName, SchedulerData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _schedulerRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, schedulerName, data, cancellationToken).ConfigureAwait(false); + var operation = new DurableTaskArmOperation(new SchedulerOperationSource(Client), _schedulerClientDiagnostics, Pipeline, _schedulerRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, schedulerName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update a Scheduler + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the Scheduler. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string schedulerName, SchedulerData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _schedulerRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, schedulerName, data, cancellationToken); + var operation = new DurableTaskArmOperation(new SchedulerOperationSource(Client), _schedulerClientDiagnostics, Pipeline, _schedulerRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, schedulerName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Scheduler + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Scheduler. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string schedulerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerCollection.Get"); + scope.Start(); + try + { + var response = await _schedulerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, schedulerName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SchedulerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Scheduler + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Scheduler. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string schedulerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerCollection.Get"); + scope.Start(); + try + { + var response = _schedulerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, schedulerName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SchedulerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List Schedulers by resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers + /// + /// + /// Operation Id + /// Scheduler_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _schedulerRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _schedulerRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SchedulerResource(Client, SchedulerData.DeserializeSchedulerData(e)), _schedulerClientDiagnostics, Pipeline, "SchedulerCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List Schedulers by resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers + /// + /// + /// Operation Id + /// Scheduler_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _schedulerRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _schedulerRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SchedulerResource(Client, SchedulerData.DeserializeSchedulerData(e)), _schedulerClientDiagnostics, Pipeline, "SchedulerCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Scheduler. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string schedulerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerCollection.Exists"); + scope.Start(); + try + { + var response = await _schedulerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, schedulerName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Scheduler. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string schedulerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerCollection.Exists"); + scope.Start(); + try + { + var response = _schedulerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, schedulerName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Scheduler. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string schedulerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _schedulerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, schedulerName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SchedulerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Scheduler. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string schedulerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _schedulerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, schedulerName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SchedulerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerData.Serialization.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerData.Serialization.cs new file mode 100644 index 000000000000..b3df03072f2b --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerData.Serialization.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.DurableTask.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DurableTask +{ + public partial class SchedulerData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SchedulerData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + SchedulerData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SchedulerData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSchedulerData(document.RootElement, options); + } + + internal static SchedulerData DeserializeSchedulerData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + SchedulerProperties properties = default; + IDictionary tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = SchedulerProperties.DeserializeSchedulerProperties(property.Value, options); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SchedulerData( + id, + name, + type, + systemData, + tags ?? new ChangeTrackingDictionary(), + location, + properties, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SchedulerData)} does not support writing '{options.Format}' format."); + } + } + + SchedulerData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSchedulerData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SchedulerData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerData.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerData.cs new file mode 100644 index 000000000000..b0efc6bb0c8b --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerData.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.DurableTask.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DurableTask +{ + /// + /// A class representing the Scheduler data model. + /// A Durable Task Scheduler resource + /// + public partial class SchedulerData : TrackedResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The location. + public SchedulerData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal SchedulerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, SchedulerProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SchedulerData() + { + } + + /// The resource-specific properties for this resource. + public SchedulerProperties Properties { get; set; } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerResource.Serialization.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerResource.Serialization.cs new file mode 100644 index 000000000000..ee2bf83f4e2f --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.DurableTask +{ + public partial class SchedulerResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + SchedulerData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + SchedulerData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerResource.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerResource.cs new file mode 100644 index 000000000000..846c47ecc17d --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerResource.cs @@ -0,0 +1,776 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DurableTask.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.DurableTask +{ + /// + /// A Class representing a Scheduler along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetSchedulerResource method. + /// Otherwise you can get one from its parent resource using the GetScheduler method. + /// + public partial class SchedulerResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The schedulerName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string schedulerName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _schedulerClientDiagnostics; + private readonly SchedulersRestOperations _schedulerRestClient; + private readonly SchedulerData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.DurableTask/schedulers"; + + /// Initializes a new instance of the class for mocking. + protected SchedulerResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SchedulerResource(ArmClient client, SchedulerData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal SchedulerResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _schedulerClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DurableTask", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string schedulerApiVersion); + _schedulerRestClient = new SchedulersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, schedulerApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual SchedulerData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Gets a collection of TaskHubResources in the Scheduler. + /// An object representing collection of TaskHubResources and their operations over a TaskHubResource. + public virtual TaskHubCollection GetTaskHubs() + { + return GetCachedClient(client => new TaskHubCollection(client, Id)); + } + + /// + /// Get a Task Hub + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName} + /// + /// + /// Operation Id + /// TaskHub_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the TaskHub. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetTaskHubAsync(string taskHubName, CancellationToken cancellationToken = default) + { + return await GetTaskHubs().GetAsync(taskHubName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a Task Hub + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName} + /// + /// + /// Operation Id + /// TaskHub_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the TaskHub. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetTaskHub(string taskHubName, CancellationToken cancellationToken = default) + { + return GetTaskHubs().Get(taskHubName, cancellationToken); + } + + /// + /// Get a Scheduler + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerResource.Get"); + scope.Start(); + try + { + var response = await _schedulerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SchedulerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Scheduler + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerResource.Get"); + scope.Start(); + try + { + var response = _schedulerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SchedulerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a Scheduler + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Delete + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerResource.Delete"); + scope.Start(); + try + { + var response = await _schedulerRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new DurableTaskArmOperation(_schedulerClientDiagnostics, Pipeline, _schedulerRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a Scheduler + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Delete + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerResource.Delete"); + scope.Start(); + try + { + var response = _schedulerRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new DurableTaskArmOperation(_schedulerClientDiagnostics, Pipeline, _schedulerRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a Scheduler + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Update + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, SchedulerPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerResource.Update"); + scope.Start(); + try + { + var response = await _schedulerRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new DurableTaskArmOperation(new SchedulerOperationSource(Client), _schedulerClientDiagnostics, Pipeline, _schedulerRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a Scheduler + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Update + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, SchedulerPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerResource.Update"); + scope.Start(); + try + { + var response = _schedulerRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + var operation = new DurableTaskArmOperation(new SchedulerOperationSource(Client), _schedulerClientDiagnostics, Pipeline, _schedulerRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _schedulerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SchedulerResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new SchedulerPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _schedulerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new SchedulerResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new SchedulerPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _schedulerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SchedulerResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new SchedulerPatch(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _schedulerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new SchedulerResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new SchedulerPatch(); + patch.Tags.ReplaceWith(tags); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _schedulerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SchedulerResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new SchedulerPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _schedulerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new SchedulerResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new SchedulerPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubCollection.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubCollection.cs new file mode 100644 index 000000000000..b6cb03eee7e5 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubCollection.cs @@ -0,0 +1,493 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DurableTask +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetTaskHubs method from an instance of . + /// + public partial class TaskHubCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _taskHubClientDiagnostics; + private readonly TaskHubsRestOperations _taskHubRestClient; + + /// Initializes a new instance of the class for mocking. + protected TaskHubCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal TaskHubCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _taskHubClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DurableTask", TaskHubResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(TaskHubResource.ResourceType, out string taskHubApiVersion); + _taskHubRestClient = new TaskHubsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, taskHubApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != SchedulerResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, SchedulerResource.ResourceType), nameof(id)); + } + + /// + /// Create or Update a Task Hub + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName} + /// + /// + /// Operation Id + /// TaskHub_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the TaskHub. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string taskHubName, TaskHubData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(taskHubName, nameof(taskHubName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _taskHubClientDiagnostics.CreateScope("TaskHubCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _taskHubRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, taskHubName, data, cancellationToken).ConfigureAwait(false); + var operation = new DurableTaskArmOperation(new TaskHubOperationSource(Client), _taskHubClientDiagnostics, Pipeline, _taskHubRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, taskHubName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or Update a Task Hub + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName} + /// + /// + /// Operation Id + /// TaskHub_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the TaskHub. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string taskHubName, TaskHubData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(taskHubName, nameof(taskHubName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _taskHubClientDiagnostics.CreateScope("TaskHubCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _taskHubRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, taskHubName, data, cancellationToken); + var operation = new DurableTaskArmOperation(new TaskHubOperationSource(Client), _taskHubClientDiagnostics, Pipeline, _taskHubRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, taskHubName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Task Hub + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName} + /// + /// + /// Operation Id + /// TaskHub_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the TaskHub. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string taskHubName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(taskHubName, nameof(taskHubName)); + + using var scope = _taskHubClientDiagnostics.CreateScope("TaskHubCollection.Get"); + scope.Start(); + try + { + var response = await _taskHubRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, taskHubName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new TaskHubResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Task Hub + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName} + /// + /// + /// Operation Id + /// TaskHub_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the TaskHub. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string taskHubName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(taskHubName, nameof(taskHubName)); + + using var scope = _taskHubClientDiagnostics.CreateScope("TaskHubCollection.Get"); + scope.Start(); + try + { + var response = _taskHubRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, taskHubName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new TaskHubResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List Task Hubs + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs + /// + /// + /// Operation Id + /// TaskHub_ListByScheduler + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _taskHubRestClient.CreateListBySchedulerRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _taskHubRestClient.CreateListBySchedulerNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new TaskHubResource(Client, TaskHubData.DeserializeTaskHubData(e)), _taskHubClientDiagnostics, Pipeline, "TaskHubCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List Task Hubs + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs + /// + /// + /// Operation Id + /// TaskHub_ListByScheduler + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _taskHubRestClient.CreateListBySchedulerRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _taskHubRestClient.CreateListBySchedulerNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new TaskHubResource(Client, TaskHubData.DeserializeTaskHubData(e)), _taskHubClientDiagnostics, Pipeline, "TaskHubCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName} + /// + /// + /// Operation Id + /// TaskHub_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the TaskHub. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string taskHubName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(taskHubName, nameof(taskHubName)); + + using var scope = _taskHubClientDiagnostics.CreateScope("TaskHubCollection.Exists"); + scope.Start(); + try + { + var response = await _taskHubRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, taskHubName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName} + /// + /// + /// Operation Id + /// TaskHub_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the TaskHub. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string taskHubName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(taskHubName, nameof(taskHubName)); + + using var scope = _taskHubClientDiagnostics.CreateScope("TaskHubCollection.Exists"); + scope.Start(); + try + { + var response = _taskHubRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, taskHubName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName} + /// + /// + /// Operation Id + /// TaskHub_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the TaskHub. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string taskHubName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(taskHubName, nameof(taskHubName)); + + using var scope = _taskHubClientDiagnostics.CreateScope("TaskHubCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _taskHubRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, taskHubName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TaskHubResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName} + /// + /// + /// Operation Id + /// TaskHub_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the TaskHub. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string taskHubName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(taskHubName, nameof(taskHubName)); + + using var scope = _taskHubClientDiagnostics.CreateScope("TaskHubCollection.GetIfExists"); + scope.Start(); + try + { + var response = _taskHubRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, taskHubName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TaskHubResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubData.Serialization.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubData.Serialization.cs new file mode 100644 index 000000000000..ebedcde70af3 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubData.Serialization.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.DurableTask.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DurableTask +{ + public partial class TaskHubData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TaskHubData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + TaskHubData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TaskHubData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTaskHubData(document.RootElement, options); + } + + internal static TaskHubData DeserializeTaskHubData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + TaskHubProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = TaskHubProperties.DeserializeTaskHubProperties(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TaskHubData( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TaskHubData)} does not support writing '{options.Format}' format."); + } + } + + TaskHubData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTaskHubData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TaskHubData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubData.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubData.cs new file mode 100644 index 000000000000..32ccf2cef315 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubData.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.DurableTask.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DurableTask +{ + /// + /// A class representing the TaskHub data model. + /// A Task Hub resource belonging to the scheduler + /// + public partial class TaskHubData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public TaskHubData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal TaskHubData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, TaskHubProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public TaskHubProperties Properties { get; set; } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubResource.Serialization.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubResource.Serialization.cs new file mode 100644 index 000000000000..dbb7d1eccb6a --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.DurableTask +{ + public partial class TaskHubResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + TaskHubData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + TaskHubData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubResource.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubResource.cs new file mode 100644 index 000000000000..732958f3e416 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubResource.cs @@ -0,0 +1,347 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DurableTask +{ + /// + /// A Class representing a TaskHub along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetTaskHubResource method. + /// Otherwise you can get one from its parent resource using the GetTaskHub method. + /// + public partial class TaskHubResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The schedulerName. + /// The taskHubName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string schedulerName, string taskHubName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _taskHubClientDiagnostics; + private readonly TaskHubsRestOperations _taskHubRestClient; + private readonly TaskHubData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.DurableTask/schedulers/taskHubs"; + + /// Initializes a new instance of the class for mocking. + protected TaskHubResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal TaskHubResource(ArmClient client, TaskHubData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal TaskHubResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _taskHubClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DurableTask", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string taskHubApiVersion); + _taskHubRestClient = new TaskHubsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, taskHubApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual TaskHubData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get a Task Hub + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName} + /// + /// + /// Operation Id + /// TaskHub_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _taskHubClientDiagnostics.CreateScope("TaskHubResource.Get"); + scope.Start(); + try + { + var response = await _taskHubRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new TaskHubResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Task Hub + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName} + /// + /// + /// Operation Id + /// TaskHub_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _taskHubClientDiagnostics.CreateScope("TaskHubResource.Get"); + scope.Start(); + try + { + var response = _taskHubRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new TaskHubResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a Task Hub + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName} + /// + /// + /// Operation Id + /// TaskHub_Delete + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _taskHubClientDiagnostics.CreateScope("TaskHubResource.Delete"); + scope.Start(); + try + { + var response = await _taskHubRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new DurableTaskArmOperation(_taskHubClientDiagnostics, Pipeline, _taskHubRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a Task Hub + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName} + /// + /// + /// Operation Id + /// TaskHub_Delete + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _taskHubClientDiagnostics.CreateScope("TaskHubResource.Delete"); + scope.Start(); + try + { + var response = _taskHubRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new DurableTaskArmOperation(_taskHubClientDiagnostics, Pipeline, _taskHubRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or Update a Task Hub + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName} + /// + /// + /// Operation Id + /// TaskHub_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, TaskHubData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _taskHubClientDiagnostics.CreateScope("TaskHubResource.Update"); + scope.Start(); + try + { + var response = await _taskHubRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new DurableTaskArmOperation(new TaskHubOperationSource(Client), _taskHubClientDiagnostics, Pipeline, _taskHubRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or Update a Task Hub + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName} + /// + /// + /// Operation Id + /// TaskHub_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, TaskHubData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _taskHubClientDiagnostics.CreateScope("TaskHubResource.Update"); + scope.Start(); + try + { + var response = _taskHubRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new DurableTaskArmOperation(new TaskHubOperationSource(Client), _taskHubClientDiagnostics, Pipeline, _taskHubRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Properties/AssemblyInfo.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..f4ddd8db408b --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Properties/AssemblyInfo.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Azure.ResourceManager.DurableTask.Tests, PublicKey = 0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] + +// Replace Microsoft.Test with the correct resource provider namepace for your service and uncomment. +// See https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-services-resource-providers +// for the list of possible values. +[assembly: Azure.Core.AzureResourceProviderNamespace("DurableTask")] diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/tests/Azure.ResourceManager.DurableTask.Tests.csproj b/sdk/durabletask/Azure.ResourceManager.DurableTask/tests/Azure.ResourceManager.DurableTask.Tests.csproj new file mode 100644 index 000000000000..c0676a62c635 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/tests/Azure.ResourceManager.DurableTask.Tests.csproj @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/tests/DurableTaskManagementTestBase.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/tests/DurableTaskManagementTestBase.cs new file mode 100644 index 000000000000..f71a1438b58a --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/tests/DurableTaskManagementTestBase.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure; +using Azure.Core; +using Azure.Core.TestFramework; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.TestFramework; +using NUnit.Framework; +using System.Threading.Tasks; + +namespace Azure.ResourceManager.DurableTask.Tests +{ + public class DurableTaskManagementTestBase : ManagementRecordedTestBase + { + protected ArmClient Client { get; private set; } + protected SubscriptionResource DefaultSubscription { get; private set; } + + protected DurableTaskManagementTestBase(bool isAsync, RecordedTestMode mode) + : base(isAsync, mode) + { + } + + protected DurableTaskManagementTestBase(bool isAsync) + : base(isAsync) + { + } + + [SetUp] + public async Task CreateCommonClient() + { + Client = GetArmClient(); + DefaultSubscription = await Client.GetDefaultSubscriptionAsync().ConfigureAwait(false); + } + + protected async Task CreateResourceGroup(SubscriptionResource subscription, string rgNamePrefix, AzureLocation location) + { + string rgName = Recording.GenerateAssetName(rgNamePrefix); + ResourceGroupData input = new ResourceGroupData(location); + var lro = await subscription.GetResourceGroups().CreateOrUpdateAsync(WaitUntil.Completed, rgName, input); + return lro.Value; + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/tests/DurableTaskManagementTestEnvironment.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/tests/DurableTaskManagementTestEnvironment.cs new file mode 100644 index 000000000000..e95562b17623 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/tests/DurableTaskManagementTestEnvironment.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core.TestFramework; + +namespace Azure.ResourceManager.DurableTask.Tests +{ + public class DurableTaskManagementTestEnvironment : TestEnvironment + { + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/tsp-location.yaml b/sdk/durabletask/Azure.ResourceManager.DurableTask/tsp-location.yaml new file mode 100644 index 000000000000..2a469400e90c --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/durabletask/DurableTask.Management +commit: 54b1384a56710dd114569774b5f90a6b5778bd31 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/durabletask/ci.mgmt.yml b/sdk/durabletask/ci.mgmt.yml new file mode 100644 index 000000000000..8e58a086dadf --- /dev/null +++ b/sdk/durabletask/ci.mgmt.yml @@ -0,0 +1,26 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: none + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/durabletask /ci.mgmt.yml + - sdk/durabletask /Azure.ResourceManager.DurableTask / + + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: durabletask + ArtifactName: packages + LimitForPullRequest: true + Artifacts: + - name: Azure.ResourceManager.DurableTask + safeName: AzureResourceManagerDurableTask diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/api/Azure.Health.Insights.RadiologyInsights.net8.0.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/api/Azure.Health.Insights.RadiologyInsights.net8.0.cs index 2884afa3f79d..c0083ed6a633 100644 --- a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/api/Azure.Health.Insights.RadiologyInsights.net8.0.cs +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/api/Azure.Health.Insights.RadiologyInsights.net8.0.cs @@ -10,6 +10,18 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class AssessmentValueRange : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AssessmentValueRange() { } + public string Maximum { get { throw null; } } + public string Minimum { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.AssessmentValueRange System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.AssessmentValueRange System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class ClinicalDocumentAuthor : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public ClinicalDocumentAuthor() { } @@ -703,9 +715,55 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class GuidanceInference : Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInference, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal GuidanceInference() { } + public Azure.Health.Insights.RadiologyInsights.FindingInference Finding { get { throw null; } } + public Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept Identifier { get { throw null; } } + public System.Collections.Generic.IReadOnlyList MissingGuidanceInformation { get { throw null; } } + public System.Collections.Generic.IReadOnlyList PresentGuidanceInformation { get { throw null; } } + public Azure.Health.Insights.RadiologyInsights.GuidanceRankingType Ranking { get { throw null; } } + public System.Collections.Generic.IReadOnlyList RecommendationProposals { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.GuidanceInference System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.GuidanceInference System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class GuidanceOptions : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public GuidanceOptions(bool showGuidanceInHistory) { } + public bool ShowGuidanceInHistory { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.GuidanceOptions System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.GuidanceOptions System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct GuidanceRankingType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public GuidanceRankingType(string value) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.GuidanceRankingType High { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.GuidanceRankingType Low { get { throw null; } } + public bool Equals(Azure.Health.Insights.RadiologyInsights.GuidanceRankingType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Health.Insights.RadiologyInsights.GuidanceRankingType left, Azure.Health.Insights.RadiologyInsights.GuidanceRankingType right) { throw null; } + public static implicit operator Azure.Health.Insights.RadiologyInsights.GuidanceRankingType (string value) { throw null; } + public static bool operator !=(Azure.Health.Insights.RadiologyInsights.GuidanceRankingType left, Azure.Health.Insights.RadiologyInsights.GuidanceRankingType right) { throw null; } + public override string ToString() { throw null; } + } public static partial class HealthInsightsRadiologyInsightsModelFactory { public static Azure.Health.Insights.RadiologyInsights.AgeMismatchInference AgeMismatchInference(System.Collections.Generic.IEnumerable extension = null) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.AssessmentValueRange AssessmentValueRange(string minimum = null, string maximum = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.CompleteOrderDiscrepancyInference CompleteOrderDiscrepancyInference(System.Collections.Generic.IEnumerable extension = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept orderType = null, System.Collections.Generic.IEnumerable missingBodyParts = null, System.Collections.Generic.IEnumerable missingBodyPartMeasurements = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.CriticalResult CriticalResult(string description = null, Azure.Health.Insights.RadiologyInsights.FhirR4Observation finding = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.CriticalResultInference CriticalResultInference(System.Collections.Generic.IEnumerable extension = null, Azure.Health.Insights.RadiologyInsights.CriticalResult result = null) { throw null; } @@ -724,11 +782,14 @@ public static partial class HealthInsightsRadiologyInsightsModelFactory public static Azure.Health.Insights.RadiologyInsights.FollowupCommunicationInference FollowupCommunicationInference(System.Collections.Generic.IEnumerable extension = null, System.Collections.Generic.IEnumerable communicatedAt = null, System.Collections.Generic.IEnumerable recipient = null, bool wasAcknowledged = false) { throw null; } public static Azure.Health.Insights.RadiologyInsights.FollowupRecommendationInference FollowupRecommendationInference(System.Collections.Generic.IEnumerable extension = null, string effectiveAt = null, Azure.Health.Insights.RadiologyInsights.FhirR4Period effectivePeriod = null, System.Collections.Generic.IEnumerable findings = null, bool isConditional = false, bool isOption = false, bool isGuideline = false, bool isHedging = false, Azure.Health.Insights.RadiologyInsights.ProcedureRecommendation recommendedProcedure = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.GenericProcedureRecommendation GenericProcedureRecommendation(System.Collections.Generic.IEnumerable extension = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept code = null, string description = null) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.GuidanceInference GuidanceInference(System.Collections.Generic.IEnumerable extension = null, Azure.Health.Insights.RadiologyInsights.FindingInference finding = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept identifier = null, System.Collections.Generic.IEnumerable presentGuidanceInformation = null, Azure.Health.Insights.RadiologyInsights.GuidanceRankingType ranking = default(Azure.Health.Insights.RadiologyInsights.GuidanceRankingType), System.Collections.Generic.IEnumerable recommendationProposals = null, System.Collections.Generic.IEnumerable missingGuidanceInformation = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.ImagingProcedure ImagingProcedure(Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept modality = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept anatomy = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept laterality = null, Azure.Health.Insights.RadiologyInsights.RadiologyCodeWithTypes contrast = null, Azure.Health.Insights.RadiologyInsights.RadiologyCodeWithTypes view = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.ImagingProcedureRecommendation ImagingProcedureRecommendation(System.Collections.Generic.IEnumerable extension = null, System.Collections.Generic.IEnumerable procedureCodes = null, System.Collections.Generic.IEnumerable imagingProcedures = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.LateralityDiscrepancyInference LateralityDiscrepancyInference(System.Collections.Generic.IEnumerable extension = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept lateralityIndication = null, Azure.Health.Insights.RadiologyInsights.LateralityDiscrepancyType discrepancyType = default(Azure.Health.Insights.RadiologyInsights.LateralityDiscrepancyType)) { throw null; } public static Azure.Health.Insights.RadiologyInsights.LimitedOrderDiscrepancyInference LimitedOrderDiscrepancyInference(System.Collections.Generic.IEnumerable extension = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept orderType = null, System.Collections.Generic.IEnumerable presentBodyParts = null, System.Collections.Generic.IEnumerable presentBodyPartMeasurements = null) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.PresentGuidanceInformation PresentGuidanceInformation(string presentGuidanceItem = null, System.Collections.Generic.IEnumerable sizes = null, Azure.Health.Insights.RadiologyInsights.FhirR4Quantity maximumDiameterAsInText = null, System.Collections.Generic.IEnumerable presentGuidanceValues = null, System.Collections.Generic.IEnumerable extension = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.ProcedureRecommendation ProcedureRecommendation(string kind = null, System.Collections.Generic.IEnumerable extension = null) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureInference QualityMeasureInference(System.Collections.Generic.IEnumerable extension = null, string qualityMeasureDenominator = null, Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType complianceType = default(Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType), System.Collections.Generic.IEnumerable qualityCriteria = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.RadiologyCodeWithTypes RadiologyCodeWithTypes(Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept code = null, System.Collections.Generic.IEnumerable types = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInference RadiologyInsightsInference(string kind = null, System.Collections.Generic.IEnumerable extension = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceResult RadiologyInsightsInferenceResult(System.Collections.Generic.IEnumerable patientResults = null, string modelVersion = null) { throw null; } @@ -738,6 +799,7 @@ public static partial class HealthInsightsRadiologyInsightsModelFactory public static Azure.Health.Insights.RadiologyInsights.RecommendationFinding RecommendationFinding(Azure.Health.Insights.RadiologyInsights.FhirR4Observation finding = null, Azure.Health.Insights.RadiologyInsights.CriticalResult criticalFinding = null, Azure.Health.Insights.RadiologyInsights.RecommendationFindingStatusType recommendationFindingStatus = default(Azure.Health.Insights.RadiologyInsights.RecommendationFindingStatusType), System.Collections.Generic.IEnumerable extension = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.ResearchStudyArm ResearchStudyArm(string name = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept type = null, string description = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.ResearchStudyObjective ResearchStudyObjective(string name = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept type = null) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentInference ScoringAndAssessmentInference(System.Collections.Generic.IEnumerable extension = null, Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType category = default(Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType), string categoryDescription = null, string singleValue = null, Azure.Health.Insights.RadiologyInsights.AssessmentValueRange rangeValue = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.SexMismatchInference SexMismatchInference(System.Collections.Generic.IEnumerable extension = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept sexIndication = null) { throw null; } } public partial class ImagingProcedure : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel @@ -968,6 +1030,21 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static bool operator !=(Azure.Health.Insights.RadiologyInsights.PatientSex left, Azure.Health.Insights.RadiologyInsights.PatientSex right) { throw null; } public override string ToString() { throw null; } } + public partial class PresentGuidanceInformation : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal PresentGuidanceInformation() { } + public System.Collections.Generic.IReadOnlyList Extension { get { throw null; } } + public Azure.Health.Insights.RadiologyInsights.FhirR4Quantity MaximumDiameterAsInText { get { throw null; } } + public string PresentGuidanceItem { get { throw null; } } + public System.Collections.Generic.IReadOnlyList PresentGuidanceValues { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Sizes { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.PresentGuidanceInformation System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.PresentGuidanceInformation System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public abstract partial class ProcedureRecommendation : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { protected ProcedureRecommendation() { } @@ -979,6 +1056,89 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct QualityMeasureComplianceType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public QualityMeasureComplianceType(string value) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType DenominatorException { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType NotEligible { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType PerformanceMet { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType PerformanceNotMet { get { throw null; } } + public bool Equals(Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType left, Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType right) { throw null; } + public static implicit operator Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType (string value) { throw null; } + public static bool operator !=(Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType left, Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class QualityMeasureInference : Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInference, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal QualityMeasureInference() { } + public Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType ComplianceType { get { throw null; } } + public System.Collections.Generic.IReadOnlyList QualityCriteria { get { throw null; } } + public string QualityMeasureDenominator { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.QualityMeasureInference System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.QualityMeasureInference System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class QualityMeasureOptions : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public QualityMeasureOptions(System.Collections.Generic.IEnumerable measureTypes) { } + public System.Collections.Generic.IList MeasureTypes { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.QualityMeasureOptions System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.QualityMeasureOptions System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct QualityMeasureType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public QualityMeasureType(string value) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Acrad36 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Acrad37 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Acrad38 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Acrad39 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Acrad40 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Acrad41 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Acrad42 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mednax55 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips145 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips147 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips195 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips360 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips364 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips405 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips406 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips436 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips76 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Msn13 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Msn15 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Qmm17 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Qmm18 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Qmm19 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Qmm26 { get { throw null; } } + public bool Equals(Azure.Health.Insights.RadiologyInsights.QualityMeasureType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Health.Insights.RadiologyInsights.QualityMeasureType left, Azure.Health.Insights.RadiologyInsights.QualityMeasureType right) { throw null; } + public static implicit operator Azure.Health.Insights.RadiologyInsights.QualityMeasureType (string value) { throw null; } + public static bool operator !=(Azure.Health.Insights.RadiologyInsights.QualityMeasureType left, Azure.Health.Insights.RadiologyInsights.QualityMeasureType right) { throw null; } + public override string ToString() { throw null; } + } public partial class RadiologyCodeWithTypes : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal RadiologyCodeWithTypes() { } @@ -1006,10 +1166,11 @@ public RadiologyInsightsClient(System.Uri endpoint, Azure.Core.TokenCredential c } public partial class RadiologyInsightsClientOptions : Azure.Core.ClientOptions { - public RadiologyInsightsClientOptions(Azure.Health.Insights.RadiologyInsights.RadiologyInsightsClientOptions.ServiceVersion version = Azure.Health.Insights.RadiologyInsights.RadiologyInsightsClientOptions.ServiceVersion.V2024_04_01) { } + public RadiologyInsightsClientOptions(Azure.Health.Insights.RadiologyInsights.RadiologyInsightsClientOptions.ServiceVersion version = Azure.Health.Insights.RadiologyInsights.RadiologyInsightsClientOptions.ServiceVersion.V2024_10_01) { } public enum ServiceVersion { V2024_04_01 = 1, + V2024_10_01 = 2, } } public partial class RadiologyInsightsData : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel @@ -1040,6 +1201,8 @@ public partial class RadiologyInsightsInferenceOptions : System.ClientModel.Prim public RadiologyInsightsInferenceOptions() { } public Azure.Health.Insights.RadiologyInsights.FindingOptions FindingOptions { get { throw null; } set { } } public Azure.Health.Insights.RadiologyInsights.FollowupRecommendationOptions FollowupRecommendationOptions { get { throw null; } set { } } + public Azure.Health.Insights.RadiologyInsights.GuidanceOptions GuidanceOptions { get { throw null; } set { } } + public Azure.Health.Insights.RadiologyInsights.QualityMeasureOptions QualityMeasureOptions { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceOptions System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -1071,9 +1234,12 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType Finding { get { throw null; } } public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType FollowupCommunication { get { throw null; } } public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType FollowupRecommendation { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType Guidance { get { throw null; } } public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType LateralityDiscrepancy { get { throw null; } } public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType LimitedOrderDiscrepancy { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType QualityMeasure { get { throw null; } } public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType RadiologyProcedure { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType ScoringAndAssessment { get { throw null; } } public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType SexMismatch { get { throw null; } } public bool Equals(Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] @@ -1229,6 +1395,70 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static bool operator !=(Azure.Health.Insights.RadiologyInsights.ResearchStudyStatusCodeType left, Azure.Health.Insights.RadiologyInsights.ResearchStudyStatusCodeType right) { throw null; } public override string ToString() { throw null; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ScoringAndAssessmentCategoryType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ScoringAndAssessmentCategoryType(string value) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType AGATSTONSCORE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType ALBERTASTROKEPROGRAMEARLYCTSCORE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType ASCVDRISK { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType BIRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType CADRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType CALCIUMMASSSCORE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType CALCIUMSCOREUNSPECIFIED { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType CALCIUMVOLUMESCORE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType CEUSLIRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType CRADSCOLONICFINDINGS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType CRADSEXTRACOLONICFINDINGS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType FRAXSCORE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType HNPCCMUTATIONRISK { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType KELLGRENLAWRENCEGRADINGSCALE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType LIFETIMEBREASTCANCERRISK { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType LIRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType LUNGRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType MODIFIEDGAILMODELRISK { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType NIRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType ORADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType ORADSMRI { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType PIRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType RISKOFMALIGNANCYINDEX { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType TENYEARCHDRISK { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType TENYEARCHDRISKARTERIALAGE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType TENYEARCHDRISKOBSERVEDAGE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType TIRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType TONNISCLASSIFICATION { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType TREATMENTRESPONSELIRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType TSCORE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType TYRERCUSICKMODELRISK { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType USLIRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType USLIRADSVISUALIZATIONSCORE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType ZSCORE { get { throw null; } } + public bool Equals(Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType left, Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType right) { throw null; } + public static implicit operator Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType (string value) { throw null; } + public static bool operator !=(Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType left, Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ScoringAndAssessmentInference : Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInference, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ScoringAndAssessmentInference() { } + public Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType Category { get { throw null; } } + public string CategoryDescription { get { throw null; } } + public Azure.Health.Insights.RadiologyInsights.AssessmentValueRange RangeValue { get { throw null; } } + public string SingleValue { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentInference System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentInference System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class SexMismatchInference : Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInference, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal SexMismatchInference() { } diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/api/Azure.Health.Insights.RadiologyInsights.netstandard2.0.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/api/Azure.Health.Insights.RadiologyInsights.netstandard2.0.cs index 2884afa3f79d..c0083ed6a633 100644 --- a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/api/Azure.Health.Insights.RadiologyInsights.netstandard2.0.cs +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/api/Azure.Health.Insights.RadiologyInsights.netstandard2.0.cs @@ -10,6 +10,18 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class AssessmentValueRange : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AssessmentValueRange() { } + public string Maximum { get { throw null; } } + public string Minimum { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.AssessmentValueRange System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.AssessmentValueRange System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class ClinicalDocumentAuthor : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public ClinicalDocumentAuthor() { } @@ -703,9 +715,55 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class GuidanceInference : Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInference, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal GuidanceInference() { } + public Azure.Health.Insights.RadiologyInsights.FindingInference Finding { get { throw null; } } + public Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept Identifier { get { throw null; } } + public System.Collections.Generic.IReadOnlyList MissingGuidanceInformation { get { throw null; } } + public System.Collections.Generic.IReadOnlyList PresentGuidanceInformation { get { throw null; } } + public Azure.Health.Insights.RadiologyInsights.GuidanceRankingType Ranking { get { throw null; } } + public System.Collections.Generic.IReadOnlyList RecommendationProposals { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.GuidanceInference System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.GuidanceInference System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class GuidanceOptions : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public GuidanceOptions(bool showGuidanceInHistory) { } + public bool ShowGuidanceInHistory { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.GuidanceOptions System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.GuidanceOptions System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct GuidanceRankingType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public GuidanceRankingType(string value) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.GuidanceRankingType High { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.GuidanceRankingType Low { get { throw null; } } + public bool Equals(Azure.Health.Insights.RadiologyInsights.GuidanceRankingType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Health.Insights.RadiologyInsights.GuidanceRankingType left, Azure.Health.Insights.RadiologyInsights.GuidanceRankingType right) { throw null; } + public static implicit operator Azure.Health.Insights.RadiologyInsights.GuidanceRankingType (string value) { throw null; } + public static bool operator !=(Azure.Health.Insights.RadiologyInsights.GuidanceRankingType left, Azure.Health.Insights.RadiologyInsights.GuidanceRankingType right) { throw null; } + public override string ToString() { throw null; } + } public static partial class HealthInsightsRadiologyInsightsModelFactory { public static Azure.Health.Insights.RadiologyInsights.AgeMismatchInference AgeMismatchInference(System.Collections.Generic.IEnumerable extension = null) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.AssessmentValueRange AssessmentValueRange(string minimum = null, string maximum = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.CompleteOrderDiscrepancyInference CompleteOrderDiscrepancyInference(System.Collections.Generic.IEnumerable extension = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept orderType = null, System.Collections.Generic.IEnumerable missingBodyParts = null, System.Collections.Generic.IEnumerable missingBodyPartMeasurements = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.CriticalResult CriticalResult(string description = null, Azure.Health.Insights.RadiologyInsights.FhirR4Observation finding = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.CriticalResultInference CriticalResultInference(System.Collections.Generic.IEnumerable extension = null, Azure.Health.Insights.RadiologyInsights.CriticalResult result = null) { throw null; } @@ -724,11 +782,14 @@ public static partial class HealthInsightsRadiologyInsightsModelFactory public static Azure.Health.Insights.RadiologyInsights.FollowupCommunicationInference FollowupCommunicationInference(System.Collections.Generic.IEnumerable extension = null, System.Collections.Generic.IEnumerable communicatedAt = null, System.Collections.Generic.IEnumerable recipient = null, bool wasAcknowledged = false) { throw null; } public static Azure.Health.Insights.RadiologyInsights.FollowupRecommendationInference FollowupRecommendationInference(System.Collections.Generic.IEnumerable extension = null, string effectiveAt = null, Azure.Health.Insights.RadiologyInsights.FhirR4Period effectivePeriod = null, System.Collections.Generic.IEnumerable findings = null, bool isConditional = false, bool isOption = false, bool isGuideline = false, bool isHedging = false, Azure.Health.Insights.RadiologyInsights.ProcedureRecommendation recommendedProcedure = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.GenericProcedureRecommendation GenericProcedureRecommendation(System.Collections.Generic.IEnumerable extension = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept code = null, string description = null) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.GuidanceInference GuidanceInference(System.Collections.Generic.IEnumerable extension = null, Azure.Health.Insights.RadiologyInsights.FindingInference finding = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept identifier = null, System.Collections.Generic.IEnumerable presentGuidanceInformation = null, Azure.Health.Insights.RadiologyInsights.GuidanceRankingType ranking = default(Azure.Health.Insights.RadiologyInsights.GuidanceRankingType), System.Collections.Generic.IEnumerable recommendationProposals = null, System.Collections.Generic.IEnumerable missingGuidanceInformation = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.ImagingProcedure ImagingProcedure(Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept modality = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept anatomy = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept laterality = null, Azure.Health.Insights.RadiologyInsights.RadiologyCodeWithTypes contrast = null, Azure.Health.Insights.RadiologyInsights.RadiologyCodeWithTypes view = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.ImagingProcedureRecommendation ImagingProcedureRecommendation(System.Collections.Generic.IEnumerable extension = null, System.Collections.Generic.IEnumerable procedureCodes = null, System.Collections.Generic.IEnumerable imagingProcedures = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.LateralityDiscrepancyInference LateralityDiscrepancyInference(System.Collections.Generic.IEnumerable extension = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept lateralityIndication = null, Azure.Health.Insights.RadiologyInsights.LateralityDiscrepancyType discrepancyType = default(Azure.Health.Insights.RadiologyInsights.LateralityDiscrepancyType)) { throw null; } public static Azure.Health.Insights.RadiologyInsights.LimitedOrderDiscrepancyInference LimitedOrderDiscrepancyInference(System.Collections.Generic.IEnumerable extension = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept orderType = null, System.Collections.Generic.IEnumerable presentBodyParts = null, System.Collections.Generic.IEnumerable presentBodyPartMeasurements = null) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.PresentGuidanceInformation PresentGuidanceInformation(string presentGuidanceItem = null, System.Collections.Generic.IEnumerable sizes = null, Azure.Health.Insights.RadiologyInsights.FhirR4Quantity maximumDiameterAsInText = null, System.Collections.Generic.IEnumerable presentGuidanceValues = null, System.Collections.Generic.IEnumerable extension = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.ProcedureRecommendation ProcedureRecommendation(string kind = null, System.Collections.Generic.IEnumerable extension = null) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureInference QualityMeasureInference(System.Collections.Generic.IEnumerable extension = null, string qualityMeasureDenominator = null, Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType complianceType = default(Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType), System.Collections.Generic.IEnumerable qualityCriteria = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.RadiologyCodeWithTypes RadiologyCodeWithTypes(Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept code = null, System.Collections.Generic.IEnumerable types = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInference RadiologyInsightsInference(string kind = null, System.Collections.Generic.IEnumerable extension = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceResult RadiologyInsightsInferenceResult(System.Collections.Generic.IEnumerable patientResults = null, string modelVersion = null) { throw null; } @@ -738,6 +799,7 @@ public static partial class HealthInsightsRadiologyInsightsModelFactory public static Azure.Health.Insights.RadiologyInsights.RecommendationFinding RecommendationFinding(Azure.Health.Insights.RadiologyInsights.FhirR4Observation finding = null, Azure.Health.Insights.RadiologyInsights.CriticalResult criticalFinding = null, Azure.Health.Insights.RadiologyInsights.RecommendationFindingStatusType recommendationFindingStatus = default(Azure.Health.Insights.RadiologyInsights.RecommendationFindingStatusType), System.Collections.Generic.IEnumerable extension = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.ResearchStudyArm ResearchStudyArm(string name = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept type = null, string description = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.ResearchStudyObjective ResearchStudyObjective(string name = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept type = null) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentInference ScoringAndAssessmentInference(System.Collections.Generic.IEnumerable extension = null, Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType category = default(Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType), string categoryDescription = null, string singleValue = null, Azure.Health.Insights.RadiologyInsights.AssessmentValueRange rangeValue = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.SexMismatchInference SexMismatchInference(System.Collections.Generic.IEnumerable extension = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept sexIndication = null) { throw null; } } public partial class ImagingProcedure : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel @@ -968,6 +1030,21 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static bool operator !=(Azure.Health.Insights.RadiologyInsights.PatientSex left, Azure.Health.Insights.RadiologyInsights.PatientSex right) { throw null; } public override string ToString() { throw null; } } + public partial class PresentGuidanceInformation : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal PresentGuidanceInformation() { } + public System.Collections.Generic.IReadOnlyList Extension { get { throw null; } } + public Azure.Health.Insights.RadiologyInsights.FhirR4Quantity MaximumDiameterAsInText { get { throw null; } } + public string PresentGuidanceItem { get { throw null; } } + public System.Collections.Generic.IReadOnlyList PresentGuidanceValues { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Sizes { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.PresentGuidanceInformation System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.PresentGuidanceInformation System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public abstract partial class ProcedureRecommendation : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { protected ProcedureRecommendation() { } @@ -979,6 +1056,89 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct QualityMeasureComplianceType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public QualityMeasureComplianceType(string value) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType DenominatorException { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType NotEligible { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType PerformanceMet { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType PerformanceNotMet { get { throw null; } } + public bool Equals(Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType left, Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType right) { throw null; } + public static implicit operator Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType (string value) { throw null; } + public static bool operator !=(Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType left, Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class QualityMeasureInference : Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInference, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal QualityMeasureInference() { } + public Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType ComplianceType { get { throw null; } } + public System.Collections.Generic.IReadOnlyList QualityCriteria { get { throw null; } } + public string QualityMeasureDenominator { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.QualityMeasureInference System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.QualityMeasureInference System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class QualityMeasureOptions : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public QualityMeasureOptions(System.Collections.Generic.IEnumerable measureTypes) { } + public System.Collections.Generic.IList MeasureTypes { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.QualityMeasureOptions System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.QualityMeasureOptions System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct QualityMeasureType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public QualityMeasureType(string value) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Acrad36 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Acrad37 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Acrad38 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Acrad39 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Acrad40 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Acrad41 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Acrad42 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mednax55 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips145 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips147 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips195 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips360 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips364 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips405 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips406 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips436 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips76 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Msn13 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Msn15 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Qmm17 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Qmm18 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Qmm19 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Qmm26 { get { throw null; } } + public bool Equals(Azure.Health.Insights.RadiologyInsights.QualityMeasureType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Health.Insights.RadiologyInsights.QualityMeasureType left, Azure.Health.Insights.RadiologyInsights.QualityMeasureType right) { throw null; } + public static implicit operator Azure.Health.Insights.RadiologyInsights.QualityMeasureType (string value) { throw null; } + public static bool operator !=(Azure.Health.Insights.RadiologyInsights.QualityMeasureType left, Azure.Health.Insights.RadiologyInsights.QualityMeasureType right) { throw null; } + public override string ToString() { throw null; } + } public partial class RadiologyCodeWithTypes : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal RadiologyCodeWithTypes() { } @@ -1006,10 +1166,11 @@ public RadiologyInsightsClient(System.Uri endpoint, Azure.Core.TokenCredential c } public partial class RadiologyInsightsClientOptions : Azure.Core.ClientOptions { - public RadiologyInsightsClientOptions(Azure.Health.Insights.RadiologyInsights.RadiologyInsightsClientOptions.ServiceVersion version = Azure.Health.Insights.RadiologyInsights.RadiologyInsightsClientOptions.ServiceVersion.V2024_04_01) { } + public RadiologyInsightsClientOptions(Azure.Health.Insights.RadiologyInsights.RadiologyInsightsClientOptions.ServiceVersion version = Azure.Health.Insights.RadiologyInsights.RadiologyInsightsClientOptions.ServiceVersion.V2024_10_01) { } public enum ServiceVersion { V2024_04_01 = 1, + V2024_10_01 = 2, } } public partial class RadiologyInsightsData : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel @@ -1040,6 +1201,8 @@ public partial class RadiologyInsightsInferenceOptions : System.ClientModel.Prim public RadiologyInsightsInferenceOptions() { } public Azure.Health.Insights.RadiologyInsights.FindingOptions FindingOptions { get { throw null; } set { } } public Azure.Health.Insights.RadiologyInsights.FollowupRecommendationOptions FollowupRecommendationOptions { get { throw null; } set { } } + public Azure.Health.Insights.RadiologyInsights.GuidanceOptions GuidanceOptions { get { throw null; } set { } } + public Azure.Health.Insights.RadiologyInsights.QualityMeasureOptions QualityMeasureOptions { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceOptions System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -1071,9 +1234,12 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType Finding { get { throw null; } } public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType FollowupCommunication { get { throw null; } } public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType FollowupRecommendation { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType Guidance { get { throw null; } } public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType LateralityDiscrepancy { get { throw null; } } public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType LimitedOrderDiscrepancy { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType QualityMeasure { get { throw null; } } public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType RadiologyProcedure { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType ScoringAndAssessment { get { throw null; } } public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType SexMismatch { get { throw null; } } public bool Equals(Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] @@ -1229,6 +1395,70 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static bool operator !=(Azure.Health.Insights.RadiologyInsights.ResearchStudyStatusCodeType left, Azure.Health.Insights.RadiologyInsights.ResearchStudyStatusCodeType right) { throw null; } public override string ToString() { throw null; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ScoringAndAssessmentCategoryType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ScoringAndAssessmentCategoryType(string value) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType AGATSTONSCORE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType ALBERTASTROKEPROGRAMEARLYCTSCORE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType ASCVDRISK { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType BIRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType CADRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType CALCIUMMASSSCORE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType CALCIUMSCOREUNSPECIFIED { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType CALCIUMVOLUMESCORE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType CEUSLIRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType CRADSCOLONICFINDINGS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType CRADSEXTRACOLONICFINDINGS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType FRAXSCORE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType HNPCCMUTATIONRISK { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType KELLGRENLAWRENCEGRADINGSCALE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType LIFETIMEBREASTCANCERRISK { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType LIRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType LUNGRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType MODIFIEDGAILMODELRISK { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType NIRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType ORADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType ORADSMRI { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType PIRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType RISKOFMALIGNANCYINDEX { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType TENYEARCHDRISK { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType TENYEARCHDRISKARTERIALAGE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType TENYEARCHDRISKOBSERVEDAGE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType TIRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType TONNISCLASSIFICATION { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType TREATMENTRESPONSELIRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType TSCORE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType TYRERCUSICKMODELRISK { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType USLIRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType USLIRADSVISUALIZATIONSCORE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType ZSCORE { get { throw null; } } + public bool Equals(Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType left, Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType right) { throw null; } + public static implicit operator Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType (string value) { throw null; } + public static bool operator !=(Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType left, Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ScoringAndAssessmentInference : Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInference, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ScoringAndAssessmentInference() { } + public Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType Category { get { throw null; } } + public string CategoryDescription { get { throw null; } } + public Azure.Health.Insights.RadiologyInsights.AssessmentValueRange RangeValue { get { throw null; } } + public string SingleValue { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentInference System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentInference System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class SexMismatchInference : Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInference, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal SexMismatchInference() { } diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/AssessmentValueRange.Serialization.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/AssessmentValueRange.Serialization.cs new file mode 100644 index 000000000000..cf34bcf7c257 --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/AssessmentValueRange.Serialization.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Health.Insights.RadiologyInsights +{ + public partial class AssessmentValueRange : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AssessmentValueRange)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("minimum"u8); + writer.WriteStringValue(Minimum); + writer.WritePropertyName("maximum"u8); + writer.WriteStringValue(Maximum); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AssessmentValueRange IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AssessmentValueRange)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAssessmentValueRange(document.RootElement, options); + } + + internal static AssessmentValueRange DeserializeAssessmentValueRange(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string minimum = default; + string maximum = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("minimum"u8)) + { + minimum = property.Value.GetString(); + continue; + } + if (property.NameEquals("maximum"u8)) + { + maximum = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AssessmentValueRange(minimum, maximum, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AssessmentValueRange)} does not support writing '{options.Format}' format."); + } + } + + AssessmentValueRange IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAssessmentValueRange(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AssessmentValueRange)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AssessmentValueRange FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAssessmentValueRange(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/AssessmentValueRange.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/AssessmentValueRange.cs new file mode 100644 index 000000000000..063bcc9817d6 --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/AssessmentValueRange.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Health.Insights.RadiologyInsights +{ + /// A range of values. + public partial class AssessmentValueRange + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The minimum value. + /// The maximum value. + /// or is null. + internal AssessmentValueRange(string minimum, string maximum) + { + Argument.AssertNotNull(minimum, nameof(minimum)); + Argument.AssertNotNull(maximum, nameof(maximum)); + + Minimum = minimum; + Maximum = maximum; + } + + /// Initializes a new instance of . + /// The minimum value. + /// The maximum value. + /// Keeps track of any properties unknown to the library. + internal AssessmentValueRange(string minimum, string maximum, IDictionary serializedAdditionalRawData) + { + Minimum = minimum; + Maximum = maximum; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AssessmentValueRange() + { + } + + /// The minimum value. + public string Minimum { get; } + /// The maximum value. + public string Maximum { get; } + } +} diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/Docs/RadiologyInsightsClient.xml b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/Docs/RadiologyInsightsClient.xml index 4be4584e5545..61146c283619 100644 --- a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/Docs/RadiologyInsightsClient.xml +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/Docs/RadiologyInsightsClient.xml @@ -179,6 +179,8 @@ RadiologyInsightsJob resource = new RadiologyInsightsJob { ProvideFocusedSentenceEvidence = true, }, + GuidanceOptions = new GuidanceOptions(true), + QualityMeasureOptions = new QualityMeasureOptions(new QualityMeasureType[] { QualityMeasureType.Mips76 }), }, Locale = "", }, @@ -366,6 +368,8 @@ RadiologyInsightsJob resource = new RadiologyInsightsJob { ProvideFocusedSentenceEvidence = true, }, + GuidanceOptions = new GuidanceOptions(true), + QualityMeasureOptions = new QualityMeasureOptions(new QualityMeasureType[] { QualityMeasureType.Mips76 }), }, Locale = "", }, @@ -627,6 +631,17 @@ using RequestContent content = RequestContent.Create(new { provideFocusedSentenceEvidence = true, }, + guidanceOptions = new + { + showGuidanceInHistory = true, + }, + qualityMeasureOptions = new + { + measureTypes = new object[] + { + "mips76" + }, + }, }, locale = "", }, @@ -2006,6 +2021,17 @@ using RequestContent content = RequestContent.Create(new { provideFocusedSentenceEvidence = true, }, + guidanceOptions = new + { + showGuidanceInHistory = true, + }, + qualityMeasureOptions = new + { + measureTypes = new object[] + { + "mips76" + }, + }, }, locale = "", }, diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/FhirR4Extension.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/FhirR4Extension.cs index 7a3d74a4c3ba..7af73b34d0c1 100644 --- a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/FhirR4Extension.cs +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/FhirR4Extension.cs @@ -12,7 +12,7 @@ namespace Azure.Health.Insights.RadiologyInsights { /// /// Base for all elements - /// Based on [FHIR Element](https://www.hl7.org/fhir/datatypes.html#Element) + /// Based on [FHIR Element](https://www.hl7.org/fhir/R4/element.html) /// public partial class FhirR4Extension : FhirR4Element { diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/GuidanceInference.Serialization.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/GuidanceInference.Serialization.cs new file mode 100644 index 000000000000..39a121896785 --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/GuidanceInference.Serialization.cs @@ -0,0 +1,249 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Health.Insights.RadiologyInsights +{ + public partial class GuidanceInference : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GuidanceInference)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("finding"u8); + writer.WriteObjectValue(Finding, options); + writer.WritePropertyName("identifier"u8); + writer.WriteObjectValue(Identifier, options); + if (Optional.IsCollectionDefined(PresentGuidanceInformation)) + { + writer.WritePropertyName("presentGuidanceInformation"u8); + writer.WriteStartArray(); + foreach (var item in PresentGuidanceInformation) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("ranking"u8); + writer.WriteStringValue(Ranking.ToString()); + if (Optional.IsCollectionDefined(RecommendationProposals)) + { + writer.WritePropertyName("recommendationProposals"u8); + writer.WriteStartArray(); + foreach (var item in RecommendationProposals) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(MissingGuidanceInformation)) + { + writer.WritePropertyName("missingGuidanceInformation"u8); + writer.WriteStartArray(); + foreach (var item in MissingGuidanceInformation) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + } + + GuidanceInference IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GuidanceInference)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGuidanceInference(document.RootElement, options); + } + + internal static GuidanceInference DeserializeGuidanceInference(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + FindingInference finding = default; + FhirR4CodeableConcept identifier = default; + IReadOnlyList presentGuidanceInformation = default; + GuidanceRankingType ranking = default; + IReadOnlyList recommendationProposals = default; + IReadOnlyList missingGuidanceInformation = default; + RadiologyInsightsInferenceType kind = default; + IReadOnlyList extension = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("finding"u8)) + { + finding = FindingInference.DeserializeFindingInference(property.Value, options); + continue; + } + if (property.NameEquals("identifier"u8)) + { + identifier = FhirR4CodeableConcept.DeserializeFhirR4CodeableConcept(property.Value, options); + continue; + } + if (property.NameEquals("presentGuidanceInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(RadiologyInsights.PresentGuidanceInformation.DeserializePresentGuidanceInformation(item, options)); + } + presentGuidanceInformation = array; + continue; + } + if (property.NameEquals("ranking"u8)) + { + ranking = new GuidanceRankingType(property.Value.GetString()); + continue; + } + if (property.NameEquals("recommendationProposals"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(FollowupRecommendationInference.DeserializeFollowupRecommendationInference(item, options)); + } + recommendationProposals = array; + continue; + } + if (property.NameEquals("missingGuidanceInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + missingGuidanceInformation = array; + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new RadiologyInsightsInferenceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("extension"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(FhirR4Extension.DeserializeFhirR4Extension(item, options)); + } + extension = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GuidanceInference( + kind, + extension ?? new ChangeTrackingList(), + serializedAdditionalRawData, + finding, + identifier, + presentGuidanceInformation ?? new ChangeTrackingList(), + ranking, + recommendationProposals ?? new ChangeTrackingList(), + missingGuidanceInformation ?? new ChangeTrackingList()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(GuidanceInference)} does not support writing '{options.Format}' format."); + } + } + + GuidanceInference IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeGuidanceInference(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GuidanceInference)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new GuidanceInference FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeGuidanceInference(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/GuidanceInference.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/GuidanceInference.cs new file mode 100644 index 000000000000..dd651a4ed90c --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/GuidanceInference.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Health.Insights.RadiologyInsights +{ + /// A guidance inference collects structured information about a specific finding in the report and can possibly propose appropriate follow-up recommendations, based upon established, evidence-based best practices i.e. ACR guidelines. + public partial class GuidanceInference : RadiologyInsightsInference + { + /// Initializes a new instance of . + /// The finding associated with the guidance. + /// The guidance identifier, as a concept. + /// See doc of GuidanceRankingType. + /// or is null. + internal GuidanceInference(FindingInference finding, FhirR4CodeableConcept identifier, GuidanceRankingType ranking) + { + Argument.AssertNotNull(finding, nameof(finding)); + Argument.AssertNotNull(identifier, nameof(identifier)); + + Kind = RadiologyInsightsInferenceType.Guidance; + Finding = finding; + Identifier = identifier; + PresentGuidanceInformation = new ChangeTrackingList(); + Ranking = ranking; + RecommendationProposals = new ChangeTrackingList(); + MissingGuidanceInformation = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Discriminator property for RadiologyInsightsInference. + /// Additional Content defined by implementations. + /// Keeps track of any properties unknown to the library. + /// The finding associated with the guidance. + /// The guidance identifier, as a concept. + /// presentGuidanceInformation lists each item of the structured information (e.g. laterality) and corresponding details (left, right, bilateral) that is present in the document. + /// See doc of GuidanceRankingType. + /// The proposed follow-up recommendations, if any. If this is filled, missingGuidanceInformation cannot be filled (and vice versa). + /// Contains all missing items that are needed to determine follow-up. + internal GuidanceInference(RadiologyInsightsInferenceType kind, IReadOnlyList extension, IDictionary serializedAdditionalRawData, FindingInference finding, FhirR4CodeableConcept identifier, IReadOnlyList presentGuidanceInformation, GuidanceRankingType ranking, IReadOnlyList recommendationProposals, IReadOnlyList missingGuidanceInformation) : base(kind, extension, serializedAdditionalRawData) + { + Finding = finding; + Identifier = identifier; + PresentGuidanceInformation = presentGuidanceInformation; + Ranking = ranking; + RecommendationProposals = recommendationProposals; + MissingGuidanceInformation = missingGuidanceInformation; + } + + /// Initializes a new instance of for deserialization. + internal GuidanceInference() + { + } + + /// The finding associated with the guidance. + public FindingInference Finding { get; } + /// The guidance identifier, as a concept. + public FhirR4CodeableConcept Identifier { get; } + /// presentGuidanceInformation lists each item of the structured information (e.g. laterality) and corresponding details (left, right, bilateral) that is present in the document. + public IReadOnlyList PresentGuidanceInformation { get; } + /// See doc of GuidanceRankingType. + public GuidanceRankingType Ranking { get; } + /// The proposed follow-up recommendations, if any. If this is filled, missingGuidanceInformation cannot be filled (and vice versa). + public IReadOnlyList RecommendationProposals { get; } + /// Contains all missing items that are needed to determine follow-up. + public IReadOnlyList MissingGuidanceInformation { get; } + } +} diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/GuidanceOptions.Serialization.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/GuidanceOptions.Serialization.cs new file mode 100644 index 000000000000..956bfebe544b --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/GuidanceOptions.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Health.Insights.RadiologyInsights +{ + public partial class GuidanceOptions : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GuidanceOptions)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("showGuidanceInHistory"u8); + writer.WriteBooleanValue(ShowGuidanceInHistory); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + GuidanceOptions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GuidanceOptions)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGuidanceOptions(document.RootElement, options); + } + + internal static GuidanceOptions DeserializeGuidanceOptions(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool showGuidanceInHistory = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("showGuidanceInHistory"u8)) + { + showGuidanceInHistory = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GuidanceOptions(showGuidanceInHistory, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(GuidanceOptions)} does not support writing '{options.Format}' format."); + } + } + + GuidanceOptions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeGuidanceOptions(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GuidanceOptions)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static GuidanceOptions FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeGuidanceOptions(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/GuidanceOptions.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/GuidanceOptions.cs new file mode 100644 index 000000000000..899f088e6855 --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/GuidanceOptions.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Health.Insights.RadiologyInsights +{ + /// Guidance options. + public partial class GuidanceOptions + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// If this is true, also show guidances from a clinical history section i.e. if the first token of the associated finding's clinical indicator is in this section. Default is false. + public GuidanceOptions(bool showGuidanceInHistory) + { + ShowGuidanceInHistory = showGuidanceInHistory; + } + + /// Initializes a new instance of . + /// If this is true, also show guidances from a clinical history section i.e. if the first token of the associated finding's clinical indicator is in this section. Default is false. + /// Keeps track of any properties unknown to the library. + internal GuidanceOptions(bool showGuidanceInHistory, IDictionary serializedAdditionalRawData) + { + ShowGuidanceInHistory = showGuidanceInHistory; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GuidanceOptions() + { + } + + /// If this is true, also show guidances from a clinical history section i.e. if the first token of the associated finding's clinical indicator is in this section. Default is false. + public bool ShowGuidanceInHistory { get; set; } + } +} diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/GuidanceRankingType.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/GuidanceRankingType.cs new file mode 100644 index 000000000000..de2636e79e9f --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/GuidanceRankingType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Health.Insights.RadiologyInsights +{ + /// Refers to how important a clinical guidance is. + public readonly partial struct GuidanceRankingType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public GuidanceRankingType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string HighValue = "high"; + private const string LowValue = "low"; + + /// high. + public static GuidanceRankingType High { get; } = new GuidanceRankingType(HighValue); + /// low. + public static GuidanceRankingType Low { get; } = new GuidanceRankingType(LowValue); + /// Determines if two values are the same. + public static bool operator ==(GuidanceRankingType left, GuidanceRankingType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(GuidanceRankingType left, GuidanceRankingType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator GuidanceRankingType(string value) => new GuidanceRankingType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is GuidanceRankingType other && Equals(other); + /// + public bool Equals(GuidanceRankingType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/HealthInsightsRadiologyInsightsModelFactory.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/HealthInsightsRadiologyInsightsModelFactory.cs index c897a39a10c7..64a30a36065c 100644 --- a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/HealthInsightsRadiologyInsightsModelFactory.cs +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/HealthInsightsRadiologyInsightsModelFactory.cs @@ -54,7 +54,7 @@ public static RadiologyInsightsInferenceResult RadiologyInsightsInferenceResult( /// /// The model's inferences for the given patient. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , , , , and . + /// The available derived classes include , , , , , , , , , , , and . /// /// A new instance for mocking. public static RadiologyInsightsPatientResult RadiologyInsightsPatientResult(string patientId = null, IEnumerable inferences = null) @@ -798,5 +798,105 @@ public static FollowupCommunicationInference FollowupCommunicationInference(IEnu recipient?.ToList(), wasAcknowledged); } + + /// Initializes a new instance of . + /// Additional Content defined by implementations. + /// Category, e.g. BIRADS. + /// The expansion of the category (which is an abbreviation.). + /// The value. If the value is a range, use field valueRange. + /// The range. + /// A new instance for mocking. + public static ScoringAndAssessmentInference ScoringAndAssessmentInference(IEnumerable extension = null, ScoringAndAssessmentCategoryType category = default, string categoryDescription = null, string singleValue = null, AssessmentValueRange rangeValue = null) + { + extension ??= new List(); + + return new ScoringAndAssessmentInference( + RadiologyInsightsInferenceType.ScoringAndAssessment, + extension?.ToList(), + serializedAdditionalRawData: null, + category, + categoryDescription, + singleValue, + rangeValue); + } + + /// Initializes a new instance of . + /// The minimum value. + /// The maximum value. + /// A new instance for mocking. + public static AssessmentValueRange AssessmentValueRange(string minimum = null, string maximum = null) + { + return new AssessmentValueRange(minimum, maximum, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Additional Content defined by implementations. + /// The finding associated with the guidance. + /// The guidance identifier, as a concept. + /// presentGuidanceInformation lists each item of the structured information (e.g. laterality) and corresponding details (left, right, bilateral) that is present in the document. + /// See doc of GuidanceRankingType. + /// The proposed follow-up recommendations, if any. If this is filled, missingGuidanceInformation cannot be filled (and vice versa). + /// Contains all missing items that are needed to determine follow-up. + /// A new instance for mocking. + public static GuidanceInference GuidanceInference(IEnumerable extension = null, FindingInference finding = null, FhirR4CodeableConcept identifier = null, IEnumerable presentGuidanceInformation = null, GuidanceRankingType ranking = default, IEnumerable recommendationProposals = null, IEnumerable missingGuidanceInformation = null) + { + extension ??= new List(); + presentGuidanceInformation ??= new List(); + recommendationProposals ??= new List(); + missingGuidanceInformation ??= new List(); + + return new GuidanceInference( + RadiologyInsightsInferenceType.Guidance, + extension?.ToList(), + serializedAdditionalRawData: null, + finding, + identifier, + presentGuidanceInformation?.ToList(), + ranking, + recommendationProposals?.ToList(), + missingGuidanceInformation?.ToList()); + } + + /// Initializes a new instance of . + /// The item of the structured information. + /// A list of size values, if the item is about size. + /// The maximum diameter value, if the item is about the maximum diameter. + /// The list of item values that are mentioned in the report. + /// Additional Content defined by implementations. + /// A new instance for mocking. + public static PresentGuidanceInformation PresentGuidanceInformation(string presentGuidanceItem = null, IEnumerable sizes = null, FhirR4Quantity maximumDiameterAsInText = null, IEnumerable presentGuidanceValues = null, IEnumerable extension = null) + { + sizes ??= new List(); + presentGuidanceValues ??= new List(); + extension ??= new List(); + + return new PresentGuidanceInformation( + presentGuidanceItem, + sizes?.ToList(), + maximumDiameterAsInText, + presentGuidanceValues?.ToList(), + extension?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Additional Content defined by implementations. + /// The denominator, which identifies the QualityMeasure kind. + /// The ComplianceType indicates whether the document is compliant for the specified QualityMeasure or not, or if exceptions apply. + /// List of quality criteria identified in the document, if any. + /// A new instance for mocking. + public static QualityMeasureInference QualityMeasureInference(IEnumerable extension = null, string qualityMeasureDenominator = null, QualityMeasureComplianceType complianceType = default, IEnumerable qualityCriteria = null) + { + extension ??= new List(); + qualityCriteria ??= new List(); + + return new QualityMeasureInference( + RadiologyInsightsInferenceType.QualityMeasure, + extension?.ToList(), + serializedAdditionalRawData: null, + qualityMeasureDenominator, + complianceType, + qualityCriteria?.ToList()); + } } } diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/PresentGuidanceInformation.Serialization.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/PresentGuidanceInformation.Serialization.cs new file mode 100644 index 000000000000..7e306c77006d --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/PresentGuidanceInformation.Serialization.cs @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Health.Insights.RadiologyInsights +{ + public partial class PresentGuidanceInformation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PresentGuidanceInformation)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("presentGuidanceItem"u8); + writer.WriteStringValue(PresentGuidanceItem); + if (Optional.IsCollectionDefined(Sizes)) + { + writer.WritePropertyName("sizes"u8); + writer.WriteStartArray(); + foreach (var item in Sizes) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(MaximumDiameterAsInText)) + { + writer.WritePropertyName("maximumDiameterAsInText"u8); + writer.WriteObjectValue(MaximumDiameterAsInText, options); + } + if (Optional.IsCollectionDefined(PresentGuidanceValues)) + { + writer.WritePropertyName("presentGuidanceValues"u8); + writer.WriteStartArray(); + foreach (var item in PresentGuidanceValues) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Extension)) + { + writer.WritePropertyName("extension"u8); + writer.WriteStartArray(); + foreach (var item in Extension) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + PresentGuidanceInformation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PresentGuidanceInformation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePresentGuidanceInformation(document.RootElement, options); + } + + internal static PresentGuidanceInformation DeserializePresentGuidanceInformation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string presentGuidanceItem = default; + IReadOnlyList sizes = default; + FhirR4Quantity maximumDiameterAsInText = default; + IReadOnlyList presentGuidanceValues = default; + IReadOnlyList extension = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("presentGuidanceItem"u8)) + { + presentGuidanceItem = property.Value.GetString(); + continue; + } + if (property.NameEquals("sizes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(FhirR4Observation.DeserializeFhirR4Observation(item, options)); + } + sizes = array; + continue; + } + if (property.NameEquals("maximumDiameterAsInText"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maximumDiameterAsInText = FhirR4Quantity.DeserializeFhirR4Quantity(property.Value, options); + continue; + } + if (property.NameEquals("presentGuidanceValues"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + presentGuidanceValues = array; + continue; + } + if (property.NameEquals("extension"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(FhirR4Extension.DeserializeFhirR4Extension(item, options)); + } + extension = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PresentGuidanceInformation( + presentGuidanceItem, + sizes ?? new ChangeTrackingList(), + maximumDiameterAsInText, + presentGuidanceValues ?? new ChangeTrackingList(), + extension ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PresentGuidanceInformation)} does not support writing '{options.Format}' format."); + } + } + + PresentGuidanceInformation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializePresentGuidanceInformation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PresentGuidanceInformation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static PresentGuidanceInformation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializePresentGuidanceInformation(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/PresentGuidanceInformation.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/PresentGuidanceInformation.cs new file mode 100644 index 000000000000..e46aa4622b04 --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/PresentGuidanceInformation.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Health.Insights.RadiologyInsights +{ + /// An item of the structured information (e.g. laterality or size) and one or more corresponding details (e.g. left or size-value). + public partial class PresentGuidanceInformation + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The item of the structured information. + /// is null. + internal PresentGuidanceInformation(string presentGuidanceItem) + { + Argument.AssertNotNull(presentGuidanceItem, nameof(presentGuidanceItem)); + + PresentGuidanceItem = presentGuidanceItem; + Sizes = new ChangeTrackingList(); + PresentGuidanceValues = new ChangeTrackingList(); + Extension = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The item of the structured information. + /// A list of size values, if the item is about size. + /// The maximum diameter value, if the item is about the maximum diameter. + /// The list of item values that are mentioned in the report. + /// Additional Content defined by implementations. + /// Keeps track of any properties unknown to the library. + internal PresentGuidanceInformation(string presentGuidanceItem, IReadOnlyList sizes, FhirR4Quantity maximumDiameterAsInText, IReadOnlyList presentGuidanceValues, IReadOnlyList extension, IDictionary serializedAdditionalRawData) + { + PresentGuidanceItem = presentGuidanceItem; + Sizes = sizes; + MaximumDiameterAsInText = maximumDiameterAsInText; + PresentGuidanceValues = presentGuidanceValues; + Extension = extension; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PresentGuidanceInformation() + { + } + + /// The item of the structured information. + public string PresentGuidanceItem { get; } + /// A list of size values, if the item is about size. + public IReadOnlyList Sizes { get; } + /// The maximum diameter value, if the item is about the maximum diameter. + public FhirR4Quantity MaximumDiameterAsInText { get; } + /// The list of item values that are mentioned in the report. + public IReadOnlyList PresentGuidanceValues { get; } + /// Additional Content defined by implementations. + public IReadOnlyList Extension { get; } + } +} diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureComplianceType.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureComplianceType.cs new file mode 100644 index 000000000000..c0f35e14e333 --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureComplianceType.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Health.Insights.RadiologyInsights +{ + /// Whether the document is compliant. + public readonly partial struct QualityMeasureComplianceType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public QualityMeasureComplianceType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NotEligibleValue = "notEligible"; + private const string PerformanceNotMetValue = "performanceNotMet"; + private const string PerformanceMetValue = "performanceMet"; + private const string DenominatorExceptionValue = "denominatorException"; + + /// not eligible. + public static QualityMeasureComplianceType NotEligible { get; } = new QualityMeasureComplianceType(NotEligibleValue); + /// performance not met. + public static QualityMeasureComplianceType PerformanceNotMet { get; } = new QualityMeasureComplianceType(PerformanceNotMetValue); + /// performance met. + public static QualityMeasureComplianceType PerformanceMet { get; } = new QualityMeasureComplianceType(PerformanceMetValue); + /// denominator exception. + public static QualityMeasureComplianceType DenominatorException { get; } = new QualityMeasureComplianceType(DenominatorExceptionValue); + /// Determines if two values are the same. + public static bool operator ==(QualityMeasureComplianceType left, QualityMeasureComplianceType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(QualityMeasureComplianceType left, QualityMeasureComplianceType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator QualityMeasureComplianceType(string value) => new QualityMeasureComplianceType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is QualityMeasureComplianceType other && Equals(other); + /// + public bool Equals(QualityMeasureComplianceType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureInference.Serialization.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureInference.Serialization.cs new file mode 100644 index 000000000000..ed78f85e367f --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureInference.Serialization.cs @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Health.Insights.RadiologyInsights +{ + public partial class QualityMeasureInference : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(QualityMeasureInference)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("qualityMeasureDenominator"u8); + writer.WriteStringValue(QualityMeasureDenominator); + writer.WritePropertyName("complianceType"u8); + writer.WriteStringValue(ComplianceType.ToString()); + if (Optional.IsCollectionDefined(QualityCriteria)) + { + writer.WritePropertyName("qualityCriteria"u8); + writer.WriteStartArray(); + foreach (var item in QualityCriteria) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + } + + QualityMeasureInference IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(QualityMeasureInference)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeQualityMeasureInference(document.RootElement, options); + } + + internal static QualityMeasureInference DeserializeQualityMeasureInference(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string qualityMeasureDenominator = default; + QualityMeasureComplianceType complianceType = default; + IReadOnlyList qualityCriteria = default; + RadiologyInsightsInferenceType kind = default; + IReadOnlyList extension = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("qualityMeasureDenominator"u8)) + { + qualityMeasureDenominator = property.Value.GetString(); + continue; + } + if (property.NameEquals("complianceType"u8)) + { + complianceType = new QualityMeasureComplianceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("qualityCriteria"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + qualityCriteria = array; + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new RadiologyInsightsInferenceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("extension"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(FhirR4Extension.DeserializeFhirR4Extension(item, options)); + } + extension = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new QualityMeasureInference( + kind, + extension ?? new ChangeTrackingList(), + serializedAdditionalRawData, + qualityMeasureDenominator, + complianceType, + qualityCriteria ?? new ChangeTrackingList()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(QualityMeasureInference)} does not support writing '{options.Format}' format."); + } + } + + QualityMeasureInference IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeQualityMeasureInference(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(QualityMeasureInference)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new QualityMeasureInference FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeQualityMeasureInference(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureInference.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureInference.cs new file mode 100644 index 000000000000..c441f9784322 --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureInference.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Health.Insights.RadiologyInsights +{ + /// A QualityMeasure inference captures the MIPS ('measure based incentive payment system') quality measure criteria in the document that are used to measure the data completeness. + public partial class QualityMeasureInference : RadiologyInsightsInference + { + /// Initializes a new instance of . + /// The denominator, which identifies the QualityMeasure kind. + /// The ComplianceType indicates whether the document is compliant for the specified QualityMeasure or not, or if exceptions apply. + /// is null. + internal QualityMeasureInference(string qualityMeasureDenominator, QualityMeasureComplianceType complianceType) + { + Argument.AssertNotNull(qualityMeasureDenominator, nameof(qualityMeasureDenominator)); + + Kind = RadiologyInsightsInferenceType.QualityMeasure; + QualityMeasureDenominator = qualityMeasureDenominator; + ComplianceType = complianceType; + QualityCriteria = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Discriminator property for RadiologyInsightsInference. + /// Additional Content defined by implementations. + /// Keeps track of any properties unknown to the library. + /// The denominator, which identifies the QualityMeasure kind. + /// The ComplianceType indicates whether the document is compliant for the specified QualityMeasure or not, or if exceptions apply. + /// List of quality criteria identified in the document, if any. + internal QualityMeasureInference(RadiologyInsightsInferenceType kind, IReadOnlyList extension, IDictionary serializedAdditionalRawData, string qualityMeasureDenominator, QualityMeasureComplianceType complianceType, IReadOnlyList qualityCriteria) : base(kind, extension, serializedAdditionalRawData) + { + QualityMeasureDenominator = qualityMeasureDenominator; + ComplianceType = complianceType; + QualityCriteria = qualityCriteria; + } + + /// Initializes a new instance of for deserialization. + internal QualityMeasureInference() + { + } + + /// The denominator, which identifies the QualityMeasure kind. + public string QualityMeasureDenominator { get; } + /// The ComplianceType indicates whether the document is compliant for the specified QualityMeasure or not, or if exceptions apply. + public QualityMeasureComplianceType ComplianceType { get; } + /// List of quality criteria identified in the document, if any. + public IReadOnlyList QualityCriteria { get; } + } +} diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureOptions.Serialization.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureOptions.Serialization.cs new file mode 100644 index 000000000000..8e85e3a63406 --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureOptions.Serialization.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Health.Insights.RadiologyInsights +{ + public partial class QualityMeasureOptions : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(QualityMeasureOptions)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("measureTypes"u8); + writer.WriteStartArray(); + foreach (var item in MeasureTypes) + { + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + QualityMeasureOptions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(QualityMeasureOptions)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeQualityMeasureOptions(document.RootElement, options); + } + + internal static QualityMeasureOptions DeserializeQualityMeasureOptions(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList measureTypes = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("measureTypes"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new QualityMeasureType(item.GetString())); + } + measureTypes = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new QualityMeasureOptions(measureTypes, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(QualityMeasureOptions)} does not support writing '{options.Format}' format."); + } + } + + QualityMeasureOptions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeQualityMeasureOptions(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(QualityMeasureOptions)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static QualityMeasureOptions FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeQualityMeasureOptions(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureOptions.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureOptions.cs new file mode 100644 index 000000000000..052a7235b800 --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureOptions.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.Health.Insights.RadiologyInsights +{ + /// Quality Measure Options. + public partial class QualityMeasureOptions + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Id(s) of the MIPS measures that need to be evaluated in the document. + /// is null. + public QualityMeasureOptions(IEnumerable measureTypes) + { + Argument.AssertNotNull(measureTypes, nameof(measureTypes)); + + MeasureTypes = measureTypes.ToList(); + } + + /// Initializes a new instance of . + /// Id(s) of the MIPS measures that need to be evaluated in the document. + /// Keeps track of any properties unknown to the library. + internal QualityMeasureOptions(IList measureTypes, IDictionary serializedAdditionalRawData) + { + MeasureTypes = measureTypes; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal QualityMeasureOptions() + { + } + + /// Id(s) of the MIPS measures that need to be evaluated in the document. + public IList MeasureTypes { get; } + } +} diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureType.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureType.cs new file mode 100644 index 000000000000..b2b8f703fa2f --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureType.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Health.Insights.RadiologyInsights +{ + /// Mips types that can be checked by the engine. + public readonly partial struct QualityMeasureType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public QualityMeasureType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string Mips76Value = "mips76"; + private const string Mips147Value = "mips147"; + private const string Mips195Value = "mips195"; + private const string Mips360Value = "mips360"; + private const string Mips364Value = "mips364"; + private const string Mips405Value = "mips405"; + private const string Mips406Value = "mips406"; + private const string Mips436Value = "mips436"; + private const string Mips145Value = "mips145"; + private const string Acrad36Value = "acrad36"; + private const string Acrad37Value = "acrad37"; + private const string Acrad38Value = "acrad38"; + private const string Acrad39Value = "acrad39"; + private const string Acrad40Value = "acrad40"; + private const string Acrad41Value = "acrad41"; + private const string Acrad42Value = "acrad42"; + private const string Mednax55Value = "mednax55"; + private const string Msn13Value = "msn13"; + private const string Msn15Value = "msn15"; + private const string Qmm26Value = "qmm26"; + private const string Qmm17Value = "qmm17"; + private const string Qmm18Value = "qmm18"; + private const string Qmm19Value = "qmm19"; + + /// Mips 76. + public static QualityMeasureType Mips76 { get; } = new QualityMeasureType(Mips76Value); + /// Mips 147. + public static QualityMeasureType Mips147 { get; } = new QualityMeasureType(Mips147Value); + /// Mips 195. + public static QualityMeasureType Mips195 { get; } = new QualityMeasureType(Mips195Value); + /// Mips 360. + public static QualityMeasureType Mips360 { get; } = new QualityMeasureType(Mips360Value); + /// Mips 364. + public static QualityMeasureType Mips364 { get; } = new QualityMeasureType(Mips364Value); + /// Mips 405. + public static QualityMeasureType Mips405 { get; } = new QualityMeasureType(Mips405Value); + /// Mips 406. + public static QualityMeasureType Mips406 { get; } = new QualityMeasureType(Mips406Value); + /// Mips 436. + public static QualityMeasureType Mips436 { get; } = new QualityMeasureType(Mips436Value); + /// Mips 145. + public static QualityMeasureType Mips145 { get; } = new QualityMeasureType(Mips145Value); + /// Acrad 36. + public static QualityMeasureType Acrad36 { get; } = new QualityMeasureType(Acrad36Value); + /// Acrad 37. + public static QualityMeasureType Acrad37 { get; } = new QualityMeasureType(Acrad37Value); + /// Acrad 38. + public static QualityMeasureType Acrad38 { get; } = new QualityMeasureType(Acrad38Value); + /// Acrad 39. + public static QualityMeasureType Acrad39 { get; } = new QualityMeasureType(Acrad39Value); + /// Acrad 40. + public static QualityMeasureType Acrad40 { get; } = new QualityMeasureType(Acrad40Value); + /// Acrad 41. + public static QualityMeasureType Acrad41 { get; } = new QualityMeasureType(Acrad41Value); + /// Acrad 42. + public static QualityMeasureType Acrad42 { get; } = new QualityMeasureType(Acrad42Value); + /// Mednax55. + public static QualityMeasureType Mednax55 { get; } = new QualityMeasureType(Mednax55Value); + /// Msn13. + public static QualityMeasureType Msn13 { get; } = new QualityMeasureType(Msn13Value); + /// Msn15. + public static QualityMeasureType Msn15 { get; } = new QualityMeasureType(Msn15Value); + /// Qmm26. + public static QualityMeasureType Qmm26 { get; } = new QualityMeasureType(Qmm26Value); + /// Qmm17. + public static QualityMeasureType Qmm17 { get; } = new QualityMeasureType(Qmm17Value); + /// Qmm18. + public static QualityMeasureType Qmm18 { get; } = new QualityMeasureType(Qmm18Value); + /// Qmm19. + public static QualityMeasureType Qmm19 { get; } = new QualityMeasureType(Qmm19Value); + /// Determines if two values are the same. + public static bool operator ==(QualityMeasureType left, QualityMeasureType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(QualityMeasureType left, QualityMeasureType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator QualityMeasureType(string value) => new QualityMeasureType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is QualityMeasureType other && Equals(other); + /// + public bool Equals(QualityMeasureType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsClientOptions.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsClientOptions.cs index c32d7850c9dc..5d7e5a8d4ce5 100644 --- a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsClientOptions.cs +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsClientOptions.cs @@ -13,13 +13,15 @@ namespace Azure.Health.Insights.RadiologyInsights /// Client options for RadiologyInsightsClient. public partial class RadiologyInsightsClientOptions : ClientOptions { - private const ServiceVersion LatestVersion = ServiceVersion.V2024_04_01; + private const ServiceVersion LatestVersion = ServiceVersion.V2024_10_01; /// The version of the service to use. public enum ServiceVersion { /// Service version "2024-04-01". V2024_04_01 = 1, + /// Service version "2024-10-01". + V2024_10_01 = 2, } internal string Version { get; } @@ -30,6 +32,7 @@ public RadiologyInsightsClientOptions(ServiceVersion version = LatestVersion) Version = version switch { ServiceVersion.V2024_04_01 => "2024-04-01", + ServiceVersion.V2024_10_01 => "2024-10-01", _ => throw new NotSupportedException() }; } diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInference.Serialization.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInference.Serialization.cs index 1640fff3e1bd..9ff8cf51f955 100644 --- a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInference.Serialization.cs +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInference.Serialization.cs @@ -93,9 +93,12 @@ internal static RadiologyInsightsInference DeserializeRadiologyInsightsInference case "finding": return FindingInference.DeserializeFindingInference(element, options); case "followupCommunication": return FollowupCommunicationInference.DeserializeFollowupCommunicationInference(element, options); case "followupRecommendation": return FollowupRecommendationInference.DeserializeFollowupRecommendationInference(element, options); + case "guidance": return GuidanceInference.DeserializeGuidanceInference(element, options); case "lateralityDiscrepancy": return LateralityDiscrepancyInference.DeserializeLateralityDiscrepancyInference(element, options); case "limitedOrderDiscrepancy": return LimitedOrderDiscrepancyInference.DeserializeLimitedOrderDiscrepancyInference(element, options); + case "qualityMeasure": return QualityMeasureInference.DeserializeQualityMeasureInference(element, options); case "radiologyProcedure": return RadiologyProcedureInference.DeserializeRadiologyProcedureInference(element, options); + case "scoringAndAssessment": return ScoringAndAssessmentInference.DeserializeScoringAndAssessmentInference(element, options); case "sexMismatch": return SexMismatchInference.DeserializeSexMismatchInference(element, options); } } diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInference.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInference.cs index 802adb427731..19ff43760195 100644 --- a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInference.cs +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInference.cs @@ -23,7 +23,7 @@ namespace Azure.Health.Insights.RadiologyInsights /// - RadiologyProcedure /// - FollowupCommunication /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , , , , and . + /// The available derived classes include , , , , , , , , , , , and . /// public abstract partial class RadiologyInsightsInference { diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInferenceOptions.Serialization.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInferenceOptions.Serialization.cs index abb233d3d4d8..dc9277b21032 100644 --- a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInferenceOptions.Serialization.cs +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInferenceOptions.Serialization.cs @@ -44,6 +44,16 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("findingOptions"u8); writer.WriteObjectValue(FindingOptions, options); } + if (Optional.IsDefined(GuidanceOptions)) + { + writer.WritePropertyName("guidanceOptions"u8); + writer.WriteObjectValue(GuidanceOptions, options); + } + if (Optional.IsDefined(QualityMeasureOptions)) + { + writer.WritePropertyName("qualityMeasureOptions"u8); + writer.WriteObjectValue(QualityMeasureOptions, options); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -83,6 +93,8 @@ internal static RadiologyInsightsInferenceOptions DeserializeRadiologyInsightsIn } FollowupRecommendationOptions followupRecommendationOptions = default; FindingOptions findingOptions = default; + GuidanceOptions guidanceOptions = default; + QualityMeasureOptions qualityMeasureOptions = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -105,13 +117,31 @@ internal static RadiologyInsightsInferenceOptions DeserializeRadiologyInsightsIn findingOptions = FindingOptions.DeserializeFindingOptions(property.Value, options); continue; } + if (property.NameEquals("guidanceOptions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + guidanceOptions = GuidanceOptions.DeserializeGuidanceOptions(property.Value, options); + continue; + } + if (property.NameEquals("qualityMeasureOptions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + qualityMeasureOptions = QualityMeasureOptions.DeserializeQualityMeasureOptions(property.Value, options); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new RadiologyInsightsInferenceOptions(followupRecommendationOptions, findingOptions, serializedAdditionalRawData); + return new RadiologyInsightsInferenceOptions(followupRecommendationOptions, findingOptions, guidanceOptions, qualityMeasureOptions, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInferenceOptions.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInferenceOptions.cs index 66db2f624256..3fa0c1914664 100644 --- a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInferenceOptions.cs +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInferenceOptions.cs @@ -53,11 +53,15 @@ public RadiologyInsightsInferenceOptions() /// Initializes a new instance of . /// Follow-up recommendation options. /// Finding options. + /// Guidance options. + /// QualityMeasureOptions. /// Keeps track of any properties unknown to the library. - internal RadiologyInsightsInferenceOptions(FollowupRecommendationOptions followupRecommendationOptions, FindingOptions findingOptions, IDictionary serializedAdditionalRawData) + internal RadiologyInsightsInferenceOptions(FollowupRecommendationOptions followupRecommendationOptions, FindingOptions findingOptions, GuidanceOptions guidanceOptions, QualityMeasureOptions qualityMeasureOptions, IDictionary serializedAdditionalRawData) { FollowupRecommendationOptions = followupRecommendationOptions; FindingOptions = findingOptions; + GuidanceOptions = guidanceOptions; + QualityMeasureOptions = qualityMeasureOptions; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -65,5 +69,9 @@ internal RadiologyInsightsInferenceOptions(FollowupRecommendationOptions followu public FollowupRecommendationOptions FollowupRecommendationOptions { get; set; } /// Finding options. public FindingOptions FindingOptions { get; set; } + /// Guidance options. + public GuidanceOptions GuidanceOptions { get; set; } + /// QualityMeasureOptions. + public QualityMeasureOptions QualityMeasureOptions { get; set; } } } diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInferenceType.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInferenceType.cs index e36756668014..f0f23cea906b 100644 --- a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInferenceType.cs +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInferenceType.cs @@ -32,6 +32,9 @@ public RadiologyInsightsInferenceType(string value) private const string FollowupRecommendationValue = "followupRecommendation"; private const string FollowupCommunicationValue = "followupCommunication"; private const string RadiologyProcedureValue = "radiologyProcedure"; + private const string ScoringAndAssessmentValue = "scoringAndAssessment"; + private const string GuidanceValue = "guidance"; + private const string QualityMeasureValue = "qualityMeasure"; /// Age mismatch inference type. public static RadiologyInsightsInferenceType AgeMismatch { get; } = new RadiologyInsightsInferenceType(AgeMismatchValue); @@ -53,6 +56,12 @@ public RadiologyInsightsInferenceType(string value) public static RadiologyInsightsInferenceType FollowupCommunication { get; } = new RadiologyInsightsInferenceType(FollowupCommunicationValue); /// Radiology Procedure inference type. public static RadiologyInsightsInferenceType RadiologyProcedure { get; } = new RadiologyInsightsInferenceType(RadiologyProcedureValue); + /// Scoring and assessment inference type. + public static RadiologyInsightsInferenceType ScoringAndAssessment { get; } = new RadiologyInsightsInferenceType(ScoringAndAssessmentValue); + /// Guidance inference type. + public static RadiologyInsightsInferenceType Guidance { get; } = new RadiologyInsightsInferenceType(GuidanceValue); + /// Guidance measure inference type. + public static RadiologyInsightsInferenceType QualityMeasure { get; } = new RadiologyInsightsInferenceType(QualityMeasureValue); /// Determines if two values are the same. public static bool operator ==(RadiologyInsightsInferenceType left, RadiologyInsightsInferenceType right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsPatientResult.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsPatientResult.cs index aeaff61759a4..97110384a295 100644 --- a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsPatientResult.cs +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsPatientResult.cs @@ -51,7 +51,7 @@ public partial class RadiologyInsightsPatientResult /// /// The model's inferences for the given patient. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , , , , and . + /// The available derived classes include , , , , , , , , , , , and . /// /// or is null. internal RadiologyInsightsPatientResult(string patientId, IEnumerable inferences) @@ -68,7 +68,7 @@ internal RadiologyInsightsPatientResult(string patientId, IEnumerable /// The model's inferences for the given patient. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , , , , and . + /// The available derived classes include , , , , , , , , , , , and . /// /// Keeps track of any properties unknown to the library. internal RadiologyInsightsPatientResult(string patientId, IReadOnlyList inferences, IDictionary serializedAdditionalRawData) @@ -88,7 +88,7 @@ internal RadiologyInsightsPatientResult() /// /// The model's inferences for the given patient. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , , , , and . + /// The available derived classes include , , , , , , , , , , , and . /// public IReadOnlyList Inferences { get; } } diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/ScoringAndAssessmentCategoryType.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/ScoringAndAssessmentCategoryType.cs new file mode 100644 index 000000000000..d28d123e4926 --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/ScoringAndAssessmentCategoryType.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Health.Insights.RadiologyInsights +{ + /// The category that gets a value, e.g. BIRADS, Z-SCORE or FRAX SCORE. + public readonly partial struct ScoringAndAssessmentCategoryType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ScoringAndAssessmentCategoryType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string BIRADSValue = "BIRADS"; + private const string CRADSCOLONICFINDINGSValue = "C-RADS COLONIC FINDINGS"; + private const string CADRADSValue = "CAD-RADS"; + private const string LIRADSValue = "LI-RADS"; + private const string LUNGRADSValue = "LUNG-RADS"; + private const string NIRADSValue = "NI-RADS"; + private const string ORADSValue = "O-RADS"; + private const string PIRADSValue = "PI-RADS"; + private const string TIRADSValue = "TI-RADS"; + private const string CRADSEXTRACOLONICFINDINGSValue = "C-RADS EXTRACOLONIC FINDINGS"; + private const string LIFETIMEBREASTCANCERRISKValue = "LIFETIME BREAST CANCER RISK"; + private const string ASCVDRISKValue = "ASCVD RISK"; + private const string MODIFIEDGAILMODELRISKValue = "MODIFIED GAIL MODEL RISK"; + private const string TYRERCUSICKMODELRISKValue = "TYRER CUSICK MODEL RISK"; + private const string AGATSTONSCOREValue = "AGATSTON SCORE"; + private const string TENYEARCHDRISKValue = "10 YEAR CHD RISK"; + private const string ZSCOREValue = "Z-SCORE"; + private const string TSCOREValue = "T-SCORE"; + private const string CALCIUMVOLUMESCOREValue = "CALCIUM VOLUME SCORE"; + private const string USLIRADSVISUALIZATIONSCOREValue = "US LI-RADS VISUALIZATION SCORE"; + private const string USLIRADSValue = "US LI-RADS"; + private const string CEUSLIRADSValue = "CEUS LI-RADS"; + private const string TREATMENTRESPONSELIRADSValue = "TREATMENT RESPONSE LI-RADS"; + private const string ORADSMRIValue = "O-RADS MRI"; + private const string CALCIUMMASSSCOREValue = "CALCIUM MASS SCORE"; + private const string RISKOFMALIGNANCYINDEXValue = "RISK OF MALIGNANCY INDEX"; + private const string HNPCCMUTATIONRISKValue = "HNPCC MUTATION RISK"; + private const string ALBERTASTROKEPROGRAMEARLYCTSCOREValue = "ALBERTA STROKE PROGRAM EARLY CT SCORE"; + private const string KELLGRENLAWRENCEGRADINGSCALEValue = "KELLGREN-LAWRENCE GRADING SCALE"; + private const string TONNISCLASSIFICATIONValue = "TONNIS CLASSIFICATION"; + private const string CALCIUMSCOREUNSPECIFIEDValue = "CALCIUM SCORE (UNSPECIFIED)"; + private const string TENYEARCHDRISKOBSERVEDAGEValue = "10 YEAR CHD RISK (OBSERVED AGE)"; + private const string TENYEARCHDRISKARTERIALAGEValue = "10 YEAR CHD RISK (ARTERIAL AGE)"; + private const string FRAXSCOREValue = "FRAX SCORE"; + + /// BIRADS. + public static ScoringAndAssessmentCategoryType BIRADS { get; } = new ScoringAndAssessmentCategoryType(BIRADSValue); + /// C-RADS COLONIC FINDINGS. + public static ScoringAndAssessmentCategoryType CRADSCOLONICFINDINGS { get; } = new ScoringAndAssessmentCategoryType(CRADSCOLONICFINDINGSValue); + /// CAD-RADS. + public static ScoringAndAssessmentCategoryType CADRADS { get; } = new ScoringAndAssessmentCategoryType(CADRADSValue); + /// LI-RADS. + public static ScoringAndAssessmentCategoryType LIRADS { get; } = new ScoringAndAssessmentCategoryType(LIRADSValue); + /// LUNG-RADS. + public static ScoringAndAssessmentCategoryType LUNGRADS { get; } = new ScoringAndAssessmentCategoryType(LUNGRADSValue); + /// NI-RADS. + public static ScoringAndAssessmentCategoryType NIRADS { get; } = new ScoringAndAssessmentCategoryType(NIRADSValue); + /// O-RADS. + public static ScoringAndAssessmentCategoryType ORADS { get; } = new ScoringAndAssessmentCategoryType(ORADSValue); + /// PI-RADS. + public static ScoringAndAssessmentCategoryType PIRADS { get; } = new ScoringAndAssessmentCategoryType(PIRADSValue); + /// TI-RADS. + public static ScoringAndAssessmentCategoryType TIRADS { get; } = new ScoringAndAssessmentCategoryType(TIRADSValue); + /// C-RADS EXTRACOLONIC FINDINGS. + public static ScoringAndAssessmentCategoryType CRADSEXTRACOLONICFINDINGS { get; } = new ScoringAndAssessmentCategoryType(CRADSEXTRACOLONICFINDINGSValue); + /// LIFETIME BREAST CANCER RISK. + public static ScoringAndAssessmentCategoryType LIFETIMEBREASTCANCERRISK { get; } = new ScoringAndAssessmentCategoryType(LIFETIMEBREASTCANCERRISKValue); + /// ASCVD RISK. + public static ScoringAndAssessmentCategoryType ASCVDRISK { get; } = new ScoringAndAssessmentCategoryType(ASCVDRISKValue); + /// MODIFIED GAIL MODEL RISK. + public static ScoringAndAssessmentCategoryType MODIFIEDGAILMODELRISK { get; } = new ScoringAndAssessmentCategoryType(MODIFIEDGAILMODELRISKValue); + /// TYRER CUSICK MODEL RISK. + public static ScoringAndAssessmentCategoryType TYRERCUSICKMODELRISK { get; } = new ScoringAndAssessmentCategoryType(TYRERCUSICKMODELRISKValue); + /// AGATSTON SCORE. + public static ScoringAndAssessmentCategoryType AGATSTONSCORE { get; } = new ScoringAndAssessmentCategoryType(AGATSTONSCOREValue); + /// 10 YEAR CHD RISK. + public static ScoringAndAssessmentCategoryType TENYEARCHDRISK { get; } = new ScoringAndAssessmentCategoryType(TENYEARCHDRISKValue); + /// Z-SCORE. + public static ScoringAndAssessmentCategoryType ZSCORE { get; } = new ScoringAndAssessmentCategoryType(ZSCOREValue); + /// T-SCORE. + public static ScoringAndAssessmentCategoryType TSCORE { get; } = new ScoringAndAssessmentCategoryType(TSCOREValue); + /// CALCIUM VOLUME SCORE. + public static ScoringAndAssessmentCategoryType CALCIUMVOLUMESCORE { get; } = new ScoringAndAssessmentCategoryType(CALCIUMVOLUMESCOREValue); + /// US LI-RADS VISUALIZATION SCORE. + public static ScoringAndAssessmentCategoryType USLIRADSVISUALIZATIONSCORE { get; } = new ScoringAndAssessmentCategoryType(USLIRADSVISUALIZATIONSCOREValue); + /// US LI-RADS. + public static ScoringAndAssessmentCategoryType USLIRADS { get; } = new ScoringAndAssessmentCategoryType(USLIRADSValue); + /// CEUS LI-RADS. + public static ScoringAndAssessmentCategoryType CEUSLIRADS { get; } = new ScoringAndAssessmentCategoryType(CEUSLIRADSValue); + /// TREATMENT RESPONSE LI-RADS. + public static ScoringAndAssessmentCategoryType TREATMENTRESPONSELIRADS { get; } = new ScoringAndAssessmentCategoryType(TREATMENTRESPONSELIRADSValue); + /// O-RADS MRI. + public static ScoringAndAssessmentCategoryType ORADSMRI { get; } = new ScoringAndAssessmentCategoryType(ORADSMRIValue); + /// CALCIUM MASS SCORE. + public static ScoringAndAssessmentCategoryType CALCIUMMASSSCORE { get; } = new ScoringAndAssessmentCategoryType(CALCIUMMASSSCOREValue); + /// RISK OF MALIGNANCY INDEX. + public static ScoringAndAssessmentCategoryType RISKOFMALIGNANCYINDEX { get; } = new ScoringAndAssessmentCategoryType(RISKOFMALIGNANCYINDEXValue); + /// HNPCC MUTATION RISK. + public static ScoringAndAssessmentCategoryType HNPCCMUTATIONRISK { get; } = new ScoringAndAssessmentCategoryType(HNPCCMUTATIONRISKValue); + /// ALBERTA STROKE PROGRAM EARLY CT SCORE. + public static ScoringAndAssessmentCategoryType ALBERTASTROKEPROGRAMEARLYCTSCORE { get; } = new ScoringAndAssessmentCategoryType(ALBERTASTROKEPROGRAMEARLYCTSCOREValue); + /// KELLGREN-LAWRENCE GRADING SCALE. + public static ScoringAndAssessmentCategoryType KELLGRENLAWRENCEGRADINGSCALE { get; } = new ScoringAndAssessmentCategoryType(KELLGRENLAWRENCEGRADINGSCALEValue); + /// TONNIS CLASSIFICATION. + public static ScoringAndAssessmentCategoryType TONNISCLASSIFICATION { get; } = new ScoringAndAssessmentCategoryType(TONNISCLASSIFICATIONValue); + /// CALCIUM SCORE (UNSPECIFIED). + public static ScoringAndAssessmentCategoryType CALCIUMSCOREUNSPECIFIED { get; } = new ScoringAndAssessmentCategoryType(CALCIUMSCOREUNSPECIFIEDValue); + /// 10 YEAR CHD RISK (OBSERVED AGE). + public static ScoringAndAssessmentCategoryType TENYEARCHDRISKOBSERVEDAGE { get; } = new ScoringAndAssessmentCategoryType(TENYEARCHDRISKOBSERVEDAGEValue); + /// 10 YEAR CHD RISK (ARTERIAL AGE). + public static ScoringAndAssessmentCategoryType TENYEARCHDRISKARTERIALAGE { get; } = new ScoringAndAssessmentCategoryType(TENYEARCHDRISKARTERIALAGEValue); + /// FRAX SCORE. + public static ScoringAndAssessmentCategoryType FRAXSCORE { get; } = new ScoringAndAssessmentCategoryType(FRAXSCOREValue); + /// Determines if two values are the same. + public static bool operator ==(ScoringAndAssessmentCategoryType left, ScoringAndAssessmentCategoryType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ScoringAndAssessmentCategoryType left, ScoringAndAssessmentCategoryType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ScoringAndAssessmentCategoryType(string value) => new ScoringAndAssessmentCategoryType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ScoringAndAssessmentCategoryType other && Equals(other); + /// + public bool Equals(ScoringAndAssessmentCategoryType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/ScoringAndAssessmentInference.Serialization.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/ScoringAndAssessmentInference.Serialization.cs new file mode 100644 index 000000000000..d79f2b5f144e --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/ScoringAndAssessmentInference.Serialization.cs @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Health.Insights.RadiologyInsights +{ + public partial class ScoringAndAssessmentInference : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ScoringAndAssessmentInference)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("category"u8); + writer.WriteStringValue(Category.ToString()); + writer.WritePropertyName("categoryDescription"u8); + writer.WriteStringValue(CategoryDescription); + if (Optional.IsDefined(SingleValue)) + { + writer.WritePropertyName("singleValue"u8); + writer.WriteStringValue(SingleValue); + } + if (Optional.IsDefined(RangeValue)) + { + writer.WritePropertyName("rangeValue"u8); + writer.WriteObjectValue(RangeValue, options); + } + } + + ScoringAndAssessmentInference IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ScoringAndAssessmentInference)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeScoringAndAssessmentInference(document.RootElement, options); + } + + internal static ScoringAndAssessmentInference DeserializeScoringAndAssessmentInference(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ScoringAndAssessmentCategoryType category = default; + string categoryDescription = default; + string singleValue = default; + AssessmentValueRange rangeValue = default; + RadiologyInsightsInferenceType kind = default; + IReadOnlyList extension = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("category"u8)) + { + category = new ScoringAndAssessmentCategoryType(property.Value.GetString()); + continue; + } + if (property.NameEquals("categoryDescription"u8)) + { + categoryDescription = property.Value.GetString(); + continue; + } + if (property.NameEquals("singleValue"u8)) + { + singleValue = property.Value.GetString(); + continue; + } + if (property.NameEquals("rangeValue"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rangeValue = AssessmentValueRange.DeserializeAssessmentValueRange(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new RadiologyInsightsInferenceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("extension"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(FhirR4Extension.DeserializeFhirR4Extension(item, options)); + } + extension = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ScoringAndAssessmentInference( + kind, + extension ?? new ChangeTrackingList(), + serializedAdditionalRawData, + category, + categoryDescription, + singleValue, + rangeValue); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ScoringAndAssessmentInference)} does not support writing '{options.Format}' format."); + } + } + + ScoringAndAssessmentInference IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeScoringAndAssessmentInference(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ScoringAndAssessmentInference)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new ScoringAndAssessmentInference FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeScoringAndAssessmentInference(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/ScoringAndAssessmentInference.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/ScoringAndAssessmentInference.cs new file mode 100644 index 000000000000..0377bb19445d --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/ScoringAndAssessmentInference.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Health.Insights.RadiologyInsights +{ + /// Identifies and highlights Risk, Scoring, Assessment and Classifications and correspondent values dictated in a report, e.g. 'BIRADS 5'. + public partial class ScoringAndAssessmentInference : RadiologyInsightsInference + { + /// Initializes a new instance of . + /// Category, e.g. BIRADS. + /// The expansion of the category (which is an abbreviation.). + /// is null. + internal ScoringAndAssessmentInference(ScoringAndAssessmentCategoryType category, string categoryDescription) + { + Argument.AssertNotNull(categoryDescription, nameof(categoryDescription)); + + Kind = RadiologyInsightsInferenceType.ScoringAndAssessment; + Category = category; + CategoryDescription = categoryDescription; + } + + /// Initializes a new instance of . + /// Discriminator property for RadiologyInsightsInference. + /// Additional Content defined by implementations. + /// Keeps track of any properties unknown to the library. + /// Category, e.g. BIRADS. + /// The expansion of the category (which is an abbreviation.). + /// The value. If the value is a range, use field valueRange. + /// The range. + internal ScoringAndAssessmentInference(RadiologyInsightsInferenceType kind, IReadOnlyList extension, IDictionary serializedAdditionalRawData, ScoringAndAssessmentCategoryType category, string categoryDescription, string singleValue, AssessmentValueRange rangeValue) : base(kind, extension, serializedAdditionalRawData) + { + Category = category; + CategoryDescription = categoryDescription; + SingleValue = singleValue; + RangeValue = rangeValue; + } + + /// Initializes a new instance of for deserialization. + internal ScoringAndAssessmentInference() + { + } + + /// Category, e.g. BIRADS. + public ScoringAndAssessmentCategoryType Category { get; } + /// The expansion of the category (which is an abbreviation.). + public string CategoryDescription { get; } + /// The value. If the value is a range, use field valueRange. + public string SingleValue { get; } + /// The range. + public AssessmentValueRange RangeValue { get; } + } +} diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/tests/Generated/Samples/Samples_RadiologyInsightsClient.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/tests/Generated/Samples/Samples_RadiologyInsightsClient.cs index e6c4122d9333..9b6af0230319 100644 --- a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/tests/Generated/Samples/Samples_RadiologyInsightsClient.cs +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/tests/Generated/Samples/Samples_RadiologyInsightsClient.cs @@ -316,6 +316,17 @@ public void Example_RadiologyInsightsJob_InferRadiologyInsights_AllParameters() { provideFocusedSentenceEvidence = true, }, + guidanceOptions = new + { + showGuidanceInHistory = true, + }, + qualityMeasureOptions = new + { + measureTypes = new object[] + { +"mips76" + }, + }, }, locale = "", }, @@ -1680,6 +1691,17 @@ public async Task Example_RadiologyInsightsJob_InferRadiologyInsights_AllParamet { provideFocusedSentenceEvidence = true, }, + guidanceOptions = new + { + showGuidanceInHistory = true, + }, + qualityMeasureOptions = new + { + measureTypes = new object[] + { +"mips76" + }, + }, }, locale = "", }, @@ -2975,6 +2997,8 @@ public void Example_RadiologyInsightsJob_InferRadiologyInsights_AllParameters_Co { ProvideFocusedSentenceEvidence = true, }, + GuidanceOptions = new GuidanceOptions(true), + QualityMeasureOptions = new QualityMeasureOptions(new QualityMeasureType[] { QualityMeasureType.Mips76 }), }, Locale = "", }, @@ -3152,6 +3176,8 @@ public async Task Example_RadiologyInsightsJob_InferRadiologyInsights_AllParamet { ProvideFocusedSentenceEvidence = true, }, + GuidanceOptions = new GuidanceOptions(true), + QualityMeasureOptions = new QualityMeasureOptions(new QualityMeasureType[] { QualityMeasureType.Mips76 }), }, Locale = "", }, diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/tsp-location.yaml b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/tsp-location.yaml index f37e9e56b97d..00dc558e8e55 100644 --- a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/tsp-location.yaml +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/tsp-location.yaml @@ -1,7 +1,6 @@ directory: specification/ai/HealthInsights/HealthInsights.RadiologyInsights -additionalDirectories: - - specification/ai/HealthInsights/HealthInsights.OpenAPI - - specification/ai/HealthInsights/HealthInsights.Common -commit: 1f1dcb6199544dd127964e91bd10118ecc21d7a8 +commit: 54b1384a56710dd114569774b5f90a6b5778bd31 repo: Azure/azure-rest-api-specs -cleanup: false +additionalDirectories: +- specification/ai/HealthInsights/HealthInsights.Common +- specification/ai/HealthInsights/HealthInsights.OpenAPI diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/Configuration.json b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/Configuration.json new file mode 100644 index 000000000000..60096438592a --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/Configuration.json @@ -0,0 +1,13 @@ +{ + "output-folder": ".", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "library-name": "Azure.ResourceManager.HybridConnectivity", + "flavor": "azure", + "use-model-reader-writer": true, + "shared-source-folders": [ + "../../TempTypeSpecFiles/node_modules/@autorest/csharp/Generator.Shared", + "../../TempTypeSpecFiles/node_modules/@autorest/csharp/Azure.Core.Shared" + ], + "examples-dir": "TempTypeSpecFiles/HybridConnectivity.Management/examples", + "azure-arm": true +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/autorest.md b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/autorest.md deleted file mode 100644 index 87d7241b2795..000000000000 --- a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/autorest.md +++ /dev/null @@ -1,91 +0,0 @@ -# Generated code configuration - -Run `dotnet build /t:GenerateCode` to generate code. - -``` yaml - -azure-arm: true -csharp: true -library-name: HybridConnectivity -namespace: Azure.ResourceManager.HybridConnectivity -# default tag is a preview version -require: https://github.com/Azure/azure-rest-api-specs/blob/5f869da70574588b5af7c46a20de802cb8edc093/specification/hybridconnectivity/resource-manager/readme.md -#tag: package-2023-03 -output-folder: $(this-folder)/Generated -clear-output-folder: true -sample-gen: - output-folder: $(this-folder)/../samples/Generated - clear-output-folder: true -skip-csproj: true -modelerfour: - flatten-payloads: false -use-model-reader-writer: true - -#mgmt-debug: -# show-serialized-names: true - -format-by-name-rules: - 'tenantId': 'uuid' - 'etag': 'etag' - 'location': 'azure-location' - '*Uri': 'Uri' - '*Uris': 'Uri' - -acronym-mapping: - CPU: Cpu - CPUs: Cpus - Os: OS - Ip: IP - Ips: IPs|ips - ID: Id - IDs: Ids - VM: Vm - VMs: Vms - Vmos: VmOS - VMScaleSet: VmScaleSet - DNS: Dns - VPN: Vpn - NAT: Nat - WAN: Wan - Ipv4: IPv4|ipv4 - Ipv6: IPv6|ipv6 - Ipsec: IPsec|ipsec - SSO: Sso - URI: Uri - Etag: ETag|etag - -prepend-rp-prefix: - # - CloudNativeType - - EndpointProperties - # - HostType - # - InventoryProperties - - ProvisioningState - # - ResourceProvisioningState - - ServiceName - # - SolutionConfiguration - # - PublicCloudConnector - # - OperationStatusResult - # - SolutionTypeProperties - -rename-mapping: - EndpointResource: HybridConnectivityEndpoint - # InventoryResource: HybridConnectivityInventory - ServiceConfigurationResource: HybridConnectivityServiceConfiguration - # SolutionTypeResource: HybridConnectivitySolutionType - IngressGatewayResource: IngressGatewayAsset - ManagedProxyResource: ManagedProxyAsset - IngressGatewayResource.ingress.aadProfile.serverId: -|uuid - # PublicCloudConnectorProperties.connectorPrimaryIdentifier: -|uuid - EndpointProperties.resourceId: -|arm-id - # InventoryProperties.azureResourceId: -|arm-id - ServiceConfigurationResource.properties.resourceId: -|arm-id - # GenerateAwsTemplateRequest.connectorId: -|arm-id - EndpointAccessResource: TargetResourceEndpointAccess - -directive: - - from: swagger-document - where: $.definitions.EndpointProperties.properties.type - transform: > - $["x-ms-enum"]["name"] = "HybridConnectivityEndpointType" - -``` diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/tsp-location.yaml b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/tsp-location.yaml new file mode 100644 index 000000000000..2f5c4a322fb8 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/hybridconnectivity/HybridConnectivity.Management +commit: 54b1384a56710dd114569774b5f90a6b5778bd31 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/tspCodeModel.json b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/tspCodeModel.json new file mode 100644 index 000000000000..41cad11a3a37 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/tspCodeModel.json @@ -0,0 +1,19280 @@ +{ + "$id": "1", + "name": "Microsoft.HybridConnectivity", + "apiVersions": [ + "2024-12-01" + ], + "enums": [ + { + "$id": "2", + "kind": "enum", + "name": "createdByType", + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.createdByType", + "valueType": { + "$id": "3", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "4", + "kind": "enumvalue", + "name": "User", + "value": "User", + "valueType": { + "$id": "5", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "2" + }, + "doc": "The entity was created by a user.", + "decorators": [] + }, + { + "$id": "6", + "kind": "enumvalue", + "name": "Application", + "value": "Application", + "valueType": { + "$id": "7", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "2" + }, + "doc": "The entity was created by an application.", + "decorators": [] + }, + { + "$id": "8", + "kind": "enumvalue", + "name": "ManagedIdentity", + "value": "ManagedIdentity", + "valueType": { + "$id": "9", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "2" + }, + "doc": "The entity was created by a managed identity.", + "decorators": [] + }, + { + "$id": "10", + "kind": "enumvalue", + "name": "Key", + "value": "Key", + "valueType": { + "$id": "11", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "2" + }, + "doc": "The entity was created by a key.", + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.HybridConnectivity", + "doc": "The kind of entity that created the resource.", + "isFixed": false, + "isFlags": false, + "usage": "Output,Json,LroInitial,LroFinalEnvelope", + "decorators": [] + }, + { + "$id": "12", + "kind": "enum", + "name": "CloudNativeType", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.CloudNativeType", + "valueType": { + "$id": "13", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "14", + "kind": "enumvalue", + "name": "ec2", + "value": "ec2", + "valueType": { + "$id": "15", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "12" + }, + "doc": "ec2 enum.", + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.HybridConnectivity", + "doc": "Cloud Native Type enum.", + "isFixed": false, + "isFlags": false, + "usage": "Output,Json", + "decorators": [] + }, + { + "$id": "16", + "kind": "enum", + "name": "SolutionConfigurationStatus", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionConfigurationStatus", + "valueType": { + "$id": "17", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "18", + "kind": "enumvalue", + "name": "New", + "value": "New", + "valueType": { + "$id": "19", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "16" + }, + "doc": "New status", + "decorators": [] + }, + { + "$id": "20", + "kind": "enumvalue", + "name": "InProgress", + "value": "InProgress", + "valueType": { + "$id": "21", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "16" + }, + "doc": "InProgress status", + "decorators": [] + }, + { + "$id": "22", + "kind": "enumvalue", + "name": "Completed", + "value": "Completed", + "valueType": { + "$id": "23", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "16" + }, + "doc": "Canceled status", + "decorators": [] + }, + { + "$id": "24", + "kind": "enumvalue", + "name": "Failed", + "value": "Failed", + "valueType": { + "$id": "25", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "16" + }, + "doc": "Failed status", + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.HybridConnectivity", + "doc": "Solution Configuration Status.", + "isFixed": false, + "isFlags": false, + "usage": "Output,Json", + "decorators": [] + }, + { + "$id": "26", + "kind": "enum", + "name": "ResourceProvisioningState", + "crossLanguageDefinitionId": "Azure.ResourceManager.ResourceProvisioningState", + "valueType": { + "$id": "27", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "28", + "kind": "enumvalue", + "name": "Succeeded", + "value": "Succeeded", + "valueType": { + "$id": "29", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "26" + }, + "doc": "Resource has been created.", + "decorators": [] + }, + { + "$id": "30", + "kind": "enumvalue", + "name": "Failed", + "value": "Failed", + "valueType": { + "$id": "31", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "26" + }, + "doc": "Resource creation failed.", + "decorators": [] + }, + { + "$id": "32", + "kind": "enumvalue", + "name": "Canceled", + "value": "Canceled", + "valueType": { + "$id": "33", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "26" + }, + "doc": "Resource creation was canceled.", + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.HybridConnectivity", + "doc": "The provisioning state of a resource type.", + "isFixed": false, + "isFlags": false, + "usage": "Output,Json,LroInitial,LroPolling,LroFinalEnvelope", + "decorators": [] + }, + { + "$id": "34", + "kind": "enum", + "name": "HostType", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.HostType", + "valueType": { + "$id": "35", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "36", + "kind": "enumvalue", + "name": "AWS", + "value": "AWS", + "valueType": { + "$id": "37", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "34" + }, + "doc": "AWS state", + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.HybridConnectivity", + "doc": "Enum of host cloud the public cloud connector is referencing.", + "isFixed": false, + "isFlags": false, + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "decorators": [] + }, + { + "$id": "38", + "kind": "enum", + "name": "HybridConnectivityServiceName", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.ServiceName", + "valueType": { + "$id": "39", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "40", + "kind": "enumvalue", + "name": "SSH", + "value": "SSH", + "valueType": { + "$id": "41", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "38" + }, + "decorators": [] + }, + { + "$id": "42", + "kind": "enumvalue", + "name": "WAC", + "value": "WAC", + "valueType": { + "$id": "43", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "38" + }, + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.HybridConnectivity", + "doc": "Name of the service.", + "isFixed": false, + "isFlags": false, + "usage": "Input,Output,Json", + "decorators": [] + }, + { + "$id": "44", + "kind": "enum", + "name": "HybridConnectivityProvisioningState", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.ProvisioningState", + "valueType": { + "$id": "45", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "46", + "kind": "enumvalue", + "name": "Succeeded", + "value": "Succeeded", + "valueType": { + "$id": "47", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "44" + }, + "decorators": [] + }, + { + "$id": "48", + "kind": "enumvalue", + "name": "Creating", + "value": "Creating", + "valueType": { + "$id": "49", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "44" + }, + "decorators": [] + }, + { + "$id": "50", + "kind": "enumvalue", + "name": "Updating", + "value": "Updating", + "valueType": { + "$id": "51", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "44" + }, + "decorators": [] + }, + { + "$id": "52", + "kind": "enumvalue", + "name": "Failed", + "value": "Failed", + "valueType": { + "$id": "53", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "44" + }, + "decorators": [] + }, + { + "$id": "54", + "kind": "enumvalue", + "name": "Canceled", + "value": "Canceled", + "valueType": { + "$id": "55", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "44" + }, + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.HybridConnectivity", + "doc": "The resource provisioning state.", + "isFixed": false, + "isFlags": false, + "usage": "Output,Json", + "decorators": [] + }, + { + "$id": "56", + "kind": "enum", + "name": "HybridConnectivityEndpointType", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.Type", + "valueType": { + "$id": "57", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "58", + "kind": "enumvalue", + "name": "default", + "value": "default", + "valueType": { + "$id": "59", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "56" + }, + "decorators": [] + }, + { + "$id": "60", + "kind": "enumvalue", + "name": "custom", + "value": "custom", + "valueType": { + "$id": "61", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "56" + }, + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.HybridConnectivity", + "doc": "The type of endpoint.", + "isFixed": false, + "isFlags": false, + "usage": "Input,Output,Json", + "decorators": [] + }, + { + "$id": "62", + "kind": "enum", + "name": "Origin", + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.Origin", + "valueType": { + "$id": "63", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "64", + "kind": "enumvalue", + "name": "user", + "value": "user", + "valueType": { + "$id": "65", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "62" + }, + "doc": "Indicates the operation is initiated by a user.", + "decorators": [] + }, + { + "$id": "66", + "kind": "enumvalue", + "name": "system", + "value": "system", + "valueType": { + "$id": "67", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "62" + }, + "doc": "Indicates the operation is initiated by a system.", + "decorators": [] + }, + { + "$id": "68", + "kind": "enumvalue", + "name": "user,system", + "value": "user,system", + "valueType": { + "$id": "69", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "62" + }, + "doc": "Indicates the operation is initiated by a user or system.", + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.HybridConnectivity", + "doc": "The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is \"user,system\"", + "isFixed": false, + "isFlags": false, + "usage": "Output,Json", + "decorators": [] + }, + { + "$id": "70", + "kind": "enum", + "name": "ActionType", + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.ActionType", + "valueType": { + "$id": "71", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "72", + "kind": "enumvalue", + "name": "Internal", + "value": "Internal", + "valueType": { + "$id": "73", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "70" + }, + "doc": "Actions are for internal-only APIs.", + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.HybridConnectivity", + "doc": "Extensible enum. Indicates the action type. \"Internal\" refers to actions that are for internal only APIs.", + "isFixed": false, + "isFlags": false, + "usage": "Output,Json", + "decorators": [] + }, + { + "$id": "74", + "kind": "enum", + "name": "Versions", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.Versions", + "valueType": { + "$id": "75", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "76", + "kind": "enumvalue", + "name": "v2024_12_01", + "value": "2024-12-01", + "valueType": { + "$id": "77", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "74" + }, + "doc": "Version 2024-12-01", + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.HybridConnectivity", + "doc": "Hybrid Connectivity Management service version.", + "isFixed": true, + "isFlags": false, + "usage": "ApiVersionEnum", + "decorators": [] + } + ], + "models": [ + { + "$id": "78", + "kind": "model", + "name": "SolutionTypeResource", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionTypeResource", + "usage": "Output,Json", + "doc": "Concrete proxy resource types can be created by aliasing this type using a specific property type.", + "decorators": [], + "baseModel": { + "$id": "79", + "kind": "model", + "name": "ProxyResource", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.ProxyResource", + "usage": "Input,Output,Json", + "doc": "The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location", + "decorators": [], + "baseModel": { + "$id": "80", + "kind": "model", + "name": "Resource", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.Resource", + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "doc": "Common fields that are returned in the response for all Azure Resource Manager resources", + "decorators": [], + "properties": [ + { + "$id": "81", + "kind": "property", + "name": "id", + "serializedName": "id", + "doc": "Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}", + "type": { + "$id": "82", + "kind": "string", + "name": "armResourceIdentifier", + "crossLanguageDefinitionId": "Azure.Core.armResourceIdentifier", + "baseType": { + "$id": "83", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.Resource.id", + "serializationOptions": { + "$id": "84", + "json": { + "$id": "85", + "name": "id" + } + } + }, + { + "$id": "86", + "kind": "property", + "name": "name", + "serializedName": "name", + "doc": "The name of the resource", + "type": { + "$id": "87", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.Resource.name", + "serializationOptions": { + "$id": "88", + "json": { + "$id": "89", + "name": "name" + } + } + }, + { + "$id": "90", + "kind": "property", + "name": "type", + "serializedName": "type", + "doc": "The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or \"Microsoft.Storage/storageAccounts\"", + "type": { + "$id": "91", + "kind": "string", + "name": "armResourceType", + "crossLanguageDefinitionId": "Azure.Core.armResourceType", + "baseType": { + "$id": "92", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.Resource.type", + "serializationOptions": { + "$id": "93", + "json": { + "$id": "94", + "name": "type" + } + } + }, + { + "$id": "95", + "kind": "property", + "name": "systemData", + "serializedName": "systemData", + "doc": "Azure Resource Manager metadata containing createdBy and modifiedBy information.", + "type": { + "$id": "96", + "kind": "model", + "name": "SystemData", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.SystemData", + "usage": "Output,Json,LroInitial,LroFinalEnvelope", + "doc": "Metadata pertaining to creation and last modification of the resource.", + "decorators": [], + "properties": [ + { + "$id": "97", + "kind": "property", + "name": "createdBy", + "serializedName": "createdBy", + "doc": "The identity that created the resource.", + "type": { + "$id": "98", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.SystemData.createdBy", + "serializationOptions": { + "$id": "99", + "json": { + "$id": "100", + "name": "createdBy" + } + } + }, + { + "$id": "101", + "kind": "property", + "name": "createdByType", + "serializedName": "createdByType", + "doc": "The type of identity that created the resource.", + "type": { + "$ref": "2" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.SystemData.createdByType", + "serializationOptions": { + "$id": "102", + "json": { + "$id": "103", + "name": "createdByType" + } + } + }, + { + "$id": "104", + "kind": "property", + "name": "createdAt", + "serializedName": "createdAt", + "doc": "The timestamp of resource creation (UTC).", + "type": { + "$id": "105", + "kind": "utcDateTime", + "name": "utcDateTime", + "encode": "rfc3339", + "wireType": { + "$id": "106", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.utcDateTime", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.SystemData.createdAt", + "serializationOptions": { + "$id": "107", + "json": { + "$id": "108", + "name": "createdAt" + } + } + }, + { + "$id": "109", + "kind": "property", + "name": "lastModifiedBy", + "serializedName": "lastModifiedBy", + "doc": "The identity that last modified the resource.", + "type": { + "$id": "110", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.SystemData.lastModifiedBy", + "serializationOptions": { + "$id": "111", + "json": { + "$id": "112", + "name": "lastModifiedBy" + } + } + }, + { + "$id": "113", + "kind": "property", + "name": "lastModifiedByType", + "serializedName": "lastModifiedByType", + "doc": "The type of identity that last modified the resource.", + "type": { + "$ref": "2" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.SystemData.lastModifiedByType", + "serializationOptions": { + "$id": "114", + "json": { + "$id": "115", + "name": "lastModifiedByType" + } + } + }, + { + "$id": "116", + "kind": "property", + "name": "lastModifiedAt", + "serializedName": "lastModifiedAt", + "doc": "The timestamp of resource last modification (UTC)", + "type": { + "$id": "117", + "kind": "utcDateTime", + "name": "utcDateTime", + "encode": "rfc3339", + "wireType": { + "$id": "118", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.utcDateTime", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.SystemData.lastModifiedAt", + "serializationOptions": { + "$id": "119", + "json": { + "$id": "120", + "name": "lastModifiedAt" + } + } + } + ] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.Resource.systemData", + "serializationOptions": { + "$id": "121", + "json": { + "$id": "122", + "name": "systemData" + } + } + } + ] + }, + "properties": [] + }, + "properties": [ + { + "$id": "123", + "kind": "property", + "name": "properties", + "serializedName": "properties", + "doc": "The resource-specific properties for this resource.", + "type": { + "$id": "124", + "kind": "model", + "name": "SolutionTypeProperties", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionTypeProperties", + "usage": "Output,Json", + "doc": "Definition of Solution type resource.", + "decorators": [], + "properties": [ + { + "$id": "125", + "kind": "property", + "name": "solutionType", + "serializedName": "solutionType", + "doc": "The name of the solution type.", + "type": { + "$id": "126", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionTypeProperties.solutionType", + "serializationOptions": { + "$id": "127", + "json": { + "$id": "128", + "name": "solutionType" + } + } + }, + { + "$id": "129", + "kind": "property", + "name": "description", + "serializedName": "description", + "doc": "Short description of solution type.", + "type": { + "$id": "130", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionTypeProperties.description", + "serializationOptions": { + "$id": "131", + "json": { + "$id": "132", + "name": "description" + } + } + }, + { + "$id": "133", + "kind": "property", + "name": "supportedAzureRegions", + "serializedName": "supportedAzureRegions", + "doc": "The locations this solution is supported in.", + "type": { + "$id": "134", + "kind": "array", + "name": "Array", + "valueType": { + "$id": "135", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionTypeProperties.supportedAzureRegions", + "serializationOptions": { + "$id": "136", + "json": { + "$id": "137", + "name": "supportedAzureRegions" + } + } + }, + { + "$id": "138", + "kind": "property", + "name": "solutionSettings", + "serializedName": "solutionSettings", + "doc": "Array of solution settings and its description.", + "type": { + "$id": "139", + "kind": "array", + "name": "ArraySolutionTypeSettingsProperties", + "valueType": { + "$id": "140", + "kind": "model", + "name": "SolutionTypeSettingsProperties", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionTypeSettingsProperties", + "usage": "Output,Json", + "doc": "Represent Solution settings properties description array.", + "decorators": [], + "properties": [ + { + "$id": "141", + "kind": "property", + "name": "name", + "serializedName": "name", + "doc": "The name of the solution setting property.", + "type": { + "$id": "142", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionTypeSettingsProperties.name", + "serializationOptions": { + "$id": "143", + "json": { + "$id": "144", + "name": "name" + } + } + }, + { + "$id": "145", + "kind": "property", + "name": "displayName", + "serializedName": "displayName", + "doc": "The UI friendly name of the solution setting property.", + "type": { + "$id": "146", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionTypeSettingsProperties.displayName", + "serializationOptions": { + "$id": "147", + "json": { + "$id": "148", + "name": "displayName" + } + } + }, + { + "$id": "149", + "kind": "property", + "name": "type", + "serializedName": "type", + "doc": "Type of the solution setting property, represented as a string.", + "type": { + "$id": "150", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionTypeSettingsProperties.type", + "serializationOptions": { + "$id": "151", + "json": { + "$id": "152", + "name": "type" + } + } + }, + { + "$id": "153", + "kind": "property", + "name": "description", + "serializedName": "description", + "doc": "Description of solution setting property.", + "type": { + "$id": "154", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionTypeSettingsProperties.description", + "serializationOptions": { + "$id": "155", + "json": { + "$id": "156", + "name": "description" + } + } + }, + { + "$id": "157", + "kind": "property", + "name": "allowedValues", + "serializedName": "allowedValues", + "doc": "Array of allowed values for this solution settings property.", + "type": { + "$id": "158", + "kind": "array", + "name": "Array", + "valueType": { + "$id": "159", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionTypeSettingsProperties.allowedValues", + "serializationOptions": { + "$id": "160", + "json": { + "$id": "161", + "name": "allowedValues" + } + } + }, + { + "$id": "162", + "kind": "property", + "name": "defaultValue", + "serializedName": "defaultValue", + "doc": "Default value for this solution settings property.", + "type": { + "$id": "163", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionTypeSettingsProperties.defaultValue", + "serializationOptions": { + "$id": "164", + "json": { + "$id": "165", + "name": "defaultValue" + } + } + } + ] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionTypeProperties.solutionSettings", + "serializationOptions": { + "$id": "166", + "json": { + "$id": "167", + "name": "solutionSettings" + } + } + } + ] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionTypeResource.properties", + "serializationOptions": { + "$id": "168", + "json": { + "$id": "169", + "name": "properties" + } + } + } + ] + }, + { + "$ref": "124" + }, + { + "$ref": "140" + }, + { + "$ref": "79" + }, + { + "$ref": "80" + }, + { + "$ref": "96" + }, + { + "$id": "170", + "kind": "model", + "name": "ErrorResponse", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.ErrorResponse", + "usage": "Error,Json,Exception", + "doc": "Common error response for all Azure Resource Manager APIs to return error details for failed operations.", + "decorators": [], + "properties": [ + { + "$id": "171", + "kind": "property", + "name": "error", + "serializedName": "error", + "doc": "The error object.", + "type": { + "$id": "172", + "kind": "model", + "name": "ErrorDetail", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.ErrorDetail", + "usage": "Output,Json,Exception,LroInitial,LroPolling,LroFinalEnvelope", + "doc": "The error detail.", + "decorators": [], + "properties": [ + { + "$id": "173", + "kind": "property", + "name": "code", + "serializedName": "code", + "doc": "The error code.", + "type": { + "$id": "174", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.ErrorDetail.code", + "serializationOptions": { + "$id": "175", + "json": { + "$id": "176", + "name": "code" + } + } + }, + { + "$id": "177", + "kind": "property", + "name": "message", + "serializedName": "message", + "doc": "The error message.", + "type": { + "$id": "178", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.ErrorDetail.message", + "serializationOptions": { + "$id": "179", + "json": { + "$id": "180", + "name": "message" + } + } + }, + { + "$id": "181", + "kind": "property", + "name": "target", + "serializedName": "target", + "doc": "The error target.", + "type": { + "$id": "182", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.ErrorDetail.target", + "serializationOptions": { + "$id": "183", + "json": { + "$id": "184", + "name": "target" + } + } + }, + { + "$id": "185", + "kind": "property", + "name": "details", + "serializedName": "details", + "doc": "The error details.", + "type": { + "$id": "186", + "kind": "array", + "name": "ArrayErrorDetail", + "valueType": { + "$ref": "172" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.ErrorDetail.details", + "serializationOptions": { + "$id": "187", + "json": { + "$id": "188", + "name": "details" + } + } + }, + { + "$id": "189", + "kind": "property", + "name": "additionalInfo", + "serializedName": "additionalInfo", + "doc": "The error additional info.", + "type": { + "$id": "190", + "kind": "array", + "name": "ArrayErrorAdditionalInfo", + "valueType": { + "$id": "191", + "kind": "model", + "name": "ErrorAdditionalInfo", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", + "usage": "Output,Json,Exception,LroInitial,LroPolling,LroFinalEnvelope", + "doc": "The resource management error additional info.", + "decorators": [], + "properties": [ + { + "$id": "192", + "kind": "property", + "name": "type", + "serializedName": "type", + "doc": "The additional info type.", + "type": { + "$id": "193", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo.type", + "serializationOptions": { + "$id": "194", + "json": { + "$id": "195", + "name": "type" + } + } + }, + { + "$id": "196", + "kind": "property", + "name": "info", + "serializedName": "info", + "doc": "The additional info.", + "type": { + "$id": "197", + "kind": "model", + "name": "ErrorAdditionalInfoInfo", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo.info.anonymous", + "usage": "Output,Json,Exception,LroInitial,LroPolling,LroFinalEnvelope", + "decorators": [], + "properties": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo.info", + "serializationOptions": { + "$id": "198", + "json": { + "$id": "199", + "name": "info" + } + } + } + ] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.ErrorDetail.additionalInfo", + "serializationOptions": { + "$id": "200", + "json": { + "$id": "201", + "name": "additionalInfo" + } + } + } + ] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.ErrorResponse.error", + "serializationOptions": { + "$id": "202", + "json": { + "$id": "203", + "name": "error" + } + } + } + ] + }, + { + "$ref": "172" + }, + { + "$ref": "191" + }, + { + "$ref": "197" + }, + { + "$id": "204", + "kind": "model", + "name": "SolutionTypeResourceListResult", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Azure.ResourceManager.ResourceListResult", + "usage": "Output,Json", + "doc": "The response of a SolutionTypeResource list operation.", + "decorators": [], + "properties": [ + { + "$id": "205", + "kind": "property", + "name": "value", + "serializedName": "value", + "doc": "The SolutionTypeResource items on this page", + "type": { + "$id": "206", + "kind": "array", + "name": "ArraySolutionTypeResource", + "valueType": { + "$ref": "78" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.ResourceListResult.value", + "serializationOptions": { + "$id": "207", + "json": { + "$id": "208", + "name": "value" + } + } + }, + { + "$id": "209", + "kind": "property", + "name": "nextLink", + "serializedName": "nextLink", + "doc": "The link to the next page of items", + "type": { + "$id": "210", + "kind": "url", + "name": "ResourceLocation", + "crossLanguageDefinitionId": "TypeSpec.Rest.ResourceLocation", + "baseType": { + "$id": "211", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.ResourceListResult.nextLink", + "serializationOptions": { + "$id": "212", + "json": { + "$id": "213", + "name": "nextLink" + } + } + } + ] + }, + { + "$id": "214", + "kind": "model", + "name": "InventoryResource", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.InventoryResource", + "usage": "Output,Json", + "doc": "Concrete proxy resource types can be created by aliasing this type using a specific property type.", + "decorators": [], + "baseModel": { + "$ref": "79" + }, + "properties": [ + { + "$id": "215", + "kind": "property", + "name": "properties", + "serializedName": "properties", + "doc": "The resource-specific properties for this resource.", + "type": { + "$id": "216", + "kind": "model", + "name": "InventoryProperties", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.InventoryProperties", + "usage": "Output,Json", + "doc": "Definition of inventory.", + "decorators": [], + "properties": [ + { + "$id": "217", + "kind": "property", + "name": "cloudNativeType", + "serializedName": "cloudNativeType", + "doc": "Gets or sets the cloud native resource type.", + "type": { + "$ref": "12" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.InventoryProperties.cloudNativeType", + "serializationOptions": { + "$id": "218", + "json": { + "$id": "219", + "name": "cloudNativeType" + } + } + }, + { + "$id": "220", + "kind": "property", + "name": "cloudNativeResourceId", + "serializedName": "cloudNativeResourceId", + "doc": "Gets or sets the cloud native resource name.", + "type": { + "$id": "221", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.InventoryProperties.cloudNativeResourceId", + "serializationOptions": { + "$id": "222", + "json": { + "$id": "223", + "name": "cloudNativeResourceId" + } + } + }, + { + "$id": "224", + "kind": "property", + "name": "azureResourceId", + "serializedName": "azureResourceId", + "doc": "Gets or sets the mapped azure resource id.", + "type": { + "$id": "225", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.InventoryProperties.azureResourceId", + "serializationOptions": { + "$id": "226", + "json": { + "$id": "227", + "name": "azureResourceId" + } + } + }, + { + "$id": "228", + "kind": "property", + "name": "status", + "serializedName": "status", + "doc": "Gets or sets the status of the inventory.", + "type": { + "$ref": "16" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.InventoryProperties.status", + "serializationOptions": { + "$id": "229", + "json": { + "$id": "230", + "name": "status" + } + } + }, + { + "$id": "231", + "kind": "property", + "name": "statusDetails", + "serializedName": "statusDetails", + "doc": "Gets or sets the status details.", + "type": { + "$id": "232", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.InventoryProperties.statusDetails", + "serializationOptions": { + "$id": "233", + "json": { + "$id": "234", + "name": "statusDetails" + } + } + }, + { + "$id": "235", + "kind": "property", + "name": "provisioningState", + "serializedName": "provisioningState", + "doc": "The resource provisioning state.", + "type": { + "$ref": "26" + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.InventoryProperties.provisioningState", + "serializationOptions": { + "$id": "236", + "json": { + "$id": "237", + "name": "provisioningState" + } + } + } + ] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.InventoryResource.properties", + "serializationOptions": { + "$id": "238", + "json": { + "$id": "239", + "name": "properties" + } + } + } + ] + }, + { + "$ref": "216" + }, + { + "$id": "240", + "kind": "model", + "name": "InventoryResourceListResult", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Azure.ResourceManager.ResourceListResult", + "usage": "Output,Json", + "doc": "The response of a InventoryResource list operation.", + "decorators": [], + "properties": [ + { + "$id": "241", + "kind": "property", + "name": "value", + "serializedName": "value", + "doc": "The InventoryResource items on this page", + "type": { + "$id": "242", + "kind": "array", + "name": "ArrayInventoryResource", + "valueType": { + "$ref": "214" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.ResourceListResult.value", + "serializationOptions": { + "$id": "243", + "json": { + "$id": "244", + "name": "value" + } + } + }, + { + "$id": "245", + "kind": "property", + "name": "nextLink", + "serializedName": "nextLink", + "doc": "The link to the next page of items", + "type": { + "$id": "246", + "kind": "url", + "name": "ResourceLocation", + "crossLanguageDefinitionId": "TypeSpec.Rest.ResourceLocation", + "baseType": { + "$id": "247", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.ResourceListResult.nextLink", + "serializationOptions": { + "$id": "248", + "json": { + "$id": "249", + "name": "nextLink" + } + } + } + ] + }, + { + "$id": "250", + "kind": "model", + "name": "SolutionConfiguration", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionConfiguration", + "usage": "Input,Output,Json", + "doc": "Solution Configuration", + "decorators": [], + "baseModel": { + "$id": "251", + "kind": "model", + "name": "ExtensionResource", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.ExtensionResource", + "usage": "Input,Output,Json", + "doc": "The base extension resource.", + "decorators": [], + "baseModel": { + "$ref": "80" + }, + "properties": [] + }, + "properties": [ + { + "$id": "252", + "kind": "property", + "name": "properties", + "serializedName": "properties", + "doc": "The resource-specific properties for this resource.", + "type": { + "$id": "253", + "kind": "model", + "name": "SolutionConfigurationProperties", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionConfigurationProperties", + "usage": "Input,Output,Json", + "doc": "Solution configuration resource.", + "decorators": [], + "properties": [ + { + "$id": "254", + "kind": "property", + "name": "provisioningState", + "serializedName": "provisioningState", + "doc": "The resource provisioning state.", + "type": { + "$ref": "26" + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionConfigurationProperties.provisioningState", + "serializationOptions": { + "$id": "255", + "json": { + "$id": "256", + "name": "provisioningState" + } + } + }, + { + "$id": "257", + "kind": "property", + "name": "solutionType", + "serializedName": "solutionType", + "doc": "The type of the solution", + "type": { + "$id": "258", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionConfigurationProperties.solutionType", + "serializationOptions": { + "$id": "259", + "json": { + "$id": "260", + "name": "solutionType" + } + } + }, + { + "$id": "261", + "kind": "property", + "name": "solutionSettings", + "serializedName": "solutionSettings", + "doc": "Solution settings", + "type": { + "$id": "262", + "kind": "model", + "name": "SolutionSettings", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionSettings", + "usage": "Input,Output,Json", + "doc": "Solution settings", + "decorators": [], + "additionalProperties": { + "$id": "263", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "properties": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionConfigurationProperties.solutionSettings", + "serializationOptions": { + "$id": "264", + "json": { + "$id": "265", + "name": "solutionSettings" + } + } + }, + { + "$id": "266", + "kind": "property", + "name": "status", + "serializedName": "status", + "doc": "The status of solution configurations", + "type": { + "$ref": "16" + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionConfigurationProperties.status", + "serializationOptions": { + "$id": "267", + "json": { + "$id": "268", + "name": "status" + } + } + }, + { + "$id": "269", + "kind": "property", + "name": "statusDetails", + "serializedName": "statusDetails", + "doc": "The detailed message of status details", + "type": { + "$id": "270", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionConfigurationProperties.statusDetails", + "serializationOptions": { + "$id": "271", + "json": { + "$id": "272", + "name": "statusDetails" + } + } + }, + { + "$id": "273", + "kind": "property", + "name": "lastSyncTime", + "serializedName": "lastSyncTime", + "doc": "The last time resources were inventoried", + "type": { + "$id": "274", + "kind": "utcDateTime", + "name": "utcDateTime", + "encode": "rfc3339", + "wireType": { + "$id": "275", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.utcDateTime", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionConfigurationProperties.lastSyncTime", + "serializationOptions": { + "$id": "276", + "json": { + "$id": "277", + "name": "lastSyncTime" + } + } + } + ] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionConfiguration.properties", + "serializationOptions": { + "$id": "278", + "json": { + "$id": "279", + "name": "properties" + } + } + } + ] + }, + { + "$ref": "253" + }, + { + "$ref": "262" + }, + { + "$ref": "251" + }, + { + "$id": "280", + "kind": "model", + "name": "SolutionConfigurationUpdate", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionConfigurationUpdate", + "usage": "Input,Json", + "doc": "Solution Configuration", + "decorators": [], + "baseModel": { + "$ref": "79" + }, + "properties": [ + { + "$id": "281", + "kind": "property", + "name": "properties", + "serializedName": "properties", + "doc": "The resource-specific properties for this resource.", + "type": { + "$id": "282", + "kind": "model", + "name": "SolutionConfigurationPropertiesUpdate", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionConfigurationPropertiesUpdate", + "usage": "Input,Json", + "doc": "Solution configuration resource.", + "decorators": [], + "properties": [ + { + "$id": "283", + "kind": "property", + "name": "solutionType", + "serializedName": "solutionType", + "doc": "The type of the solution", + "type": { + "$id": "284", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionConfigurationPropertiesUpdate.solutionType", + "serializationOptions": { + "$id": "285", + "json": { + "$id": "286", + "name": "solutionType" + } + } + }, + { + "$id": "287", + "kind": "property", + "name": "solutionSettings", + "serializedName": "solutionSettings", + "doc": "Solution settings", + "type": { + "$ref": "262" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionConfigurationPropertiesUpdate.solutionSettings", + "serializationOptions": { + "$id": "288", + "json": { + "$id": "289", + "name": "solutionSettings" + } + } + } + ] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionConfigurationUpdate.properties", + "serializationOptions": { + "$id": "290", + "json": { + "$id": "291", + "name": "properties" + } + } + } + ] + }, + { + "$ref": "282" + }, + { + "$id": "292", + "kind": "model", + "name": "SolutionConfigurationListResult", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Azure.ResourceManager.ResourceListResult", + "usage": "Output,Json", + "doc": "The response of a SolutionConfiguration list operation.", + "decorators": [], + "properties": [ + { + "$id": "293", + "kind": "property", + "name": "value", + "serializedName": "value", + "doc": "The SolutionConfiguration items on this page", + "type": { + "$id": "294", + "kind": "array", + "name": "ArraySolutionConfiguration", + "valueType": { + "$ref": "250" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.ResourceListResult.value", + "serializationOptions": { + "$id": "295", + "json": { + "$id": "296", + "name": "value" + } + } + }, + { + "$id": "297", + "kind": "property", + "name": "nextLink", + "serializedName": "nextLink", + "doc": "The link to the next page of items", + "type": { + "$id": "298", + "kind": "url", + "name": "ResourceLocation", + "crossLanguageDefinitionId": "TypeSpec.Rest.ResourceLocation", + "baseType": { + "$id": "299", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.ResourceListResult.nextLink", + "serializationOptions": { + "$id": "300", + "json": { + "$id": "301", + "name": "nextLink" + } + } + } + ] + }, + { + "$id": "302", + "kind": "model", + "name": "OperationStatusResult", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.OperationStatusResult", + "usage": "Output,Json,LroInitial,LroFinalEnvelope", + "doc": "The current status of an async operation.", + "decorators": [], + "properties": [ + { + "$id": "303", + "kind": "property", + "name": "id", + "serializedName": "id", + "doc": "Fully qualified ID for the async operation.", + "type": { + "$id": "304", + "kind": "string", + "name": "armResourceIdentifier", + "crossLanguageDefinitionId": "Azure.Core.armResourceIdentifier", + "baseType": { + "$id": "305", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.OperationStatusResult.id", + "serializationOptions": { + "$id": "306", + "json": { + "$id": "307", + "name": "id" + } + } + }, + { + "$id": "308", + "kind": "property", + "name": "name", + "serializedName": "name", + "doc": "Name of the async operation.", + "type": { + "$id": "309", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.OperationStatusResult.name", + "serializationOptions": { + "$id": "310", + "json": { + "$id": "311", + "name": "name" + } + } + }, + { + "$id": "312", + "kind": "property", + "name": "status", + "serializedName": "status", + "doc": "Operation status.", + "type": { + "$id": "313", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.OperationStatusResult.status", + "serializationOptions": { + "$id": "314", + "json": { + "$id": "315", + "name": "status" + } + } + }, + { + "$id": "316", + "kind": "property", + "name": "percentComplete", + "serializedName": "percentComplete", + "doc": "Percent of the operation that is complete.", + "type": { + "$id": "317", + "kind": "float64", + "name": "float64", + "crossLanguageDefinitionId": "TypeSpec.float64", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.OperationStatusResult.percentComplete", + "serializationOptions": { + "$id": "318", + "json": { + "$id": "319", + "name": "percentComplete" + } + } + }, + { + "$id": "320", + "kind": "property", + "name": "startTime", + "serializedName": "startTime", + "doc": "The start time of the operation.", + "type": { + "$id": "321", + "kind": "utcDateTime", + "name": "utcDateTime", + "encode": "rfc3339", + "wireType": { + "$id": "322", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.utcDateTime", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.OperationStatusResult.startTime", + "serializationOptions": { + "$id": "323", + "json": { + "$id": "324", + "name": "startTime" + } + } + }, + { + "$id": "325", + "kind": "property", + "name": "endTime", + "serializedName": "endTime", + "doc": "The end time of the operation.", + "type": { + "$id": "326", + "kind": "utcDateTime", + "name": "utcDateTime", + "encode": "rfc3339", + "wireType": { + "$id": "327", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.utcDateTime", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.OperationStatusResult.endTime", + "serializationOptions": { + "$id": "328", + "json": { + "$id": "329", + "name": "endTime" + } + } + }, + { + "$id": "330", + "kind": "property", + "name": "operations", + "serializedName": "operations", + "doc": "The operations list.", + "type": { + "$id": "331", + "kind": "array", + "name": "ArrayOperationStatusResult", + "valueType": { + "$ref": "302" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.OperationStatusResult.operations", + "serializationOptions": { + "$id": "332", + "json": { + "$id": "333", + "name": "operations" + } + } + }, + { + "$id": "334", + "kind": "property", + "name": "error", + "serializedName": "error", + "doc": "If present, details of the operation error.", + "type": { + "$ref": "172" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.OperationStatusResult.error", + "serializationOptions": { + "$id": "335", + "json": { + "$id": "336", + "name": "error" + } + } + }, + { + "$id": "337", + "kind": "property", + "name": "resourceId", + "serializedName": "resourceId", + "doc": "Fully qualified ID of the resource against which the original async operation was started.", + "type": { + "$id": "338", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.OperationStatusResult.resourceId", + "serializationOptions": { + "$id": "339", + "json": { + "$id": "340", + "name": "resourceId" + } + } + } + ] + }, + { + "$id": "341", + "kind": "model", + "name": "ArmOperationStatusResourceProvisioningState", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Azure.ResourceManager.ArmOperationStatus", + "usage": "LroPolling", + "doc": "Standard Azure Resource Manager operation status response", + "decorators": [], + "properties": [ + { + "$id": "342", + "kind": "property", + "name": "status", + "serializedName": "status", + "doc": "The operation status", + "type": { + "$ref": "26" + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.ArmOperationStatus.status", + "serializationOptions": { + "$id": "343", + "json": { + "$id": "344", + "name": "status" + } + } + }, + { + "$id": "345", + "kind": "property", + "name": "name", + "serializedName": "name", + "doc": "The name of the operationStatus resource", + "type": { + "$id": "346", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.ArmOperationStatus.name", + "serializationOptions": { + "$id": "347", + "json": { + "$id": "348", + "name": "name" + } + } + }, + { + "$id": "349", + "kind": "property", + "name": "startTime", + "serializedName": "startTime", + "doc": "Operation start time", + "type": { + "$id": "350", + "kind": "utcDateTime", + "name": "utcDateTime", + "encode": "rfc3339", + "wireType": { + "$id": "351", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.utcDateTime", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.ArmOperationStatus.startTime", + "serializationOptions": { + "$id": "352", + "json": { + "$id": "353", + "name": "startTime" + } + } + }, + { + "$id": "354", + "kind": "property", + "name": "endTime", + "serializedName": "endTime", + "doc": "Operation complete time", + "type": { + "$id": "355", + "kind": "utcDateTime", + "name": "utcDateTime", + "encode": "rfc3339", + "wireType": { + "$id": "356", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.utcDateTime", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.ArmOperationStatus.endTime", + "serializationOptions": { + "$id": "357", + "json": { + "$id": "358", + "name": "endTime" + } + } + }, + { + "$id": "359", + "kind": "property", + "name": "percentComplete", + "serializedName": "percentComplete", + "doc": "The progress made toward completing the operation", + "type": { + "$id": "360", + "kind": "float64", + "name": "float64", + "crossLanguageDefinitionId": "TypeSpec.float64", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.ArmOperationStatus.percentComplete", + "serializationOptions": { + "$id": "361", + "json": { + "$id": "362", + "name": "percentComplete" + } + } + }, + { + "$id": "363", + "kind": "property", + "name": "error", + "serializedName": "error", + "doc": "Errors that occurred if the operation ended with Canceled or Failed status", + "type": { + "$ref": "172" + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.ArmOperationStatus.error", + "serializationOptions": { + "$id": "364", + "json": { + "$id": "365", + "name": "error" + } + } + } + ] + }, + { + "$id": "366", + "kind": "model", + "name": "PublicCloudConnector", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.PublicCloudConnector", + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "doc": "Public Cloud Connector", + "decorators": [], + "baseModel": { + "$id": "367", + "kind": "model", + "name": "TrackedResource", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.TrackedResource", + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "doc": "The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'", + "decorators": [], + "baseModel": { + "$ref": "80" + }, + "properties": [ + { + "$id": "368", + "kind": "property", + "name": "tags", + "serializedName": "tags", + "doc": "Resource tags.", + "type": { + "$id": "369", + "kind": "dict", + "keyType": { + "$id": "370", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "valueType": { + "$id": "371", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.TrackedResource.tags", + "serializationOptions": { + "$id": "372", + "json": { + "$id": "373", + "name": "tags" + } + } + }, + { + "$id": "374", + "kind": "property", + "name": "location", + "serializedName": "location", + "doc": "The geo-location where the resource lives", + "type": { + "$id": "375", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.TrackedResource.location", + "serializationOptions": { + "$id": "376", + "json": { + "$id": "377", + "name": "location" + } + } + } + ] + }, + "properties": [ + { + "$id": "378", + "kind": "property", + "name": "properties", + "serializedName": "properties", + "doc": "The resource-specific properties for this resource.", + "type": { + "$id": "379", + "kind": "model", + "name": "PublicCloudConnectorProperties", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.PublicCloudConnectorProperties", + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "doc": "Properties of public cloud connectors.", + "decorators": [], + "properties": [ + { + "$id": "380", + "kind": "property", + "name": "awsCloudProfile", + "serializedName": "awsCloudProfile", + "doc": "Cloud profile for AWS.", + "type": { + "$id": "381", + "kind": "model", + "name": "AwsCloudProfile", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.AwsCloudProfile", + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "doc": "cloud profile for AWS.", + "decorators": [], + "properties": [ + { + "$id": "382", + "kind": "property", + "name": "accountId", + "serializedName": "accountId", + "doc": "Account id for the AWS account.", + "type": { + "$id": "383", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.AwsCloudProfile.accountId", + "serializationOptions": { + "$id": "384", + "json": { + "$id": "385", + "name": "accountId" + } + } + }, + { + "$id": "386", + "kind": "property", + "name": "excludedAccounts", + "serializedName": "excludedAccounts", + "doc": "List of AWS accounts which need to be excluded.", + "type": { + "$id": "387", + "kind": "array", + "name": "Array", + "valueType": { + "$id": "388", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.AwsCloudProfile.excludedAccounts", + "serializationOptions": { + "$id": "389", + "json": { + "$id": "390", + "name": "excludedAccounts" + } + } + }, + { + "$id": "391", + "kind": "property", + "name": "isOrganizationalAccount", + "serializedName": "isOrganizationalAccount", + "doc": "Boolean value that indicates whether the account is organizational or not. True represents organization account, whereas false represents a single account.", + "type": { + "$id": "392", + "kind": "boolean", + "name": "boolean", + "crossLanguageDefinitionId": "TypeSpec.boolean", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.AwsCloudProfile.isOrganizationalAccount", + "serializationOptions": { + "$id": "393", + "json": { + "$id": "394", + "name": "isOrganizationalAccount" + } + } + } + ] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.PublicCloudConnectorProperties.awsCloudProfile", + "serializationOptions": { + "$id": "395", + "json": { + "$id": "396", + "name": "awsCloudProfile" + } + } + }, + { + "$id": "397", + "kind": "property", + "name": "hostType", + "serializedName": "hostType", + "doc": "Host cloud the public cloud connector.", + "type": { + "$ref": "34" + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.PublicCloudConnectorProperties.hostType", + "serializationOptions": { + "$id": "398", + "json": { + "$id": "399", + "name": "hostType" + } + } + }, + { + "$id": "400", + "kind": "property", + "name": "provisioningState", + "serializedName": "provisioningState", + "doc": "The resource provisioning state.", + "type": { + "$ref": "26" + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.PublicCloudConnectorProperties.provisioningState", + "serializationOptions": { + "$id": "401", + "json": { + "$id": "402", + "name": "provisioningState" + } + } + }, + { + "$id": "403", + "kind": "property", + "name": "connectorPrimaryIdentifier", + "serializedName": "connectorPrimaryIdentifier", + "doc": "Connector primary identifier.", + "type": { + "$id": "404", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.PublicCloudConnectorProperties.connectorPrimaryIdentifier", + "serializationOptions": { + "$id": "405", + "json": { + "$id": "406", + "name": "connectorPrimaryIdentifier" + } + } + } + ] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.PublicCloudConnector.properties", + "serializationOptions": { + "$id": "407", + "json": { + "$id": "408", + "name": "properties" + } + } + } + ] + }, + { + "$ref": "379" + }, + { + "$ref": "381" + }, + { + "$ref": "367" + }, + { + "$id": "409", + "kind": "model", + "name": "PublicCloudConnectorUpdate", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.PublicCloudConnectorUpdate", + "usage": "Input,Json", + "doc": "Public Cloud Connector", + "decorators": [], + "baseModel": { + "$id": "410", + "kind": "model", + "name": "TrackedResourceUpdate", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.TrackedResourceUpdate", + "usage": "Input,Json", + "doc": "The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'", + "decorators": [], + "baseModel": { + "$ref": "80" + }, + "properties": [ + { + "$id": "411", + "kind": "property", + "name": "tags", + "serializedName": "tags", + "doc": "Resource tags.", + "type": { + "$id": "412", + "kind": "dict", + "keyType": { + "$id": "413", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "valueType": { + "$id": "414", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.TrackedResourceUpdate.tags", + "serializationOptions": { + "$id": "415", + "json": { + "$id": "416", + "name": "tags" + } + } + } + ] + }, + "properties": [ + { + "$id": "417", + "kind": "property", + "name": "properties", + "serializedName": "properties", + "doc": "The resource-specific properties for this resource.", + "type": { + "$id": "418", + "kind": "model", + "name": "PublicCloudConnectorPropertiesUpdate", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.PublicCloudConnectorPropertiesUpdate", + "usage": "Input,Json", + "doc": "Properties of public cloud connectors.", + "decorators": [], + "properties": [ + { + "$id": "419", + "kind": "property", + "name": "awsCloudProfile", + "serializedName": "awsCloudProfile", + "doc": "Cloud profile for AWS.", + "type": { + "$id": "420", + "kind": "model", + "name": "AwsCloudProfileUpdate", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.AwsCloudProfileUpdate", + "usage": "Input,Json", + "doc": "cloud profile for AWS.", + "decorators": [], + "properties": [ + { + "$id": "421", + "kind": "property", + "name": "excludedAccounts", + "serializedName": "excludedAccounts", + "doc": "List of AWS accounts which need to be excluded.", + "type": { + "$id": "422", + "kind": "array", + "name": "Array", + "valueType": { + "$id": "423", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.AwsCloudProfileUpdate.excludedAccounts", + "serializationOptions": { + "$id": "424", + "json": { + "$id": "425", + "name": "excludedAccounts" + } + } + } + ] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.PublicCloudConnectorPropertiesUpdate.awsCloudProfile", + "serializationOptions": { + "$id": "426", + "json": { + "$id": "427", + "name": "awsCloudProfile" + } + } + } + ] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.PublicCloudConnectorUpdate.properties", + "serializationOptions": { + "$id": "428", + "json": { + "$id": "429", + "name": "properties" + } + } + } + ] + }, + { + "$ref": "418" + }, + { + "$ref": "420" + }, + { + "$ref": "410" + }, + { + "$id": "430", + "kind": "model", + "name": "PublicCloudConnectorListResult", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Azure.ResourceManager.ResourceListResult", + "usage": "Output,Json", + "doc": "The response of a PublicCloudConnector list operation.", + "decorators": [], + "properties": [ + { + "$id": "431", + "kind": "property", + "name": "value", + "serializedName": "value", + "doc": "The PublicCloudConnector items on this page", + "type": { + "$id": "432", + "kind": "array", + "name": "ArrayPublicCloudConnector", + "valueType": { + "$ref": "366" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.ResourceListResult.value", + "serializationOptions": { + "$id": "433", + "json": { + "$id": "434", + "name": "value" + } + } + }, + { + "$id": "435", + "kind": "property", + "name": "nextLink", + "serializedName": "nextLink", + "doc": "The link to the next page of items", + "type": { + "$id": "436", + "kind": "url", + "name": "ResourceLocation", + "crossLanguageDefinitionId": "TypeSpec.Rest.ResourceLocation", + "baseType": { + "$id": "437", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.ResourceListResult.nextLink", + "serializationOptions": { + "$id": "438", + "json": { + "$id": "439", + "name": "nextLink" + } + } + } + ] + }, + { + "$id": "440", + "kind": "model", + "name": "GenerateAwsTemplateRequest", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.GenerateAwsTemplateRequest", + "usage": "Input,Json", + "doc": "ConnectorId and SolutionTypes and their properties to Generate AWS CFT Template.", + "decorators": [], + "properties": [ + { + "$id": "441", + "kind": "property", + "name": "connectorId", + "serializedName": "connectorId", + "doc": "The name of public cloud connector", + "type": { + "$id": "442", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.GenerateAwsTemplateRequest.connectorId", + "serializationOptions": { + "$id": "443", + "json": { + "$id": "444", + "name": "connectorId" + } + } + }, + { + "$id": "445", + "kind": "property", + "name": "solutionTypes", + "serializedName": "solutionTypes", + "doc": "The list of solution types and their settings", + "type": { + "$id": "446", + "kind": "array", + "name": "ArraySolutionTypeSettings", + "valueType": { + "$id": "447", + "kind": "model", + "name": "SolutionTypeSettings", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionTypeSettings", + "usage": "Input,Json", + "doc": "The properties of Solution Type", + "decorators": [], + "properties": [ + { + "$id": "448", + "kind": "property", + "name": "solutionType", + "serializedName": "solutionType", + "doc": "The type of the solution", + "type": { + "$id": "449", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionTypeSettings.solutionType", + "serializationOptions": { + "$id": "450", + "json": { + "$id": "451", + "name": "solutionType" + } + } + }, + { + "$id": "452", + "kind": "property", + "name": "solutionSettings", + "serializedName": "solutionSettings", + "doc": "Solution settings", + "type": { + "$ref": "262" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionTypeSettings.solutionSettings", + "serializationOptions": { + "$id": "453", + "json": { + "$id": "454", + "name": "solutionSettings" + } + } + } + ] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.GenerateAwsTemplateRequest.solutionTypes", + "serializationOptions": { + "$id": "455", + "json": { + "$id": "456", + "name": "solutionTypes" + } + } + } + ] + }, + { + "$ref": "447" + }, + { + "$id": "457", + "kind": "model", + "name": "PostResponse", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.post.Response.anonymous", + "usage": "Output,Json", + "decorators": [], + "properties": [] + }, + { + "$id": "458", + "kind": "model", + "name": "HybridConnectivityServiceConfiguration", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.ServiceConfigurationResource", + "usage": "Input,Output,Json", + "doc": "The service configuration details associated with the target resource.", + "decorators": [], + "baseModel": { + "$ref": "251" + }, + "properties": [ + { + "$id": "459", + "kind": "property", + "name": "properties", + "serializedName": "properties", + "doc": "The service configuration properties.", + "type": { + "$id": "460", + "kind": "model", + "name": "ServiceConfigurationProperties", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.ServiceConfigurationProperties", + "usage": "Input,Output,Json", + "doc": "Service configuration details", + "decorators": [], + "properties": [ + { + "$id": "461", + "kind": "property", + "name": "serviceName", + "serializedName": "serviceName", + "doc": "Name of the service.", + "type": { + "$ref": "38" + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.ServiceConfigurationProperties.serviceName", + "serializationOptions": { + "$id": "462", + "json": { + "$id": "463", + "name": "serviceName" + } + } + }, + { + "$id": "464", + "kind": "property", + "name": "resourceId", + "serializedName": "resourceId", + "doc": "The resource Id of the connectivity endpoint (optional).", + "type": { + "$id": "465", + "kind": "string", + "name": "armResourceIdentifier", + "crossLanguageDefinitionId": "Azure.Core.armResourceIdentifier", + "baseType": { + "$id": "466", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.ServiceConfigurationProperties.resourceId", + "serializationOptions": { + "$id": "467", + "json": { + "$id": "468", + "name": "resourceId" + } + } + }, + { + "$id": "469", + "kind": "property", + "name": "port", + "serializedName": "port", + "doc": "The port on which service is enabled.", + "type": { + "$id": "470", + "kind": "int64", + "name": "int64", + "crossLanguageDefinitionId": "TypeSpec.int64", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.ServiceConfigurationProperties.port", + "serializationOptions": { + "$id": "471", + "json": { + "$id": "472", + "name": "port" + } + } + }, + { + "$id": "473", + "kind": "property", + "name": "provisioningState", + "serializedName": "provisioningState", + "doc": "The resource provisioning state.", + "type": { + "$ref": "44" + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.ServiceConfigurationProperties.provisioningState", + "serializationOptions": { + "$id": "474", + "json": { + "$id": "475", + "name": "provisioningState" + } + } + } + ] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": true, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.ServiceConfigurationResource.properties", + "serializationOptions": { + "$id": "476", + "json": { + "$id": "477", + "name": "properties" + } + } + } + ] + }, + { + "$ref": "460" + }, + { + "$id": "478", + "kind": "model", + "name": "ServiceConfigurationResourcePatch", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.ServiceConfigurationResourcePatch", + "usage": "Input,Json", + "doc": "The service details under service configuration for the target endpoint resource.", + "decorators": [], + "properties": [ + { + "$id": "479", + "kind": "property", + "name": "properties", + "serializedName": "properties", + "doc": "The service configuration properties.", + "type": { + "$id": "480", + "kind": "model", + "name": "ServiceConfigurationPropertiesPatch", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.ServiceConfigurationPropertiesPatch", + "usage": "Input,Json", + "doc": "Service configuration details", + "decorators": [], + "properties": [ + { + "$id": "481", + "kind": "property", + "name": "port", + "serializedName": "port", + "doc": "The port on which service is enabled.", + "type": { + "$id": "482", + "kind": "int64", + "name": "int64", + "crossLanguageDefinitionId": "TypeSpec.int64", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.ServiceConfigurationPropertiesPatch.port", + "serializationOptions": { + "$id": "483", + "json": { + "$id": "484", + "name": "port" + } + } + } + ] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": true, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.ServiceConfigurationResourcePatch.properties", + "serializationOptions": { + "$id": "485", + "json": { + "$id": "486", + "name": "properties" + } + } + } + ] + }, + { + "$ref": "480" + }, + { + "$id": "487", + "kind": "model", + "name": "ServiceConfigurationList", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.ServiceConfigurationList", + "usage": "Output,Json", + "doc": "The paginated list of serviceConfigurations", + "decorators": [], + "properties": [ + { + "$id": "488", + "kind": "property", + "name": "value", + "serializedName": "value", + "doc": "The list of service configuration", + "type": { + "$id": "489", + "kind": "array", + "name": "ArrayServiceConfigurationResource", + "valueType": { + "$ref": "458" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.ServiceConfigurationList.value", + "serializationOptions": { + "$id": "490", + "json": { + "$id": "491", + "name": "value" + } + } + }, + { + "$id": "492", + "kind": "property", + "name": "nextLink", + "serializedName": "nextLink", + "doc": "The link to fetch the next page of connected cluster", + "type": { + "$id": "493", + "kind": "url", + "name": "ResourceLocation", + "crossLanguageDefinitionId": "TypeSpec.Rest.ResourceLocation", + "baseType": { + "$id": "494", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.ServiceConfigurationList.nextLink", + "serializationOptions": { + "$id": "495", + "json": { + "$id": "496", + "name": "nextLink" + } + } + } + ] + }, + { + "$id": "497", + "kind": "model", + "name": "HybridConnectivityEndpoint", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.EndpointResource", + "usage": "Input,Output,Json", + "doc": "The endpoint for the target resource.", + "decorators": [], + "baseModel": { + "$ref": "251" + }, + "properties": [ + { + "$id": "498", + "kind": "property", + "name": "properties", + "serializedName": "properties", + "doc": "The endpoint properties.", + "type": { + "$id": "499", + "kind": "model", + "name": "HybridConnectivityEndpointProperties", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.EndpointProperties", + "usage": "Input,Output,Json", + "doc": "Endpoint details", + "decorators": [], + "properties": [ + { + "$id": "500", + "kind": "property", + "name": "endpointType", + "serializedName": "type", + "doc": "The type of endpoint.", + "type": { + "$ref": "56" + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.EndpointProperties.type", + "serializationOptions": { + "$id": "501", + "json": { + "$id": "502", + "name": "type" + } + } + }, + { + "$id": "503", + "kind": "property", + "name": "resourceId", + "serializedName": "resourceId", + "doc": "The resource Id of the connectivity endpoint (optional).", + "type": { + "$id": "504", + "kind": "string", + "name": "armResourceIdentifier", + "crossLanguageDefinitionId": "Azure.Core.armResourceIdentifier", + "baseType": { + "$id": "505", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.EndpointProperties.resourceId", + "serializationOptions": { + "$id": "506", + "json": { + "$id": "507", + "name": "resourceId" + } + } + }, + { + "$id": "508", + "kind": "property", + "name": "provisioningState", + "serializedName": "provisioningState", + "doc": "The resource provisioning state.", + "type": { + "$id": "509", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.EndpointProperties.provisioningState", + "serializationOptions": { + "$id": "510", + "json": { + "$id": "511", + "name": "provisioningState" + } + } + } + ] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.EndpointResource.properties", + "serializationOptions": { + "$id": "512", + "json": { + "$id": "513", + "name": "properties" + } + } + } + ] + }, + { + "$ref": "499" + }, + { + "$id": "514", + "kind": "model", + "name": "EndpointsList", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.EndpointsList", + "usage": "Output,Json", + "doc": "The list of endpoints.", + "decorators": [], + "properties": [ + { + "$id": "515", + "kind": "property", + "name": "value", + "serializedName": "value", + "doc": "The list of endpoint.", + "type": { + "$id": "516", + "kind": "array", + "name": "ArrayEndpointResource", + "valueType": { + "$ref": "497" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.EndpointsList.value", + "serializationOptions": { + "$id": "517", + "json": { + "$id": "518", + "name": "value" + } + } + }, + { + "$id": "519", + "kind": "property", + "name": "nextLink", + "serializedName": "nextLink", + "doc": "The link used to get the next page of endpoints list.", + "type": { + "$id": "520", + "kind": "url", + "name": "ResourceLocation", + "crossLanguageDefinitionId": "TypeSpec.Rest.ResourceLocation", + "baseType": { + "$id": "521", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.EndpointsList.nextLink", + "serializationOptions": { + "$id": "522", + "json": { + "$id": "523", + "name": "nextLink" + } + } + } + ] + }, + { + "$id": "524", + "kind": "model", + "name": "ListCredentialsRequest", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.ListCredentialsRequest", + "usage": "Input,Json", + "doc": "The details of the service for which credentials needs to be returned.", + "decorators": [], + "properties": [ + { + "$id": "525", + "kind": "property", + "name": "serviceName", + "serializedName": "serviceName", + "doc": "The name of the service. If not provided, the request will by pass the generation of service configuration token", + "type": { + "$ref": "38" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.ListCredentialsRequest.serviceName", + "serializationOptions": { + "$id": "526", + "json": { + "$id": "527", + "name": "serviceName" + } + } + } + ] + }, + { + "$id": "528", + "kind": "model", + "name": "TargetResourceEndpointAccess", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.EndpointAccessResource", + "usage": "Output,Json", + "doc": "The endpoint access for the target resource.", + "decorators": [], + "properties": [ + { + "$id": "529", + "kind": "property", + "name": "relay", + "serializedName": "relay", + "doc": "Azure relay hybrid connection access properties", + "type": { + "$id": "530", + "kind": "model", + "name": "RelayNamespaceAccessProperties", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.RelayNamespaceAccessProperties", + "usage": "Output,Json", + "doc": "Azure relay hybrid connection access properties", + "decorators": [], + "properties": [ + { + "$id": "531", + "kind": "property", + "name": "namespaceName", + "serializedName": "namespaceName", + "doc": "The namespace name.", + "type": { + "$id": "532", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.RelayNamespaceAccessProperties.namespaceName", + "serializationOptions": { + "$id": "533", + "json": { + "$id": "534", + "name": "namespaceName" + } + } + }, + { + "$id": "535", + "kind": "property", + "name": "namespaceNameSuffix", + "serializedName": "namespaceNameSuffix", + "doc": "The suffix domain name of relay namespace.", + "type": { + "$id": "536", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.RelayNamespaceAccessProperties.namespaceNameSuffix", + "serializationOptions": { + "$id": "537", + "json": { + "$id": "538", + "name": "namespaceNameSuffix" + } + } + }, + { + "$id": "539", + "kind": "property", + "name": "hybridConnectionName", + "serializedName": "hybridConnectionName", + "doc": "Azure Relay hybrid connection name for the resource.", + "type": { + "$id": "540", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.RelayNamespaceAccessProperties.hybridConnectionName", + "serializationOptions": { + "$id": "541", + "json": { + "$id": "542", + "name": "hybridConnectionName" + } + } + }, + { + "$id": "543", + "kind": "property", + "name": "accessKey", + "serializedName": "accessKey", + "doc": "Access key for hybrid connection.", + "type": { + "$id": "544", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.RelayNamespaceAccessProperties.accessKey", + "serializationOptions": { + "$id": "545", + "json": { + "$id": "546", + "name": "accessKey" + } + } + }, + { + "$id": "547", + "kind": "property", + "name": "expiresOn", + "serializedName": "expiresOn", + "doc": "The expiration of access key in unix time.", + "type": { + "$id": "548", + "kind": "int64", + "name": "int64", + "crossLanguageDefinitionId": "TypeSpec.int64", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.RelayNamespaceAccessProperties.expiresOn", + "serializationOptions": { + "$id": "549", + "json": { + "$id": "550", + "name": "expiresOn" + } + } + }, + { + "$id": "551", + "kind": "property", + "name": "serviceConfigurationToken", + "serializedName": "serviceConfigurationToken", + "doc": "The token to access the enabled service.", + "type": { + "$id": "552", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.RelayNamespaceAccessProperties.serviceConfigurationToken", + "serializationOptions": { + "$id": "553", + "json": { + "$id": "554", + "name": "serviceConfigurationToken" + } + } + } + ] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": true, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.EndpointAccessResource.relay", + "serializationOptions": { + "$id": "555", + "json": { + "$id": "556", + "name": "relay" + } + } + } + ] + }, + { + "$ref": "530" + }, + { + "$id": "557", + "kind": "model", + "name": "ListIngressGatewayCredentialsRequest", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.ListIngressGatewayCredentialsRequest", + "usage": "Input,Json", + "doc": "Represent ListIngressGatewayCredentials Request object.", + "decorators": [], + "properties": [ + { + "$id": "558", + "kind": "property", + "name": "serviceName", + "serializedName": "serviceName", + "doc": "The name of the service. If not provided, the request will by pass the generation of service configuration token.", + "type": { + "$ref": "38" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.ListIngressGatewayCredentialsRequest.serviceName", + "serializationOptions": { + "$id": "559", + "json": { + "$id": "560", + "name": "serviceName" + } + } + } + ] + }, + { + "$id": "561", + "kind": "model", + "name": "IngressGatewayAsset", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.IngressGatewayResource", + "usage": "Output,Json", + "doc": "The ingress gateway access credentials", + "decorators": [], + "properties": [ + { + "$id": "562", + "kind": "property", + "name": "relay", + "serializedName": "relay", + "doc": "Azure relay hybrid connection access properties", + "type": { + "$ref": "530" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": true, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.IngressGatewayResource.relay", + "serializationOptions": { + "$id": "563", + "json": { + "$id": "564", + "name": "relay" + } + } + }, + { + "$id": "565", + "kind": "property", + "name": "ingress", + "serializedName": "ingress", + "doc": "Ingress gateway profile", + "type": { + "$id": "566", + "kind": "model", + "name": "IngressProfileProperties", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.IngressProfileProperties", + "usage": "Output,Json", + "doc": "Ingress gateway profile", + "decorators": [], + "properties": [ + { + "$id": "567", + "kind": "property", + "name": "hostname", + "serializedName": "hostname", + "doc": "The ingress hostname.", + "type": { + "$id": "568", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.IngressProfileProperties.hostname", + "serializationOptions": { + "$id": "569", + "json": { + "$id": "570", + "name": "hostname" + } + } + }, + { + "$id": "571", + "kind": "property", + "name": "aadProfile", + "serializedName": "aadProfile", + "doc": "The AAD Profile", + "type": { + "$id": "572", + "kind": "model", + "name": "AADProfileProperties", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.AADProfileProperties", + "usage": "Output,Json", + "doc": "The AAD Profile", + "decorators": [], + "properties": [ + { + "$id": "573", + "kind": "property", + "name": "serverId", + "serializedName": "serverId", + "doc": "The arc ingress gateway server app id.", + "type": { + "$id": "574", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "575", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.AADProfileProperties.serverId", + "serializationOptions": { + "$id": "576", + "json": { + "$id": "577", + "name": "serverId" + } + } + }, + { + "$id": "578", + "kind": "property", + "name": "tenantId", + "serializedName": "tenantId", + "doc": "The target resource home tenant id.", + "type": { + "$id": "579", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "580", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.AADProfileProperties.tenantId", + "serializationOptions": { + "$id": "581", + "json": { + "$id": "582", + "name": "tenantId" + } + } + } + ] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": true, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.IngressProfileProperties.aadProfile", + "serializationOptions": { + "$id": "583", + "json": { + "$id": "584", + "name": "aadProfile" + } + } + } + ] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": true, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.IngressGatewayResource.ingress", + "serializationOptions": { + "$id": "585", + "json": { + "$id": "586", + "name": "ingress" + } + } + } + ] + }, + { + "$ref": "566" + }, + { + "$ref": "572" + }, + { + "$id": "587", + "kind": "model", + "name": "ManagedProxyRequest", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.ManagedProxyRequest", + "usage": "Input,Json", + "doc": "Represent ManageProxy Request object.", + "decorators": [], + "properties": [ + { + "$id": "588", + "kind": "property", + "name": "service", + "serializedName": "service", + "doc": "The name of the service.", + "type": { + "$id": "589", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.ManagedProxyRequest.service", + "serializationOptions": { + "$id": "590", + "json": { + "$id": "591", + "name": "service" + } + } + }, + { + "$id": "592", + "kind": "property", + "name": "hostname", + "serializedName": "hostname", + "doc": "The target host name.", + "type": { + "$id": "593", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.ManagedProxyRequest.hostname", + "serializationOptions": { + "$id": "594", + "json": { + "$id": "595", + "name": "hostname" + } + } + }, + { + "$id": "596", + "kind": "property", + "name": "serviceName", + "serializedName": "serviceName", + "doc": "The name of the service. It is an optional property, if not provided, service configuration tokens issue code would be by passed.", + "type": { + "$ref": "38" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.ManagedProxyRequest.serviceName", + "serializationOptions": { + "$id": "597", + "json": { + "$id": "598", + "name": "serviceName" + } + } + } + ] + }, + { + "$id": "599", + "kind": "model", + "name": "ManagedProxyAsset", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.ManagedProxyResource", + "usage": "Output,Json", + "doc": "Managed Proxy", + "decorators": [], + "properties": [ + { + "$id": "600", + "kind": "property", + "name": "proxy", + "serializedName": "proxy", + "doc": "The short lived proxy name.", + "type": { + "$id": "601", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.ManagedProxyResource.proxy", + "serializationOptions": { + "$id": "602", + "json": { + "$id": "603", + "name": "proxy" + } + } + }, + { + "$id": "604", + "kind": "property", + "name": "expiresOn", + "serializedName": "expiresOn", + "doc": "The expiration time of short lived proxy name in unix epoch.", + "type": { + "$id": "605", + "kind": "int64", + "name": "int64", + "crossLanguageDefinitionId": "TypeSpec.int64", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.ManagedProxyResource.expiresOn", + "serializationOptions": { + "$id": "606", + "json": { + "$id": "607", + "name": "expiresOn" + } + } + } + ] + }, + { + "$id": "608", + "kind": "model", + "name": "OperationListResult", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.OperationListResult", + "usage": "Output,Json", + "doc": "A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results.", + "decorators": [], + "properties": [ + { + "$id": "609", + "kind": "property", + "name": "value", + "serializedName": "value", + "doc": "The Operation items on this page", + "type": { + "$id": "610", + "kind": "array", + "name": "ArrayOperation", + "valueType": { + "$id": "611", + "kind": "model", + "name": "Operation", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.Operation", + "usage": "Output,Json", + "doc": "Details of a REST API operation, returned from the Resource Provider Operations API", + "decorators": [], + "properties": [ + { + "$id": "612", + "kind": "property", + "name": "name", + "serializedName": "name", + "doc": "The name of the operation, as per Resource-Based Access Control (RBAC). Examples: \"Microsoft.Compute/virtualMachines/write\", \"Microsoft.Compute/virtualMachines/capture/action\"", + "type": { + "$id": "613", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.Operation.name", + "serializationOptions": { + "$id": "614", + "json": { + "$id": "615", + "name": "name" + } + } + }, + { + "$id": "616", + "kind": "property", + "name": "isDataAction", + "serializedName": "isDataAction", + "doc": "Whether the operation applies to data-plane. This is \"true\" for data-plane operations and \"false\" for Azure Resource Manager/control-plane operations.", + "type": { + "$id": "617", + "kind": "boolean", + "name": "boolean", + "crossLanguageDefinitionId": "TypeSpec.boolean", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.Operation.isDataAction", + "serializationOptions": { + "$id": "618", + "json": { + "$id": "619", + "name": "isDataAction" + } + } + }, + { + "$id": "620", + "kind": "property", + "name": "display", + "serializedName": "display", + "doc": "Localized display information for this particular operation.", + "type": { + "$id": "621", + "kind": "model", + "name": "OperationDisplay", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.OperationDisplay", + "usage": "Output,Json", + "doc": "Localized display information for and operation.", + "decorators": [], + "properties": [ + { + "$id": "622", + "kind": "property", + "name": "provider", + "serializedName": "provider", + "doc": "The localized friendly form of the resource provider name, e.g. \"Microsoft Monitoring Insights\" or \"Microsoft Compute\".", + "type": { + "$id": "623", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.OperationDisplay.provider", + "serializationOptions": { + "$id": "624", + "json": { + "$id": "625", + "name": "provider" + } + } + }, + { + "$id": "626", + "kind": "property", + "name": "resource", + "serializedName": "resource", + "doc": "The localized friendly name of the resource type related to this operation. E.g. \"Virtual Machines\" or \"Job Schedule Collections\".", + "type": { + "$id": "627", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.OperationDisplay.resource", + "serializationOptions": { + "$id": "628", + "json": { + "$id": "629", + "name": "resource" + } + } + }, + { + "$id": "630", + "kind": "property", + "name": "operation", + "serializedName": "operation", + "doc": "The concise, localized friendly name for the operation; suitable for dropdowns. E.g. \"Create or Update Virtual Machine\", \"Restart Virtual Machine\".", + "type": { + "$id": "631", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.OperationDisplay.operation", + "serializationOptions": { + "$id": "632", + "json": { + "$id": "633", + "name": "operation" + } + } + }, + { + "$id": "634", + "kind": "property", + "name": "description", + "serializedName": "description", + "doc": "The short, localized friendly description of the operation; suitable for tool tips and detailed views.", + "type": { + "$id": "635", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.OperationDisplay.description", + "serializationOptions": { + "$id": "636", + "json": { + "$id": "637", + "name": "description" + } + } + } + ] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.Operation.display", + "serializationOptions": { + "$id": "638", + "json": { + "$id": "639", + "name": "display" + } + } + }, + { + "$id": "640", + "kind": "property", + "name": "origin", + "serializedName": "origin", + "doc": "The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is \"user,system\"", + "type": { + "$ref": "62" + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.Operation.origin", + "serializationOptions": { + "$id": "641", + "json": { + "$id": "642", + "name": "origin" + } + } + }, + { + "$id": "643", + "kind": "property", + "name": "actionType", + "serializedName": "actionType", + "doc": "Extensible enum. Indicates the action type. \"Internal\" refers to actions that are for internal only APIs.", + "type": { + "$ref": "70" + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.Operation.actionType", + "serializationOptions": { + "$id": "644", + "json": { + "$id": "645", + "name": "actionType" + } + } + } + ] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.OperationListResult.value", + "serializationOptions": { + "$id": "646", + "json": { + "$id": "647", + "name": "value" + } + } + }, + { + "$id": "648", + "kind": "property", + "name": "nextLink", + "serializedName": "nextLink", + "doc": "The link to the next page of items", + "type": { + "$id": "649", + "kind": "url", + "name": "ResourceLocation", + "crossLanguageDefinitionId": "TypeSpec.Rest.ResourceLocation", + "baseType": { + "$id": "650", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.OperationListResult.nextLink", + "serializationOptions": { + "$id": "651", + "json": { + "$id": "652", + "name": "nextLink" + } + } + } + ] + }, + { + "$ref": "611" + }, + { + "$ref": "621" + } + ], + "clients": [ + { + "$id": "653", + "kind": "client", + "name": "HybridConnectivityClient", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "doc": "REST API for public clouds.", + "operations": [], + "parameters": [ + { + "$id": "654", + "name": "endpoint", + "nameInRequest": "endpoint", + "doc": "Service host", + "type": { + "$id": "655", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url" + }, + "location": "Uri", + "isApiVersion": false, + "isContentType": false, + "isRequired": true, + "isEndpoint": true, + "skipUrlEncoding": false, + "explode": false, + "kind": "Client", + "defaultValue": { + "$id": "656", + "type": { + "$id": "657", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "https://management.azure.com" + } + } + ], + "decorators": [ + { + "$id": "658", + "name": "TypeSpec.@service", + "arguments": { + "$id": "659", + "options": { + "$id": "660", + "title": "Hybrid Connectivity Management API" + } + } + } + ], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity", + "apiVersions": [ + "2024-12-01" + ], + "children": [ + { + "$id": "661", + "kind": "client", + "name": "Operations", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "operations": [ + { + "$id": "662", + "name": "list", + "resourceName": "Operations", + "doc": "List the operations for the provider", + "accessibility": "public", + "parameters": [ + { + "$id": "663", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "664", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "665", + "type": { + "$id": "666", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-12-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "667", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "668", + "kind": "constant", + "valueType": { + "$id": "669", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "670", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "608" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/providers/Microsoft.HybridConnectivity/operations", + "bufferResponse": true, + "paging": { + "$id": "671", + "itemPropertySegments": [ + "value" + ], + "nextLink": { + "$id": "672", + "responseSegments": [ + "nextLink" + ], + "responseLocation": "Body" + } + }, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Azure.ResourceManager.Operations.list", + "decorators": [], + "examples": [ + { + "$id": "673", + "kind": "http", + "name": "HybridConnectivityOperationsList", + "description": "HybridConnectivityOperationsList", + "filePath": "2024-12-01/OperationsList.json", + "parameters": [ + { + "$id": "674", + "parameter": { + "$ref": "663" + }, + "value": { + "$id": "675", + "kind": "string", + "type": { + "$ref": "664" + }, + "value": "2024-12-01" + } + } + ], + "responses": [ + { + "$id": "676", + "response": { + "$ref": "670" + }, + "statusCode": 200, + "bodyValue": { + "$id": "677", + "kind": "model", + "type": { + "$ref": "608" + }, + "value": { + "$id": "678", + "value": { + "$id": "679", + "kind": "array", + "type": { + "$ref": "610" + }, + "value": [ + { + "$id": "680", + "kind": "model", + "type": { + "$ref": "611" + }, + "value": { + "$id": "681", + "name": { + "$id": "682", + "kind": "string", + "type": { + "$ref": "613" + }, + "value": "Microsoft.HybridConnectivity/operations/read" + }, + "isDataAction": { + "$id": "683", + "kind": "boolean", + "type": { + "$ref": "617" + }, + "value": false + }, + "display": { + "$id": "684", + "kind": "model", + "type": { + "$ref": "621" + }, + "value": { + "$id": "685", + "provider": { + "$id": "686", + "kind": "string", + "type": { + "$ref": "623" + }, + "value": "Microsoft.HybridConnectivity" + }, + "resource": { + "$id": "687", + "kind": "string", + "type": { + "$ref": "627" + }, + "value": "Operations" + }, + "operation": { + "$id": "688", + "kind": "string", + "type": { + "$ref": "631" + }, + "value": "Get operations" + }, + "description": { + "$id": "689", + "kind": "string", + "type": { + "$ref": "635" + }, + "value": "Get the list of Operations" + } + } + } + } + }, + { + "$id": "690", + "kind": "model", + "type": { + "$ref": "611" + }, + "value": { + "$id": "691", + "name": { + "$id": "692", + "kind": "string", + "type": { + "$ref": "613" + }, + "value": "Microsoft.HybridConnectivity/endpoints/read" + }, + "isDataAction": { + "$id": "693", + "kind": "boolean", + "type": { + "$ref": "617" + }, + "value": false + }, + "display": { + "$id": "694", + "kind": "model", + "type": { + "$ref": "621" + }, + "value": { + "$id": "695", + "provider": { + "$id": "696", + "kind": "string", + "type": { + "$ref": "623" + }, + "value": "Microsoft.HybridConnectivity" + }, + "resource": { + "$id": "697", + "kind": "string", + "type": { + "$ref": "627" + }, + "value": "endpoints" + }, + "operation": { + "$id": "698", + "kind": "string", + "type": { + "$ref": "631" + }, + "value": "Get/List endpoints" + }, + "description": { + "$id": "699", + "kind": "string", + "type": { + "$ref": "635" + }, + "value": "Get or list of endpoints to the target resource." + } + } + } + } + }, + { + "$id": "700", + "kind": "model", + "type": { + "$ref": "611" + }, + "value": { + "$id": "701", + "name": { + "$id": "702", + "kind": "string", + "type": { + "$ref": "613" + }, + "value": "Microsoft.HybridConnectivity/endpoints/write" + }, + "isDataAction": { + "$id": "703", + "kind": "boolean", + "type": { + "$ref": "617" + }, + "value": false + }, + "display": { + "$id": "704", + "kind": "model", + "type": { + "$ref": "621" + }, + "value": { + "$id": "705", + "provider": { + "$id": "706", + "kind": "string", + "type": { + "$ref": "623" + }, + "value": "Microsoft.HybridConnectivity" + }, + "resource": { + "$id": "707", + "kind": "string", + "type": { + "$ref": "627" + }, + "value": "endpoints" + }, + "operation": { + "$id": "708", + "kind": "string", + "type": { + "$ref": "631" + }, + "value": "Create/Update endpoint" + }, + "description": { + "$id": "709", + "kind": "string", + "type": { + "$ref": "635" + }, + "value": "Create or update the endpoint to the target resource." + } + } + } + } + }, + { + "$id": "710", + "kind": "model", + "type": { + "$ref": "611" + }, + "value": { + "$id": "711", + "name": { + "$id": "712", + "kind": "string", + "type": { + "$ref": "613" + }, + "value": "Microsoft.HybridConnectivity/endpoints/delete" + }, + "isDataAction": { + "$id": "713", + "kind": "boolean", + "type": { + "$ref": "617" + }, + "value": false + }, + "display": { + "$id": "714", + "kind": "model", + "type": { + "$ref": "621" + }, + "value": { + "$id": "715", + "provider": { + "$id": "716", + "kind": "string", + "type": { + "$ref": "623" + }, + "value": "Microsoft.HybridConnectivity" + }, + "resource": { + "$id": "717", + "kind": "string", + "type": { + "$ref": "627" + }, + "value": "endpoints" + }, + "operation": { + "$id": "718", + "kind": "string", + "type": { + "$ref": "631" + }, + "value": "Delete endpoint" + }, + "description": { + "$id": "719", + "kind": "string", + "type": { + "$ref": "635" + }, + "value": "Deletes the endpoint access to the target resource." + } + } + } + } + }, + { + "$id": "720", + "kind": "model", + "type": { + "$ref": "611" + }, + "value": { + "$id": "721", + "name": { + "$id": "722", + "kind": "string", + "type": { + "$ref": "613" + }, + "value": "Microsoft.HybridConnectivity/endpoints/listCredentials/action" + }, + "isDataAction": { + "$id": "723", + "kind": "boolean", + "type": { + "$ref": "617" + }, + "value": false + }, + "display": { + "$id": "724", + "kind": "model", + "type": { + "$ref": "621" + }, + "value": { + "$id": "725", + "provider": { + "$id": "726", + "kind": "string", + "type": { + "$ref": "623" + }, + "value": "Microsoft.HybridConnectivity" + }, + "resource": { + "$id": "727", + "kind": "string", + "type": { + "$ref": "627" + }, + "value": "endpoints" + }, + "operation": { + "$id": "728", + "kind": "string", + "type": { + "$ref": "631" + }, + "value": "List credentials for endpoint access" + }, + "description": { + "$id": "729", + "kind": "string", + "type": { + "$ref": "635" + }, + "value": "List the endpoint access credentials to the resource." + } + } + } + } + }, + { + "$id": "730", + "kind": "model", + "type": { + "$ref": "611" + }, + "value": { + "$id": "731", + "name": { + "$id": "732", + "kind": "string", + "type": { + "$ref": "613" + }, + "value": "Microsoft.HybridConnectivity/endpoints/listIngressGatewayCredentials/action" + }, + "isDataAction": { + "$id": "733", + "kind": "boolean", + "type": { + "$ref": "617" + }, + "value": false + }, + "display": { + "$id": "734", + "kind": "model", + "type": { + "$ref": "621" + }, + "value": { + "$id": "735", + "provider": { + "$id": "736", + "kind": "string", + "type": { + "$ref": "623" + }, + "value": "Microsoft.HybridConnectivity" + }, + "resource": { + "$id": "737", + "kind": "string", + "type": { + "$ref": "627" + }, + "value": "endpoints" + }, + "operation": { + "$id": "738", + "kind": "string", + "type": { + "$ref": "631" + }, + "value": "List credentials for ingress gateway" + }, + "description": { + "$id": "739", + "kind": "string", + "type": { + "$ref": "635" + }, + "value": "List the ingress gateway credentials to the resource." + } + } + } + } + }, + { + "$id": "740", + "kind": "model", + "type": { + "$ref": "611" + }, + "value": { + "$id": "741", + "name": { + "$id": "742", + "kind": "string", + "type": { + "$ref": "613" + }, + "value": "Microsoft.HybridConnectivity/register/action" + }, + "isDataAction": { + "$id": "743", + "kind": "boolean", + "type": { + "$ref": "617" + }, + "value": false + }, + "display": { + "$id": "744", + "kind": "model", + "type": { + "$ref": "621" + }, + "value": { + "$id": "745", + "provider": { + "$id": "746", + "kind": "string", + "type": { + "$ref": "623" + }, + "value": "Microsoft.HybridConnectivity" + }, + "resource": { + "$id": "747", + "kind": "string", + "type": { + "$ref": "627" + }, + "value": "Microsoft.HybridConnectivity" + }, + "operation": { + "$id": "748", + "kind": "string", + "type": { + "$ref": "631" + }, + "value": "Register the Microsoft.HybridConnectivity" + }, + "description": { + "$id": "749", + "kind": "string", + "type": { + "$ref": "635" + }, + "value": "Register the subscription for Microsoft.HybridConnectivity" + } + } + } + } + }, + { + "$id": "750", + "kind": "model", + "type": { + "$ref": "611" + }, + "value": { + "$id": "751", + "name": { + "$id": "752", + "kind": "string", + "type": { + "$ref": "613" + }, + "value": "Microsoft.HybridConnectivity/unregister/action" + }, + "isDataAction": { + "$id": "753", + "kind": "boolean", + "type": { + "$ref": "617" + }, + "value": false + }, + "display": { + "$id": "754", + "kind": "model", + "type": { + "$ref": "621" + }, + "value": { + "$id": "755", + "provider": { + "$id": "756", + "kind": "string", + "type": { + "$ref": "623" + }, + "value": "Microsoft.HybridConnectivity" + }, + "resource": { + "$id": "757", + "kind": "string", + "type": { + "$ref": "627" + }, + "value": "Microsoft.HybridConnectivity" + }, + "operation": { + "$id": "758", + "kind": "string", + "type": { + "$ref": "631" + }, + "value": "Unregister the Microsoft.HybridConnectivity" + }, + "description": { + "$id": "759", + "kind": "string", + "type": { + "$ref": "635" + }, + "value": "Unregister the subscription for Microsoft.HybridConnectivity" + } + } + } + } + } + ] + } + } + } + } + ] + } + ] + } + ], + "parameters": [ + { + "$id": "760", + "name": "endpoint", + "nameInRequest": "endpoint", + "doc": "Service host", + "type": { + "$id": "761", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url" + }, + "location": "Uri", + "isApiVersion": false, + "isContentType": false, + "isRequired": true, + "isEndpoint": true, + "skipUrlEncoding": false, + "explode": false, + "kind": "Client", + "defaultValue": { + "$id": "762", + "type": { + "$id": "763", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "https://management.azure.com" + } + } + ], + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.Operations", + "apiVersions": [ + "2024-12-01" + ], + "parent": { + "$ref": "653" + } + }, + { + "$id": "764", + "kind": "client", + "name": "EndpointResources", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "operations": [ + { + "$id": "765", + "name": "get", + "resourceName": "EndpointResource", + "doc": "Gets the endpoint to the resource.", + "accessibility": "public", + "parameters": [ + { + "$id": "766", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "767", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "768", + "type": { + "$id": "769", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-12-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "770", + "name": "resourceUri", + "nameInRequest": "resourceUri", + "doc": "The fully qualified Azure Resource manager identifier of the resource.", + "type": { + "$id": "771", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "772", + "name": "endpointName", + "nameInRequest": "endpointName", + "doc": "The endpoint name.", + "type": { + "$id": "773", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "774", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "775", + "kind": "constant", + "valueType": { + "$id": "776", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "777", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "497" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.EndpointResources.get", + "decorators": [], + "examples": [ + { + "$id": "778", + "kind": "http", + "name": "HybridConnectivityEndpointsGetCustom", + "description": "HybridConnectivityEndpointsGetCustom", + "filePath": "2024-12-01/EndpointsGetCustom.json", + "parameters": [ + { + "$id": "779", + "parameter": { + "$ref": "766" + }, + "value": { + "$id": "780", + "kind": "string", + "type": { + "$ref": "767" + }, + "value": "2024-12-01" + } + }, + { + "$id": "781", + "parameter": { + "$ref": "772" + }, + "value": { + "$id": "782", + "kind": "string", + "type": { + "$ref": "773" + }, + "value": "custom" + } + }, + { + "$id": "783", + "parameter": { + "$ref": "770" + }, + "value": { + "$id": "784", + "kind": "string", + "type": { + "$ref": "771" + }, + "value": "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine" + } + } + ], + "responses": [ + { + "$id": "785", + "response": { + "$ref": "777" + }, + "statusCode": 200, + "bodyValue": { + "$id": "786", + "kind": "model", + "type": { + "$ref": "497" + }, + "value": { + "$id": "787", + "name": { + "$id": "788", + "kind": "string", + "type": { + "$ref": "87" + }, + "value": "custom" + }, + "type": { + "$id": "789", + "kind": "string", + "type": { + "$ref": "91" + }, + "value": "Microsoft.HybridConnectivity/endpoints" + }, + "id": { + "$id": "790", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/custom" + }, + "properties": { + "$id": "791", + "kind": "model", + "type": { + "$ref": "499" + }, + "value": { + "$id": "792", + "type": { + "$id": "793", + "kind": "string", + "type": { + "$ref": "56" + }, + "value": "custom" + }, + "resourceId": { + "$id": "794", + "kind": "string", + "type": { + "$ref": "504" + }, + "value": "/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.Relay/namespaces/custom-relay-namespace" + } + } + } + } + } + } + ] + }, + { + "$id": "795", + "kind": "http", + "name": "HybridConnectivityEndpointsGetDefault", + "description": "HybridConnectivityEndpointsGetDefault", + "filePath": "2024-12-01/EndpointsGetDefault.json", + "parameters": [ + { + "$id": "796", + "parameter": { + "$ref": "766" + }, + "value": { + "$id": "797", + "kind": "string", + "type": { + "$ref": "767" + }, + "value": "2024-12-01" + } + }, + { + "$id": "798", + "parameter": { + "$ref": "772" + }, + "value": { + "$id": "799", + "kind": "string", + "type": { + "$ref": "773" + }, + "value": "default" + } + }, + { + "$id": "800", + "parameter": { + "$ref": "770" + }, + "value": { + "$id": "801", + "kind": "string", + "type": { + "$ref": "771" + }, + "value": "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine" + } + } + ], + "responses": [ + { + "$id": "802", + "response": { + "$ref": "777" + }, + "statusCode": 200, + "bodyValue": { + "$id": "803", + "kind": "model", + "type": { + "$ref": "497" + }, + "value": { + "$id": "804", + "name": { + "$id": "805", + "kind": "string", + "type": { + "$ref": "87" + }, + "value": "default" + }, + "type": { + "$id": "806", + "kind": "string", + "type": { + "$ref": "91" + }, + "value": "Microsoft.HybridConnectivity/endpoints" + }, + "id": { + "$id": "807", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default" + }, + "properties": { + "$id": "808", + "kind": "model", + "type": { + "$ref": "499" + }, + "value": { + "$id": "809", + "type": { + "$id": "810", + "kind": "string", + "type": { + "$ref": "56" + }, + "value": "default" + } + } + } + } + } + } + ] + } + ] + }, + { + "$id": "811", + "name": "createOrUpdate", + "resourceName": "EndpointResource", + "doc": "Create or update the endpoint to the target resource.", + "accessibility": "public", + "parameters": [ + { + "$id": "812", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "813", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "814", + "type": { + "$id": "815", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-12-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "816", + "name": "resourceUri", + "nameInRequest": "resourceUri", + "doc": "The fully qualified Azure Resource manager identifier of the resource.", + "type": { + "$id": "817", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "818", + "name": "endpointName", + "nameInRequest": "endpointName", + "doc": "The endpoint name.", + "type": { + "$id": "819", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "820", + "name": "contentType", + "nameInRequest": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$id": "821", + "kind": "constant", + "valueType": { + "$id": "822", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": true, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "823", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "824", + "kind": "constant", + "valueType": { + "$id": "825", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "826", + "name": "EndpointResource", + "nameInRequest": "EndpointResource", + "doc": "Endpoint details", + "type": { + "$ref": "497" + }, + "location": "Body", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "827", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "497" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "PUT", + "uri": "{endpoint}", + "path": "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}", + "requestMediaTypes": [ + "application/json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.EndpointResources.createOrUpdate", + "decorators": [], + "examples": [ + { + "$id": "828", + "kind": "http", + "name": "HybridConnectivityEndpointsPutCustom", + "description": "HybridConnectivityEndpointsPutCustom", + "filePath": "2024-12-01/EndpointsPutCustom.json", + "parameters": [ + { + "$id": "829", + "parameter": { + "$ref": "812" + }, + "value": { + "$id": "830", + "kind": "string", + "type": { + "$ref": "813" + }, + "value": "2024-12-01" + } + }, + { + "$id": "831", + "parameter": { + "$ref": "818" + }, + "value": { + "$id": "832", + "kind": "string", + "type": { + "$ref": "819" + }, + "value": "custom" + } + }, + { + "$id": "833", + "parameter": { + "$ref": "816" + }, + "value": { + "$id": "834", + "kind": "string", + "type": { + "$ref": "817" + }, + "value": "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine" + } + } + ], + "responses": [ + { + "$id": "835", + "response": { + "$ref": "827" + }, + "statusCode": 200, + "bodyValue": { + "$id": "836", + "kind": "model", + "type": { + "$ref": "497" + }, + "value": { + "$id": "837", + "name": { + "$id": "838", + "kind": "string", + "type": { + "$ref": "87" + }, + "value": "custom" + }, + "type": { + "$id": "839", + "kind": "string", + "type": { + "$ref": "91" + }, + "value": "Microsoft.HybridConnectivity/endpoints" + }, + "id": { + "$id": "840", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/custom" + }, + "properties": { + "$id": "841", + "kind": "model", + "type": { + "$ref": "499" + }, + "value": { + "$id": "842", + "type": { + "$id": "843", + "kind": "string", + "type": { + "$ref": "56" + }, + "value": "custom" + }, + "provisioningState": { + "$id": "844", + "kind": "string", + "type": { + "$ref": "509" + }, + "value": "Succeeded" + }, + "resourceId": { + "$id": "845", + "kind": "string", + "type": { + "$ref": "504" + }, + "value": "/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.Relay/namespaces/custom-relay-namespace" + } + } + } + } + } + } + ] + }, + { + "$id": "846", + "kind": "http", + "name": "HybridConnectivityEndpointsPutDefault", + "description": "HybridConnectivityEndpointsPutDefault", + "filePath": "2024-12-01/EndpointsPutDefault.json", + "parameters": [ + { + "$id": "847", + "parameter": { + "$ref": "812" + }, + "value": { + "$id": "848", + "kind": "string", + "type": { + "$ref": "813" + }, + "value": "2024-12-01" + } + }, + { + "$id": "849", + "parameter": { + "$ref": "818" + }, + "value": { + "$id": "850", + "kind": "string", + "type": { + "$ref": "819" + }, + "value": "default" + } + }, + { + "$id": "851", + "parameter": { + "$ref": "816" + }, + "value": { + "$id": "852", + "kind": "string", + "type": { + "$ref": "817" + }, + "value": "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine" + } + } + ], + "responses": [ + { + "$id": "853", + "response": { + "$ref": "827" + }, + "statusCode": 200, + "bodyValue": { + "$id": "854", + "kind": "model", + "type": { + "$ref": "497" + }, + "value": { + "$id": "855", + "name": { + "$id": "856", + "kind": "string", + "type": { + "$ref": "87" + }, + "value": "default" + }, + "type": { + "$id": "857", + "kind": "string", + "type": { + "$ref": "91" + }, + "value": "Microsoft.HybridConnectivity/endpoints" + }, + "id": { + "$id": "858", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default" + }, + "properties": { + "$id": "859", + "kind": "model", + "type": { + "$ref": "499" + }, + "value": { + "$id": "860", + "type": { + "$id": "861", + "kind": "string", + "type": { + "$ref": "56" + }, + "value": "default" + }, + "provisioningState": { + "$id": "862", + "kind": "string", + "type": { + "$ref": "509" + }, + "value": "Succeeded" + } + } + } + } + } + } + ] + } + ] + }, + { + "$id": "863", + "name": "update", + "resourceName": "EndpointResource", + "doc": "Update the endpoint to the target resource.", + "accessibility": "public", + "parameters": [ + { + "$id": "864", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "865", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "866", + "type": { + "$id": "867", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-12-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "868", + "name": "resourceUri", + "nameInRequest": "resourceUri", + "doc": "The fully qualified Azure Resource manager identifier of the resource.", + "type": { + "$id": "869", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "870", + "name": "endpointName", + "nameInRequest": "endpointName", + "doc": "The endpoint name.", + "type": { + "$id": "871", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "872", + "name": "contentType", + "nameInRequest": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$id": "873", + "kind": "constant", + "valueType": { + "$id": "874", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": true, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "875", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "876", + "kind": "constant", + "valueType": { + "$id": "877", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "878", + "name": "EndpointResource", + "nameInRequest": "EndpointResource", + "doc": "Endpoint details", + "type": { + "$ref": "497" + }, + "location": "Body", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "879", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "497" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "PATCH", + "uri": "{endpoint}", + "path": "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}", + "requestMediaTypes": [ + "application/json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": false, + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.EndpointResources.update", + "decorators": [], + "examples": [ + { + "$id": "880", + "kind": "http", + "name": "HybridConnectivityEndpointsPatchDefault", + "description": "HybridConnectivityEndpointsPatchDefault", + "filePath": "2024-12-01/EndpointsPatchDefault.json", + "parameters": [ + { + "$id": "881", + "parameter": { + "$ref": "864" + }, + "value": { + "$id": "882", + "kind": "string", + "type": { + "$ref": "865" + }, + "value": "2024-12-01" + } + }, + { + "$id": "883", + "parameter": { + "$ref": "870" + }, + "value": { + "$id": "884", + "kind": "string", + "type": { + "$ref": "871" + }, + "value": "default" + } + }, + { + "$id": "885", + "parameter": { + "$ref": "868" + }, + "value": { + "$id": "886", + "kind": "string", + "type": { + "$ref": "869" + }, + "value": "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine" + } + } + ], + "responses": [ + { + "$id": "887", + "response": { + "$ref": "879" + }, + "statusCode": 200, + "bodyValue": { + "$id": "888", + "kind": "model", + "type": { + "$ref": "497" + }, + "value": { + "$id": "889", + "name": { + "$id": "890", + "kind": "string", + "type": { + "$ref": "87" + }, + "value": "default" + }, + "type": { + "$id": "891", + "kind": "string", + "type": { + "$ref": "91" + }, + "value": "Microsoft.HybridConnectivity/endpoints" + }, + "id": { + "$id": "892", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default" + }, + "properties": { + "$id": "893", + "kind": "model", + "type": { + "$ref": "499" + }, + "value": { + "$id": "894", + "type": { + "$id": "895", + "kind": "string", + "type": { + "$ref": "56" + }, + "value": "default" + }, + "provisioningState": { + "$id": "896", + "kind": "string", + "type": { + "$ref": "509" + }, + "value": "Succeeded" + } + } + } + } + } + } + ] + } + ] + }, + { + "$id": "897", + "name": "delete", + "resourceName": "EndpointResource", + "doc": "Deletes the endpoint access to the target resource.", + "accessibility": "public", + "parameters": [ + { + "$id": "898", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "899", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "900", + "type": { + "$id": "901", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-12-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "902", + "name": "resourceUri", + "nameInRequest": "resourceUri", + "doc": "The fully qualified Azure Resource manager identifier of the resource.", + "type": { + "$id": "903", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "904", + "name": "endpointName", + "nameInRequest": "endpointName", + "doc": "The endpoint name.", + "type": { + "$id": "905", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "906", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "907", + "kind": "constant", + "valueType": { + "$id": "908", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "909", + "statusCodes": [ + 200 + ], + "headers": [], + "isErrorResponse": false + }, + { + "$id": "910", + "statusCodes": [ + 204 + ], + "headers": [], + "isErrorResponse": false + } + ], + "httpMethod": "DELETE", + "uri": "{endpoint}", + "path": "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.EndpointResources.delete", + "decorators": [], + "examples": [ + { + "$id": "911", + "kind": "http", + "name": "HybridConnectivityEndpointsDeleteDefault", + "description": "HybridConnectivityEndpointsDeleteDefault", + "filePath": "2024-12-01/EndpointsDeleteDefault.json", + "parameters": [ + { + "$id": "912", + "parameter": { + "$ref": "898" + }, + "value": { + "$id": "913", + "kind": "string", + "type": { + "$ref": "899" + }, + "value": "2024-12-01" + } + }, + { + "$id": "914", + "parameter": { + "$ref": "904" + }, + "value": { + "$id": "915", + "kind": "string", + "type": { + "$ref": "905" + }, + "value": "default" + } + }, + { + "$id": "916", + "parameter": { + "$ref": "902" + }, + "value": { + "$id": "917", + "kind": "string", + "type": { + "$ref": "903" + }, + "value": "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine" + } + } + ], + "responses": [ + { + "$id": "918", + "response": { + "$ref": "909" + }, + "statusCode": 200 + }, + { + "$id": "919", + "response": { + "$ref": "910" + }, + "statusCode": 204 + } + ] + } + ] + }, + { + "$id": "920", + "name": "list", + "resourceName": "EndpointResource", + "doc": "List of endpoints to the target resource.", + "accessibility": "public", + "parameters": [ + { + "$id": "921", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "922", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "923", + "type": { + "$id": "924", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-12-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "925", + "name": "resourceUri", + "nameInRequest": "resourceUri", + "doc": "The fully qualified Azure Resource manager identifier of the resource.", + "type": { + "$id": "926", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "927", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "928", + "kind": "constant", + "valueType": { + "$id": "929", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "930", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "514" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints", + "bufferResponse": true, + "paging": { + "$id": "931", + "itemPropertySegments": [ + "value" + ], + "nextLink": { + "$id": "932", + "responseSegments": [ + "nextLink" + ], + "responseLocation": "Body" + } + }, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.EndpointResources.list", + "decorators": [], + "examples": [ + { + "$id": "933", + "kind": "http", + "name": "HybridConnectivityEndpointsGet", + "description": "HybridConnectivityEndpointsGet", + "filePath": "2024-12-01/EndpointsList.json", + "parameters": [ + { + "$id": "934", + "parameter": { + "$ref": "921" + }, + "value": { + "$id": "935", + "kind": "string", + "type": { + "$ref": "922" + }, + "value": "2024-12-01" + } + }, + { + "$id": "936", + "parameter": { + "$ref": "925" + }, + "value": { + "$id": "937", + "kind": "string", + "type": { + "$ref": "926" + }, + "value": "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine" + } + } + ], + "responses": [ + { + "$id": "938", + "response": { + "$ref": "930" + }, + "statusCode": 200, + "bodyValue": { + "$id": "939", + "kind": "model", + "type": { + "$ref": "514" + }, + "value": { + "$id": "940", + "value": { + "$id": "941", + "kind": "array", + "type": { + "$ref": "516" + }, + "value": [ + { + "$id": "942", + "kind": "model", + "type": { + "$ref": "497" + }, + "value": { + "$id": "943", + "name": { + "$id": "944", + "kind": "string", + "type": { + "$ref": "87" + }, + "value": "default" + }, + "type": { + "$id": "945", + "kind": "string", + "type": { + "$ref": "91" + }, + "value": "Microsoft.HybridConnectivity/endpoints" + }, + "id": { + "$id": "946", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default" + }, + "properties": { + "$id": "947", + "kind": "model", + "type": { + "$ref": "499" + }, + "value": { + "$id": "948", + "type": { + "$id": "949", + "kind": "string", + "type": { + "$ref": "56" + }, + "value": "default" + } + } + } + } + }, + { + "$id": "950", + "kind": "model", + "type": { + "$ref": "497" + }, + "value": { + "$id": "951", + "name": { + "$id": "952", + "kind": "string", + "type": { + "$ref": "87" + }, + "value": "custom" + }, + "type": { + "$id": "953", + "kind": "string", + "type": { + "$ref": "91" + }, + "value": "Microsoft.HybridConnectivity/endpoints" + }, + "id": { + "$id": "954", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/custom" + }, + "properties": { + "$id": "955", + "kind": "model", + "type": { + "$ref": "499" + }, + "value": { + "$id": "956", + "type": { + "$id": "957", + "kind": "string", + "type": { + "$ref": "56" + }, + "value": "custom" + }, + "resourceId": { + "$id": "958", + "kind": "string", + "type": { + "$ref": "504" + }, + "value": "/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.Relay/namespaces/custom-relay-namespace" + } + } + } + } + } + ] + } + } + } + } + ] + } + ] + }, + { + "$id": "959", + "name": "listCredentials", + "resourceName": "EndpointResources", + "doc": "Gets the endpoint access credentials to the resource.", + "accessibility": "public", + "parameters": [ + { + "$id": "960", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "961", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "962", + "type": { + "$id": "963", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-12-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "964", + "name": "resourceUri", + "nameInRequest": "resourceUri", + "doc": "The fully qualified Azure Resource manager identifier of the resource.", + "type": { + "$id": "965", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "966", + "name": "endpointName", + "nameInRequest": "endpointName", + "doc": "The endpoint name.", + "type": { + "$id": "967", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "968", + "name": "expiresin", + "nameInRequest": "expiresin", + "doc": "The is how long the endpoint access token is valid (in seconds).", + "type": { + "$id": "969", + "kind": "int64", + "name": "int64", + "crossLanguageDefinitionId": "TypeSpec.int64", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "970", + "name": "contentType", + "nameInRequest": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$id": "971", + "kind": "constant", + "valueType": { + "$id": "972", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": true, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "973", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "974", + "kind": "constant", + "valueType": { + "$id": "975", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "976", + "name": "ListCredentialsRequest", + "nameInRequest": "ListCredentialsRequest", + "doc": "Object of type ListCredentialsRequest", + "type": { + "$ref": "524" + }, + "location": "Body", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "977", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "528" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "POST", + "uri": "{endpoint}", + "path": "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/listCredentials", + "requestMediaTypes": [ + "application/json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.EndpointResources.listCredentials", + "decorators": [], + "examples": [ + { + "$id": "978", + "kind": "http", + "name": "HybridConnectivityEndpointsPostListCredentials", + "description": "HybridConnectivityEndpointsPostListCredentials", + "filePath": "2024-12-01/EndpointsPostListCredentials.json", + "parameters": [ + { + "$id": "979", + "parameter": { + "$ref": "976" + }, + "value": { + "$id": "980", + "kind": "model", + "type": { + "$ref": "524" + }, + "value": { + "$id": "981", + "serviceName": { + "$id": "982", + "kind": "string", + "type": { + "$ref": "38" + }, + "value": "SSH" + } + } + } + }, + { + "$id": "983", + "parameter": { + "$ref": "960" + }, + "value": { + "$id": "984", + "kind": "string", + "type": { + "$ref": "961" + }, + "value": "2024-12-01" + } + }, + { + "$id": "985", + "parameter": { + "$ref": "966" + }, + "value": { + "$id": "986", + "kind": "string", + "type": { + "$ref": "967" + }, + "value": "default" + } + }, + { + "$id": "987", + "parameter": { + "$ref": "968" + }, + "value": { + "$id": "988", + "kind": "number", + "type": { + "$ref": "969" + }, + "value": 10800 + } + }, + { + "$id": "989", + "parameter": { + "$ref": "964" + }, + "value": { + "$id": "990", + "kind": "string", + "type": { + "$ref": "965" + }, + "value": "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine" + } + } + ], + "responses": [ + { + "$id": "991", + "response": { + "$ref": "977" + }, + "statusCode": 200, + "bodyValue": { + "$id": "992", + "kind": "model", + "type": { + "$ref": "528" + }, + "value": { + "$id": "993", + "relay": { + "$id": "994", + "kind": "model", + "type": { + "$ref": "530" + }, + "value": { + "$id": "995", + "accessKey": { + "$id": "996", + "kind": "string", + "type": { + "$ref": "544" + }, + "value": "SharedAccessSignature sr=http%3A%2F%2Fazgnrelay-eastus-l1.servicebus.windows.net%2Fmicrosoft.kubernetes%2Fconnectedclusters%2Fa0e1fd7d1d974ddf6b11a952d67679c9f12c006eee16861857a8268da4eb1498%2F1619989456957411072%2F&sig=WxDwPF6AmmODaMHNnBGDSm773UG%2B%2Be" + }, + "expiresOn": { + "$id": "997", + "kind": "number", + "type": { + "$ref": "548" + }, + "value": 1620000256 + }, + "hybridConnectionName": { + "$id": "998", + "kind": "string", + "type": { + "$ref": "540" + }, + "value": "microsoft.kubernetes/connectedclusters/a0e1fd7d1d974ddf6b11a952d67679c9f12c006eee16861857a8268da4eb1498/1619989456957411072" + }, + "namespaceName": { + "$id": "999", + "kind": "string", + "type": { + "$ref": "532" + }, + "value": "azgnrelay-eastus-l1" + }, + "namespaceNameSuffix": { + "$id": "1000", + "kind": "string", + "type": { + "$ref": "536" + }, + "value": "servicebus.windows.net" + }, + "serviceConfigurationToken": { + "$id": "1001", + "kind": "string", + "type": { + "$ref": "552" + }, + "value": "SSHvjqH=pTlKql=RtMGw/-k5VFBxSYHIiq5ZgbGFcLkNrDNz5fDsinCN2zkG" + } + } + } + } + } + } + ] + } + ] + }, + { + "$id": "1002", + "name": "listIngressGatewayCredentials", + "resourceName": "EndpointResources", + "doc": "Gets the ingress gateway endpoint credentials ", + "accessibility": "public", + "parameters": [ + { + "$id": "1003", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1004", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1005", + "type": { + "$id": "1006", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-12-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1007", + "name": "resourceUri", + "nameInRequest": "resourceUri", + "doc": "The fully qualified Azure Resource manager identifier of the resource.", + "type": { + "$id": "1008", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "1009", + "name": "endpointName", + "nameInRequest": "endpointName", + "doc": "The endpoint name.", + "type": { + "$id": "1010", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "1011", + "name": "expiresin", + "nameInRequest": "expiresin", + "doc": "The is how long the endpoint access token is valid (in seconds).", + "type": { + "$id": "1012", + "kind": "int64", + "name": "int64", + "crossLanguageDefinitionId": "TypeSpec.int64", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1013", + "name": "contentType", + "nameInRequest": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$id": "1014", + "kind": "constant", + "valueType": { + "$id": "1015", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": true, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1016", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1017", + "kind": "constant", + "valueType": { + "$id": "1018", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1019", + "name": "ListIngressGatewayCredentialsRequest", + "nameInRequest": "ListIngressGatewayCredentialsRequest", + "doc": "Object of type ListIngressGatewayCredentialsRequest", + "type": { + "$ref": "557" + }, + "location": "Body", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1020", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "561" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "POST", + "uri": "{endpoint}", + "path": "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/listIngressGatewayCredentials", + "requestMediaTypes": [ + "application/json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.EndpointResources.listIngressGatewayCredentials", + "decorators": [], + "examples": [ + { + "$id": "1021", + "kind": "http", + "name": "HybridConnectivityEndpointsPostListIngressGatewayCredentials", + "description": "HybridConnectivityEndpointsPostListIngressGatewayCredentials", + "filePath": "2024-12-01/EndpointsPostListIngressGatewayCredentials.json", + "parameters": [ + { + "$id": "1022", + "parameter": { + "$ref": "1003" + }, + "value": { + "$id": "1023", + "kind": "string", + "type": { + "$ref": "1004" + }, + "value": "2024-12-01" + } + }, + { + "$id": "1024", + "parameter": { + "$ref": "1009" + }, + "value": { + "$id": "1025", + "kind": "string", + "type": { + "$ref": "1010" + }, + "value": "default" + } + }, + { + "$id": "1026", + "parameter": { + "$ref": "1011" + }, + "value": { + "$id": "1027", + "kind": "number", + "type": { + "$ref": "1012" + }, + "value": 10800 + } + }, + { + "$id": "1028", + "parameter": { + "$ref": "1007" + }, + "value": { + "$id": "1029", + "kind": "string", + "type": { + "$ref": "1008" + }, + "value": "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/arcGroup/providers/Microsoft.ArcPlaceHolder/ProvisionedClusters/cluster0" + } + } + ], + "responses": [ + { + "$id": "1030", + "response": { + "$ref": "1020" + }, + "statusCode": 200, + "bodyValue": { + "$id": "1031", + "kind": "model", + "type": { + "$ref": "561" + }, + "value": { + "$id": "1032", + "ingress": { + "$id": "1033", + "kind": "model", + "type": { + "$ref": "566" + }, + "value": { + "$id": "1034", + "aadProfile": { + "$id": "1035", + "kind": "model", + "type": { + "$ref": "572" + }, + "value": { + "$id": "1036", + "serverId": { + "$id": "1037", + "kind": "string", + "type": { + "$ref": "574" + }, + "value": "6256c85f-0aad-4d50-b960-e6e9b21efe35" + }, + "tenantId": { + "$id": "1038", + "kind": "string", + "type": { + "$ref": "579" + }, + "value": "33e01921-4d64-4f8c-a055-5bdaffd5e33d" + } + } + }, + "hostname": { + "$id": "1039", + "kind": "string", + "type": { + "$ref": "568" + }, + "value": "clusterhostname" + } + } + }, + "relay": { + "$id": "1040", + "kind": "model", + "type": { + "$ref": "530" + }, + "value": { + "$id": "1041", + "accessKey": { + "$id": "1042", + "kind": "string", + "type": { + "$ref": "544" + }, + "value": "SharedAccessSignature sr=http%3A%2F%2Fazgnrelay-eastus-l1.servicebus.windows.net%2Fmicrosoft.provisionedcluster%hci" + }, + "expiresOn": { + "$id": "1043", + "kind": "number", + "type": { + "$ref": "548" + }, + "value": 1620000256 + }, + "hybridConnectionName": { + "$id": "1044", + "kind": "string", + "type": { + "$ref": "540" + }, + "value": "microsoft.arcplaceholder/provisionedclusters/000/1619989456957411072" + }, + "namespaceName": { + "$id": "1045", + "kind": "string", + "type": { + "$ref": "532" + }, + "value": "relaynamespace" + }, + "namespaceNameSuffix": { + "$id": "1046", + "kind": "string", + "type": { + "$ref": "536" + }, + "value": "servicebus.windows.net" + }, + "serviceConfigurationToken": { + "$id": "1047", + "kind": "string", + "type": { + "$ref": "552" + }, + "value": "SSHvjqH=pTlKql=RtMGw/-k5VFBxSYHIiq5ZgbGFcLkNrDNz5fDsinCN2zkG" + } + } + } + } + } + } + ] + } + ] + }, + { + "$id": "1048", + "name": "listManagedProxyDetails", + "resourceName": "EndpointResources", + "doc": "Fetches the managed proxy details ", + "accessibility": "public", + "parameters": [ + { + "$id": "1049", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1050", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1051", + "type": { + "$id": "1052", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-12-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1053", + "name": "resourceUri", + "nameInRequest": "resourceUri", + "doc": "The fully qualified Azure Resource manager identifier of the resource.", + "type": { + "$id": "1054", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "1055", + "name": "endpointName", + "nameInRequest": "endpointName", + "doc": "The endpoint name.", + "type": { + "$id": "1056", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "1057", + "name": "contentType", + "nameInRequest": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$id": "1058", + "kind": "constant", + "valueType": { + "$id": "1059", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": true, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1060", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1061", + "kind": "constant", + "valueType": { + "$id": "1062", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1063", + "name": "ManagedProxyRequest", + "nameInRequest": "ManagedProxyRequest", + "doc": "Object of type ManagedProxyRequest", + "type": { + "$ref": "587" + }, + "location": "Body", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1064", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "599" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "POST", + "uri": "{endpoint}", + "path": "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/listManagedProxyDetails", + "requestMediaTypes": [ + "application/json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.EndpointResources.listManagedProxyDetails", + "decorators": [], + "examples": [ + { + "$id": "1065", + "kind": "http", + "name": "HybridConnectivityEndpointsPostListManagedProxyDetails", + "description": "HybridConnectivityEndpointsPostListManagedProxyDetails", + "filePath": "2024-12-01/EndpointsPostListManagedProxyDetails.json", + "parameters": [ + { + "$id": "1066", + "parameter": { + "$ref": "1049" + }, + "value": { + "$id": "1067", + "kind": "string", + "type": { + "$ref": "1050" + }, + "value": "2024-12-01" + } + }, + { + "$id": "1068", + "parameter": { + "$ref": "1055" + }, + "value": { + "$id": "1069", + "kind": "string", + "type": { + "$ref": "1056" + }, + "value": "default" + } + }, + { + "$id": "1070", + "parameter": { + "$ref": "1053" + }, + "value": { + "$id": "1071", + "kind": "string", + "type": { + "$ref": "1054" + }, + "value": "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/arcGroup/providers/Microsoft.Compute/virtualMachines/vm00006" + } + } + ], + "responses": [ + { + "$id": "1072", + "response": { + "$ref": "1064" + }, + "statusCode": 200, + "bodyValue": { + "$id": "1073", + "kind": "model", + "type": { + "$ref": "599" + }, + "value": { + "$id": "1074", + "expiresOn": { + "$id": "1075", + "kind": "number", + "type": { + "$ref": "605" + }, + "value": 1620000256 + }, + "proxy": { + "$id": "1076", + "kind": "string", + "type": { + "$ref": "601" + }, + "value": "uid.r.proxy.arc.com" + } + } + } + } + ] + } + ] + } + ], + "parameters": [ + { + "$id": "1077", + "name": "endpoint", + "nameInRequest": "endpoint", + "doc": "Service host", + "type": { + "$id": "1078", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url" + }, + "location": "Uri", + "isApiVersion": false, + "isContentType": false, + "isRequired": true, + "isEndpoint": true, + "skipUrlEncoding": false, + "explode": false, + "kind": "Client", + "defaultValue": { + "$id": "1079", + "type": { + "$id": "1080", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "https://management.azure.com" + } + } + ], + "decorators": [ + { + "$id": "1081", + "name": "Azure.ResourceManager.@armResourceOperations", + "arguments": { + "$id": "1082" + } + } + ], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.EndpointResources", + "apiVersions": [ + "2024-12-01" + ], + "parent": { + "$ref": "653" + } + }, + { + "$id": "1083", + "kind": "client", + "name": "ServiceConfigurationResources", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "operations": [ + { + "$id": "1084", + "name": "get", + "resourceName": "ServiceConfigurationResource", + "doc": "Gets the details about the service to the resource.", + "accessibility": "public", + "parameters": [ + { + "$id": "1085", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1086", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1087", + "type": { + "$id": "1088", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-12-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1089", + "name": "resourceUri", + "nameInRequest": "resourceUri", + "doc": "The fully qualified Azure Resource manager identifier of the resource.", + "type": { + "$id": "1090", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "1091", + "name": "endpointName", + "nameInRequest": "endpointName", + "doc": "The endpoint name.", + "type": { + "$id": "1092", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "1093", + "name": "serviceConfigurationName", + "nameInRequest": "serviceConfigurationName", + "doc": "The service name.", + "type": { + "$id": "1094", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "1095", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1096", + "kind": "constant", + "valueType": { + "$id": "1097", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1098", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "458" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations/{serviceConfigurationName}", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.ServiceConfigurationResources.get", + "decorators": [], + "examples": [ + { + "$id": "1099", + "kind": "http", + "name": "HybridConnectivityEndpointsServiceconfigurationsGetSSH", + "description": "HybridConnectivityEndpointsServiceconfigurationsGetSSH", + "filePath": "2024-12-01/ServiceConfigurationsGetSSH.json", + "parameters": [ + { + "$id": "1100", + "parameter": { + "$ref": "1085" + }, + "value": { + "$id": "1101", + "kind": "string", + "type": { + "$ref": "1086" + }, + "value": "2024-12-01" + } + }, + { + "$id": "1102", + "parameter": { + "$ref": "1091" + }, + "value": { + "$id": "1103", + "kind": "string", + "type": { + "$ref": "1092" + }, + "value": "default" + } + }, + { + "$id": "1104", + "parameter": { + "$ref": "1089" + }, + "value": { + "$id": "1105", + "kind": "string", + "type": { + "$ref": "1090" + }, + "value": "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default" + } + }, + { + "$id": "1106", + "parameter": { + "$ref": "1093" + }, + "value": { + "$id": "1107", + "kind": "string", + "type": { + "$ref": "1094" + }, + "value": "SSH" + } + } + ], + "responses": [ + { + "$id": "1108", + "response": { + "$ref": "1098" + }, + "statusCode": 200, + "bodyValue": { + "$id": "1109", + "kind": "model", + "type": { + "$ref": "458" + }, + "value": { + "$id": "1110", + "type": { + "$id": "1111", + "kind": "string", + "type": { + "$ref": "91" + }, + "value": "Microsoft.HybridConnectivity/endpoints/serviceConfigurations" + }, + "id": { + "$id": "1112", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default/serviceconfigurations/SSH" + }, + "properties": { + "$id": "1113", + "kind": "model", + "type": { + "$ref": "460" + }, + "value": { + "$id": "1114", + "port": { + "$id": "1115", + "kind": "number", + "type": { + "$ref": "470" + }, + "value": 22 + }, + "serviceName": { + "$id": "1116", + "kind": "string", + "type": { + "$ref": "38" + }, + "value": "SSH" + } + } + } + } + } + } + ] + }, + { + "$id": "1117", + "kind": "http", + "name": "HybridConnectivityEndpointsServiceconfigurationsGetWAC", + "description": "HybridConnectivityEndpointsServiceconfigurationsGetWAC", + "filePath": "2024-12-01/ServiceConfigurationsGetWAC.json", + "parameters": [ + { + "$id": "1118", + "parameter": { + "$ref": "1085" + }, + "value": { + "$id": "1119", + "kind": "string", + "type": { + "$ref": "1086" + }, + "value": "2024-12-01" + } + }, + { + "$id": "1120", + "parameter": { + "$ref": "1091" + }, + "value": { + "$id": "1121", + "kind": "string", + "type": { + "$ref": "1092" + }, + "value": "default" + } + }, + { + "$id": "1122", + "parameter": { + "$ref": "1089" + }, + "value": { + "$id": "1123", + "kind": "string", + "type": { + "$ref": "1090" + }, + "value": "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default" + } + }, + { + "$id": "1124", + "parameter": { + "$ref": "1093" + }, + "value": { + "$id": "1125", + "kind": "string", + "type": { + "$ref": "1094" + }, + "value": "WAC" + } + } + ], + "responses": [ + { + "$id": "1126", + "response": { + "$ref": "1098" + }, + "statusCode": 200, + "bodyValue": { + "$id": "1127", + "kind": "model", + "type": { + "$ref": "458" + }, + "value": { + "$id": "1128", + "type": { + "$id": "1129", + "kind": "string", + "type": { + "$ref": "91" + }, + "value": "Microsoft.HybridConnectivity/endpoints/serviceConfigurations" + }, + "id": { + "$id": "1130", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default/serviceconfigurations/WAC" + }, + "properties": { + "$id": "1131", + "kind": "model", + "type": { + "$ref": "460" + }, + "value": { + "$id": "1132", + "port": { + "$id": "1133", + "kind": "number", + "type": { + "$ref": "470" + }, + "value": 6516 + }, + "serviceName": { + "$id": "1134", + "kind": "string", + "type": { + "$ref": "38" + }, + "value": "WAC" + } + } + } + } + } + } + ] + } + ] + }, + { + "$id": "1135", + "name": "createOrupdate", + "resourceName": "ServiceConfigurationResource", + "doc": "Create or update a service in serviceConfiguration for the endpoint resource.", + "accessibility": "public", + "parameters": [ + { + "$id": "1136", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1137", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1138", + "type": { + "$id": "1139", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-12-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1140", + "name": "resourceUri", + "nameInRequest": "resourceUri", + "doc": "The fully qualified Azure Resource manager identifier of the resource.", + "type": { + "$id": "1141", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "1142", + "name": "endpointName", + "nameInRequest": "endpointName", + "doc": "The endpoint name.", + "type": { + "$id": "1143", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "1144", + "name": "serviceConfigurationName", + "nameInRequest": "serviceConfigurationName", + "doc": "The service name.", + "type": { + "$id": "1145", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "1146", + "name": "contentType", + "nameInRequest": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$id": "1147", + "kind": "constant", + "valueType": { + "$id": "1148", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": true, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1149", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1150", + "kind": "constant", + "valueType": { + "$id": "1151", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1152", + "name": "ServiceConfigurationResource", + "nameInRequest": "ServiceConfigurationResource", + "doc": "Service details", + "type": { + "$ref": "458" + }, + "location": "Body", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1153", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "458" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + { + "$id": "1154", + "statusCodes": [ + 201 + ], + "bodyType": { + "$ref": "458" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "PUT", + "uri": "{endpoint}", + "path": "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations/{serviceConfigurationName}", + "requestMediaTypes": [ + "application/json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.ServiceConfigurationResources.createOrupdate", + "decorators": [], + "examples": [ + { + "$id": "1155", + "kind": "http", + "name": "ServiceConfigurationsPutSSH", + "description": "ServiceConfigurationsPutSSH", + "filePath": "2024-12-01/ServiceConfigurationsPutSSH.json", + "parameters": [ + { + "$id": "1156", + "parameter": { + "$ref": "1136" + }, + "value": { + "$id": "1157", + "kind": "string", + "type": { + "$ref": "1137" + }, + "value": "2024-12-01" + } + }, + { + "$id": "1158", + "parameter": { + "$ref": "1142" + }, + "value": { + "$id": "1159", + "kind": "string", + "type": { + "$ref": "1143" + }, + "value": "default" + } + }, + { + "$id": "1160", + "parameter": { + "$ref": "1140" + }, + "value": { + "$id": "1161", + "kind": "string", + "type": { + "$ref": "1141" + }, + "value": "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default" + } + }, + { + "$id": "1162", + "parameter": { + "$ref": "1144" + }, + "value": { + "$id": "1163", + "kind": "string", + "type": { + "$ref": "1145" + }, + "value": "SSH" + } + } + ], + "responses": [ + { + "$id": "1164", + "response": { + "$ref": "1153" + }, + "statusCode": 200, + "bodyValue": { + "$id": "1165", + "kind": "model", + "type": { + "$ref": "458" + }, + "value": { + "$id": "1166", + "type": { + "$id": "1167", + "kind": "string", + "type": { + "$ref": "91" + }, + "value": "Microsoft.HybridConnectivity/endpoints/serviceConfigurations" + }, + "id": { + "$id": "1168", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default/serviceconfigurations/SSH" + }, + "properties": { + "$id": "1169", + "kind": "model", + "type": { + "$ref": "460" + }, + "value": { + "$id": "1170", + "port": { + "$id": "1171", + "kind": "number", + "type": { + "$ref": "470" + }, + "value": 22 + }, + "provisioningState": { + "$id": "1172", + "kind": "string", + "type": { + "$ref": "44" + }, + "value": "Succeeded" + }, + "serviceName": { + "$id": "1173", + "kind": "string", + "type": { + "$ref": "38" + }, + "value": "SSH" + } + } + } + } + } + }, + { + "$id": "1174", + "response": { + "$ref": "1154" + }, + "statusCode": 201, + "bodyValue": { + "$id": "1175", + "kind": "model", + "type": { + "$ref": "458" + }, + "value": { + "$id": "1176", + "type": { + "$id": "1177", + "kind": "string", + "type": { + "$ref": "91" + }, + "value": "Microsoft.HybridConnectivity/endpoints/serviceConfigurations" + }, + "id": { + "$id": "1178", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default/serviceconfigurations/SSH" + }, + "properties": { + "$id": "1179", + "kind": "model", + "type": { + "$ref": "460" + }, + "value": { + "$id": "1180", + "port": { + "$id": "1181", + "kind": "number", + "type": { + "$ref": "470" + }, + "value": 22 + }, + "provisioningState": { + "$id": "1182", + "kind": "string", + "type": { + "$ref": "44" + }, + "value": "Succeeded" + }, + "serviceName": { + "$id": "1183", + "kind": "string", + "type": { + "$ref": "38" + }, + "value": "SSH" + } + } + } + } + } + } + ] + }, + { + "$id": "1184", + "kind": "http", + "name": "ServiceConfigurationsPutWAC", + "description": "ServiceConfigurationsPutWAC", + "filePath": "2024-12-01/ServiceConfigurationsPutWAC.json", + "parameters": [ + { + "$id": "1185", + "parameter": { + "$ref": "1136" + }, + "value": { + "$id": "1186", + "kind": "string", + "type": { + "$ref": "1137" + }, + "value": "2024-12-01" + } + }, + { + "$id": "1187", + "parameter": { + "$ref": "1142" + }, + "value": { + "$id": "1188", + "kind": "string", + "type": { + "$ref": "1143" + }, + "value": "default" + } + }, + { + "$id": "1189", + "parameter": { + "$ref": "1140" + }, + "value": { + "$id": "1190", + "kind": "string", + "type": { + "$ref": "1141" + }, + "value": "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default" + } + }, + { + "$id": "1191", + "parameter": { + "$ref": "1144" + }, + "value": { + "$id": "1192", + "kind": "string", + "type": { + "$ref": "1145" + }, + "value": "WAC" + } + } + ], + "responses": [ + { + "$id": "1193", + "response": { + "$ref": "1153" + }, + "statusCode": 200, + "bodyValue": { + "$id": "1194", + "kind": "model", + "type": { + "$ref": "458" + }, + "value": { + "$id": "1195", + "type": { + "$id": "1196", + "kind": "string", + "type": { + "$ref": "91" + }, + "value": "Microsoft.HybridConnectivity/endpoints/serviceConfigurations" + }, + "id": { + "$id": "1197", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default/serviceconfigurations/WAC" + }, + "properties": { + "$id": "1198", + "kind": "model", + "type": { + "$ref": "460" + }, + "value": { + "$id": "1199", + "port": { + "$id": "1200", + "kind": "number", + "type": { + "$ref": "470" + }, + "value": 6516 + }, + "provisioningState": { + "$id": "1201", + "kind": "string", + "type": { + "$ref": "44" + }, + "value": "Succeeded" + }, + "serviceName": { + "$id": "1202", + "kind": "string", + "type": { + "$ref": "38" + }, + "value": "WAC" + } + } + } + } + } + }, + { + "$id": "1203", + "response": { + "$ref": "1154" + }, + "statusCode": 201, + "bodyValue": { + "$id": "1204", + "kind": "model", + "type": { + "$ref": "458" + }, + "value": { + "$id": "1205", + "type": { + "$id": "1206", + "kind": "string", + "type": { + "$ref": "91" + }, + "value": "Microsoft.HybridConnectivity/endpoints/serviceConfigurations" + }, + "id": { + "$id": "1207", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default/serviceconfigurations/WAC" + }, + "properties": { + "$id": "1208", + "kind": "model", + "type": { + "$ref": "460" + }, + "value": { + "$id": "1209", + "port": { + "$id": "1210", + "kind": "number", + "type": { + "$ref": "470" + }, + "value": 6516 + }, + "provisioningState": { + "$id": "1211", + "kind": "string", + "type": { + "$ref": "44" + }, + "value": "Succeeded" + }, + "serviceName": { + "$id": "1212", + "kind": "string", + "type": { + "$ref": "38" + }, + "value": "WAC" + } + } + } + } + } + } + ] + } + ] + }, + { + "$id": "1213", + "name": "update", + "resourceName": "ServiceConfigurationResource", + "doc": "Update the service details in the service configurations of the target resource.", + "accessibility": "public", + "parameters": [ + { + "$id": "1214", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1215", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1216", + "type": { + "$id": "1217", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-12-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1218", + "name": "resourceUri", + "nameInRequest": "resourceUri", + "doc": "The fully qualified Azure Resource manager identifier of the resource.", + "type": { + "$id": "1219", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "1220", + "name": "endpointName", + "nameInRequest": "endpointName", + "doc": "The endpoint name.", + "type": { + "$id": "1221", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "1222", + "name": "serviceConfigurationName", + "nameInRequest": "serviceConfigurationName", + "doc": "The service name.", + "type": { + "$id": "1223", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "1224", + "name": "contentType", + "nameInRequest": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$id": "1225", + "kind": "constant", + "valueType": { + "$id": "1226", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": true, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1227", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1228", + "kind": "constant", + "valueType": { + "$id": "1229", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1230", + "name": "ServiceConfigurationResource", + "nameInRequest": "ServiceConfigurationResource", + "doc": "Service details", + "type": { + "$ref": "478" + }, + "location": "Body", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1231", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "458" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "PATCH", + "uri": "{endpoint}", + "path": "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations/{serviceConfigurationName}", + "requestMediaTypes": [ + "application/json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": false, + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.ServiceConfigurationResources.update", + "decorators": [], + "examples": [ + { + "$id": "1232", + "kind": "http", + "name": "ServiceConfigurationsPatchSSH", + "description": "ServiceConfigurationsPatchSSH", + "filePath": "2024-12-01/ServiceConfigurationsPatchSSH.json", + "parameters": [ + { + "$id": "1233", + "parameter": { + "$ref": "1214" + }, + "value": { + "$id": "1234", + "kind": "string", + "type": { + "$ref": "1215" + }, + "value": "2024-12-01" + } + }, + { + "$id": "1235", + "parameter": { + "$ref": "1220" + }, + "value": { + "$id": "1236", + "kind": "string", + "type": { + "$ref": "1221" + }, + "value": "default" + } + }, + { + "$id": "1237", + "parameter": { + "$ref": "1218" + }, + "value": { + "$id": "1238", + "kind": "string", + "type": { + "$ref": "1219" + }, + "value": "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default" + } + }, + { + "$id": "1239", + "parameter": { + "$ref": "1222" + }, + "value": { + "$id": "1240", + "kind": "string", + "type": { + "$ref": "1223" + }, + "value": "SSH" + } + } + ], + "responses": [ + { + "$id": "1241", + "response": { + "$ref": "1231" + }, + "statusCode": 200, + "bodyValue": { + "$id": "1242", + "kind": "model", + "type": { + "$ref": "458" + }, + "value": { + "$id": "1243", + "id": { + "$id": "1244", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default/serviceConfigurations/SSH" + }, + "properties": { + "$id": "1245", + "kind": "model", + "type": { + "$ref": "460" + }, + "value": { + "$id": "1246", + "port": { + "$id": "1247", + "kind": "number", + "type": { + "$ref": "470" + }, + "value": 22 + }, + "serviceName": { + "$id": "1248", + "kind": "string", + "type": { + "$ref": "38" + }, + "value": "SSH" + } + } + } + } + } + } + ] + } + ] + }, + { + "$id": "1249", + "name": "delete", + "resourceName": "ServiceConfigurationResource", + "doc": "Deletes the service details to the target resource.", + "accessibility": "public", + "parameters": [ + { + "$id": "1250", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1251", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1252", + "type": { + "$id": "1253", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-12-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1254", + "name": "resourceUri", + "nameInRequest": "resourceUri", + "doc": "The fully qualified Azure Resource manager identifier of the resource.", + "type": { + "$id": "1255", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "1256", + "name": "endpointName", + "nameInRequest": "endpointName", + "doc": "The endpoint name.", + "type": { + "$id": "1257", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "1258", + "name": "serviceConfigurationName", + "nameInRequest": "serviceConfigurationName", + "doc": "The service name.", + "type": { + "$id": "1259", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "1260", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1261", + "kind": "constant", + "valueType": { + "$id": "1262", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1263", + "statusCodes": [ + 200 + ], + "headers": [], + "isErrorResponse": false + }, + { + "$id": "1264", + "statusCodes": [ + 204 + ], + "headers": [], + "isErrorResponse": false + } + ], + "httpMethod": "DELETE", + "uri": "{endpoint}", + "path": "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations/{serviceConfigurationName}", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.ServiceConfigurationResources.delete", + "decorators": [], + "examples": [ + { + "$id": "1265", + "kind": "http", + "name": "ServiceConfigurationsDeleteSSH", + "description": "ServiceConfigurationsDeleteSSH", + "filePath": "2024-12-01/ServiceConfigurationsDeleteSSH.json", + "parameters": [ + { + "$id": "1266", + "parameter": { + "$ref": "1250" + }, + "value": { + "$id": "1267", + "kind": "string", + "type": { + "$ref": "1251" + }, + "value": "2024-12-01" + } + }, + { + "$id": "1268", + "parameter": { + "$ref": "1256" + }, + "value": { + "$id": "1269", + "kind": "string", + "type": { + "$ref": "1257" + }, + "value": "default" + } + }, + { + "$id": "1270", + "parameter": { + "$ref": "1254" + }, + "value": { + "$id": "1271", + "kind": "string", + "type": { + "$ref": "1255" + }, + "value": "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default" + } + }, + { + "$id": "1272", + "parameter": { + "$ref": "1258" + }, + "value": { + "$id": "1273", + "kind": "string", + "type": { + "$ref": "1259" + }, + "value": "SSH" + } + } + ], + "responses": [ + { + "$id": "1274", + "response": { + "$ref": "1263" + }, + "statusCode": 200 + }, + { + "$id": "1275", + "response": { + "$ref": "1264" + }, + "statusCode": 204 + } + ] + } + ] + }, + { + "$id": "1276", + "name": "listByEndpointResource", + "resourceName": "ServiceConfigurationResource", + "summary": "Lists of all the services associated with endpoint resource.", + "doc": "API to enumerate registered services in service configurations under a Endpoint Resource", + "accessibility": "public", + "parameters": [ + { + "$id": "1277", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1278", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1279", + "type": { + "$id": "1280", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-12-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1281", + "name": "resourceUri", + "nameInRequest": "resourceUri", + "doc": "The fully qualified Azure Resource manager identifier of the resource.", + "type": { + "$id": "1282", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "1283", + "name": "endpointName", + "nameInRequest": "endpointName", + "doc": "The endpoint name.", + "type": { + "$id": "1284", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "1285", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1286", + "kind": "constant", + "valueType": { + "$id": "1287", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1288", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "487" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations", + "bufferResponse": true, + "paging": { + "$id": "1289", + "itemPropertySegments": [ + "value" + ], + "nextLink": { + "$id": "1290", + "responseSegments": [ + "nextLink" + ], + "responseLocation": "Body" + } + }, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.ServiceConfigurationResources.listByEndpointResource", + "decorators": [], + "examples": [ + { + "$id": "1291", + "kind": "http", + "name": "GetClustersExample", + "description": "GetClustersExample", + "filePath": "2024-12-01/ServiceConfigurationsList.json", + "parameters": [ + { + "$id": "1292", + "parameter": { + "$ref": "1277" + }, + "value": { + "$id": "1293", + "kind": "string", + "type": { + "$ref": "1278" + }, + "value": "2024-12-01" + } + }, + { + "$id": "1294", + "parameter": { + "$ref": "1283" + }, + "value": { + "$id": "1295", + "kind": "string", + "type": { + "$ref": "1284" + }, + "value": "default" + } + }, + { + "$id": "1296", + "parameter": { + "$ref": "1281" + }, + "value": { + "$id": "1297", + "kind": "string", + "type": { + "$ref": "1282" + }, + "value": "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default" + } + } + ], + "responses": [ + { + "$id": "1298", + "response": { + "$ref": "1288" + }, + "statusCode": 200, + "bodyValue": { + "$id": "1299", + "kind": "model", + "type": { + "$ref": "487" + }, + "value": { + "$id": "1300", + "value": { + "$id": "1301", + "kind": "array", + "type": { + "$ref": "489" + }, + "value": [ + { + "$id": "1302", + "kind": "model", + "type": { + "$ref": "458" + }, + "value": { + "$id": "1303", + "type": { + "$id": "1304", + "kind": "string", + "type": { + "$ref": "91" + }, + "value": "Microsoft.HybridConnectivity/endpoints/serviceConfigurations" + }, + "id": { + "$id": "1305", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default/serviceconfigurations/SSH" + }, + "properties": { + "$id": "1306", + "kind": "model", + "type": { + "$ref": "460" + }, + "value": { + "$id": "1307", + "port": { + "$id": "1308", + "kind": "number", + "type": { + "$ref": "470" + }, + "value": 22 + }, + "serviceName": { + "$id": "1309", + "kind": "string", + "type": { + "$ref": "38" + }, + "value": "SSH" + } + } + } + } + }, + { + "$id": "1310", + "kind": "model", + "type": { + "$ref": "458" + }, + "value": { + "$id": "1311", + "type": { + "$id": "1312", + "kind": "string", + "type": { + "$ref": "91" + }, + "value": "Microsoft.HybridConnectivity/endpoints/serviceConfigurations" + }, + "id": { + "$id": "1313", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default/serviceconfigurations/WAC" + }, + "properties": { + "$id": "1314", + "kind": "model", + "type": { + "$ref": "460" + }, + "value": { + "$id": "1315", + "port": { + "$id": "1316", + "kind": "number", + "type": { + "$ref": "470" + }, + "value": 6516 + }, + "serviceName": { + "$id": "1317", + "kind": "string", + "type": { + "$ref": "38" + }, + "value": "WAC" + } + } + } + } + } + ] + } + } + } + } + ] + } + ] + } + ], + "parameters": [ + { + "$id": "1318", + "name": "endpoint", + "nameInRequest": "endpoint", + "doc": "Service host", + "type": { + "$id": "1319", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url" + }, + "location": "Uri", + "isApiVersion": false, + "isContentType": false, + "isRequired": true, + "isEndpoint": true, + "skipUrlEncoding": false, + "explode": false, + "kind": "Client", + "defaultValue": { + "$id": "1320", + "type": { + "$id": "1321", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "https://management.azure.com" + } + } + ], + "decorators": [ + { + "$id": "1322", + "name": "Azure.ResourceManager.@armResourceOperations", + "arguments": { + "$id": "1323" + } + } + ], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.ServiceConfigurationResources", + "apiVersions": [ + "2024-12-01" + ], + "parent": { + "$ref": "653" + } + }, + { + "$id": "1324", + "kind": "client", + "name": "GenerateAwsTemplate", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "operations": [ + { + "$id": "1325", + "name": "post", + "resourceName": "GenerateAwsTemplate", + "doc": "Retrieve AWS Cloud Formation template", + "accessibility": "public", + "parameters": [ + { + "$id": "1326", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1327", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1328", + "type": { + "$id": "1329", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-12-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1330", + "name": "subscriptionId", + "nameInRequest": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "1331", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1332", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1333", + "name": "contentType", + "nameInRequest": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$id": "1334", + "kind": "constant", + "valueType": { + "$id": "1335", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": true, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1336", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1337", + "kind": "constant", + "valueType": { + "$id": "1338", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1339", + "name": "generateAwsTemplateRequest", + "nameInRequest": "generateAwsTemplateRequest", + "doc": "ConnectorId and SolutionTypes and their properties to Generate AWS CFT Template.", + "type": { + "$ref": "440" + }, + "location": "Body", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1340", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "457" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "POST", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridConnectivity/generateAwsTemplate", + "requestMediaTypes": [ + "application/json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.GenerateAwsTemplate.post", + "decorators": [], + "examples": [ + { + "$id": "1341", + "kind": "http", + "name": "GenerateAwsTemplate_Post", + "description": "GenerateAwsTemplate_Post", + "filePath": "2024-12-01/GenerateAwsTemplate_Post.json", + "parameters": [ + { + "$id": "1342", + "parameter": { + "$ref": "1326" + }, + "value": { + "$id": "1343", + "kind": "string", + "type": { + "$ref": "1327" + }, + "value": "2024-12-01" + } + }, + { + "$id": "1344", + "parameter": { + "$ref": "1330" + }, + "value": { + "$id": "1345", + "kind": "string", + "type": { + "$ref": "1331" + }, + "value": "5ACC4579-DB34-4C2F-8F8C-25061168F342" + } + }, + { + "$id": "1346", + "parameter": { + "$ref": "1339" + }, + "value": { + "$id": "1347", + "kind": "model", + "type": { + "$ref": "440" + }, + "value": { + "$id": "1348", + "connectorId": { + "$id": "1349", + "kind": "string", + "type": { + "$ref": "442" + }, + "value": "pnxcfjidglabnwxit" + }, + "solutionTypes": { + "$id": "1350", + "kind": "array", + "type": { + "$ref": "446" + }, + "value": [ + { + "$id": "1351", + "kind": "model", + "type": { + "$ref": "447" + }, + "value": { + "$id": "1352", + "solutionType": { + "$id": "1353", + "kind": "string", + "type": { + "$ref": "449" + }, + "value": "hjyownzpfxwiufmd" + }, + "solutionSettings": { + "$id": "1354", + "kind": "model", + "type": { + "$ref": "262" + }, + "value": { + "$id": "1355" + } + } + } + } + ] + } + } + } + } + ], + "responses": [ + { + "$id": "1356", + "response": { + "$ref": "1340" + }, + "statusCode": 200, + "bodyValue": { + "$id": "1357", + "kind": "model", + "type": { + "$ref": "457" + }, + "value": { + "$id": "1358" + } + } + } + ] + } + ] + } + ], + "parameters": [ + { + "$id": "1359", + "name": "endpoint", + "nameInRequest": "endpoint", + "doc": "Service host", + "type": { + "$id": "1360", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url" + }, + "location": "Uri", + "isApiVersion": false, + "isContentType": false, + "isRequired": true, + "isEndpoint": true, + "skipUrlEncoding": false, + "explode": false, + "kind": "Client", + "defaultValue": { + "$id": "1361", + "type": { + "$id": "1362", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "https://management.azure.com" + } + } + ], + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.GenerateAwsTemplate", + "apiVersions": [ + "2024-12-01" + ], + "parent": { + "$ref": "653" + } + }, + { + "$id": "1363", + "kind": "client", + "name": "PublicCloudConnectors", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "operations": [ + { + "$id": "1364", + "name": "get", + "resourceName": "PublicCloudConnector", + "doc": "Get a PublicCloudConnector", + "accessibility": "public", + "parameters": [ + { + "$id": "1365", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1366", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1367", + "type": { + "$id": "1368", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-12-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1369", + "name": "subscriptionId", + "nameInRequest": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "1370", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1371", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1372", + "name": "resourceGroupName", + "nameInRequest": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "1373", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1374", + "name": "publicCloudConnector", + "nameInRequest": "publicCloudConnector", + "doc": "Represent public cloud connectors resource.", + "type": { + "$id": "1375", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1376", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1377", + "kind": "constant", + "valueType": { + "$id": "1378", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1379", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "366" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector}", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.PublicCloudConnectors.get", + "decorators": [], + "examples": [ + { + "$id": "1380", + "kind": "http", + "name": "PublicCloudConnectors_Get", + "description": "PublicCloudConnectors_Get", + "filePath": "2024-12-01/PublicCloudConnectors_Get.json", + "parameters": [ + { + "$id": "1381", + "parameter": { + "$ref": "1365" + }, + "value": { + "$id": "1382", + "kind": "string", + "type": { + "$ref": "1366" + }, + "value": "2024-12-01" + } + }, + { + "$id": "1383", + "parameter": { + "$ref": "1369" + }, + "value": { + "$id": "1384", + "kind": "string", + "type": { + "$ref": "1370" + }, + "value": "5ACC4579-DB34-4C2F-8F8C-25061168F342" + } + }, + { + "$id": "1385", + "parameter": { + "$ref": "1372" + }, + "value": { + "$id": "1386", + "kind": "string", + "type": { + "$ref": "1373" + }, + "value": "rgpublicCloud" + } + }, + { + "$id": "1387", + "parameter": { + "$ref": "1374" + }, + "value": { + "$id": "1388", + "kind": "string", + "type": { + "$ref": "1375" + }, + "value": "rzygvnpsnrdylwzdbsscjazvamyxmh" + } + } + ], + "responses": [ + { + "$id": "1389", + "response": { + "$ref": "1379" + }, + "statusCode": 200, + "bodyValue": { + "$id": "1390", + "kind": "model", + "type": { + "$ref": "366" + }, + "value": { + "$id": "1391", + "properties": { + "$id": "1392", + "kind": "model", + "type": { + "$ref": "379" + }, + "value": { + "$id": "1393", + "awsCloudProfile": { + "$id": "1394", + "kind": "model", + "type": { + "$ref": "381" + }, + "value": { + "$id": "1395", + "accountId": { + "$id": "1396", + "kind": "string", + "type": { + "$ref": "383" + }, + "value": "snbnuxckevyqpm" + }, + "excludedAccounts": { + "$id": "1397", + "kind": "array", + "type": { + "$ref": "387" + }, + "value": [ + { + "$id": "1398", + "kind": "string", + "type": { + "$ref": "388" + }, + "value": "rwgqpukglvbqmogqcliqolucp" + } + ] + }, + "isOrganizationalAccount": { + "$id": "1399", + "kind": "boolean", + "type": { + "$ref": "392" + }, + "value": true + } + } + }, + "hostType": { + "$id": "1400", + "kind": "string", + "type": { + "$ref": "34" + }, + "value": "AWS" + }, + "provisioningState": { + "$id": "1401", + "kind": "string", + "type": { + "$ref": "26" + }, + "value": "Succeeded" + }, + "connectorPrimaryIdentifier": { + "$id": "1402", + "kind": "string", + "type": { + "$ref": "404" + }, + "value": "20a4e2be-8158-4b9e-b512-7a1af6f827de" + } + } + }, + "tags": { + "$id": "1403", + "kind": "dict", + "type": { + "$ref": "369" + }, + "value": { + "$id": "1404" + } + }, + "location": { + "$id": "1405", + "kind": "string", + "type": { + "$ref": "375" + }, + "value": "jpiglusfxynfcewcjwvvnn" + }, + "id": { + "$id": "1406", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "/subscriptions/5ACC4579-DB34-4C2F-8F8C-25061168F342/providers/Microsoft.HybridConnectivity/PublicCloudConnectors/esixipkbydb" + }, + "name": { + "$id": "1407", + "kind": "string", + "type": { + "$ref": "87" + }, + "value": "esixipkbydb" + }, + "type": { + "$id": "1408", + "kind": "string", + "type": { + "$ref": "91" + }, + "value": "eelsjvqvkdxdncptsobrswhulnm" + }, + "systemData": { + "$id": "1409", + "kind": "model", + "type": { + "$ref": "96" + }, + "value": { + "$id": "1410", + "createdBy": { + "$id": "1411", + "kind": "string", + "type": { + "$ref": "98" + }, + "value": "rpxzkcrobprrdvuoqxz" + }, + "createdByType": { + "$id": "1412", + "kind": "string", + "type": { + "$ref": "2" + }, + "value": "User" + }, + "createdAt": { + "$id": "1413", + "kind": "string", + "type": { + "$ref": "105" + }, + "value": "2024-01-18T22:52:07.890Z" + }, + "lastModifiedBy": { + "$id": "1414", + "kind": "string", + "type": { + "$ref": "110" + }, + "value": "jidegyskxi" + }, + "lastModifiedByType": { + "$id": "1415", + "kind": "string", + "type": { + "$ref": "2" + }, + "value": "User" + }, + "lastModifiedAt": { + "$id": "1416", + "kind": "string", + "type": { + "$ref": "117" + }, + "value": "2024-01-18T22:52:07.890Z" + } + } + } + } + } + } + ] + } + ] + }, + { + "$id": "1417", + "name": "createOrUpdate", + "resourceName": "PublicCloudConnector", + "doc": "Create a PublicCloudConnector", + "accessibility": "public", + "parameters": [ + { + "$id": "1418", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1419", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1420", + "type": { + "$id": "1421", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-12-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1422", + "name": "subscriptionId", + "nameInRequest": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "1423", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1424", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1425", + "name": "resourceGroupName", + "nameInRequest": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "1426", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1427", + "name": "publicCloudConnector", + "nameInRequest": "publicCloudConnector", + "doc": "Represent public cloud connectors resource.", + "type": { + "$id": "1428", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1429", + "name": "contentType", + "nameInRequest": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$id": "1430", + "kind": "constant", + "valueType": { + "$id": "1431", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": true, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1432", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1433", + "kind": "constant", + "valueType": { + "$id": "1434", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1435", + "name": "resource", + "nameInRequest": "resource", + "doc": "Resource create parameters.", + "type": { + "$ref": "366" + }, + "location": "Body", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1436", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "366" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + { + "$id": "1437", + "statusCodes": [ + 201 + ], + "bodyType": { + "$ref": "366" + }, + "headers": [ + { + "$id": "1438", + "name": "azureAsyncOperation", + "nameInResponse": "Azure-AsyncOperation", + "doc": "A link to the status monitor", + "type": { + "$id": "1439", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "$id": "1440", + "name": "retryAfter", + "nameInResponse": "Retry-After", + "doc": "The Retry-After header can indicate how long the client should wait before polling the operation status.", + "type": { + "$id": "1441", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "PUT", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector}", + "requestMediaTypes": [ + "application/json" + ], + "bufferResponse": true, + "longRunning": { + "$id": "1442", + "finalStateVia": 0, + "finalResponse": { + "$id": "1443", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "366" + } + } + }, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.PublicCloudConnectors.createOrUpdate", + "decorators": [], + "examples": [ + { + "$id": "1444", + "kind": "http", + "name": "PublicCloudConnectors_CreateOrUpdate", + "description": "PublicCloudConnectors_CreateOrUpdate", + "filePath": "2024-12-01/PublicCloudConnectors_CreateOrUpdate.json", + "parameters": [ + { + "$id": "1445", + "parameter": { + "$ref": "1418" + }, + "value": { + "$id": "1446", + "kind": "string", + "type": { + "$ref": "1419" + }, + "value": "2024-12-01" + } + }, + { + "$id": "1447", + "parameter": { + "$ref": "1422" + }, + "value": { + "$id": "1448", + "kind": "string", + "type": { + "$ref": "1423" + }, + "value": "5ACC4579-DB34-4C2F-8F8C-25061168F342" + } + }, + { + "$id": "1449", + "parameter": { + "$ref": "1425" + }, + "value": { + "$id": "1450", + "kind": "string", + "type": { + "$ref": "1426" + }, + "value": "rgpublicCloud" + } + }, + { + "$id": "1451", + "parameter": { + "$ref": "1427" + }, + "value": { + "$id": "1452", + "kind": "string", + "type": { + "$ref": "1428" + }, + "value": "advjwoakdusalamomg" + } + }, + { + "$id": "1453", + "parameter": { + "$ref": "1435" + }, + "value": { + "$id": "1454", + "kind": "model", + "type": { + "$ref": "366" + }, + "value": { + "$id": "1455", + "properties": { + "$id": "1456", + "kind": "model", + "type": { + "$ref": "379" + }, + "value": { + "$id": "1457", + "awsCloudProfile": { + "$id": "1458", + "kind": "model", + "type": { + "$ref": "381" + }, + "value": { + "$id": "1459", + "accountId": { + "$id": "1460", + "kind": "string", + "type": { + "$ref": "383" + }, + "value": "snbnuxckevyqpm" + }, + "excludedAccounts": { + "$id": "1461", + "kind": "array", + "type": { + "$ref": "387" + }, + "value": [ + { + "$id": "1462", + "kind": "string", + "type": { + "$ref": "388" + }, + "value": "rwgqpukglvbqmogqcliqolucp" + } + ] + }, + "isOrganizationalAccount": { + "$id": "1463", + "kind": "boolean", + "type": { + "$ref": "392" + }, + "value": true + } + } + }, + "hostType": { + "$id": "1464", + "kind": "string", + "type": { + "$ref": "34" + }, + "value": "AWS" + } + } + }, + "tags": { + "$id": "1465", + "kind": "dict", + "type": { + "$ref": "369" + }, + "value": { + "$id": "1466" + } + }, + "location": { + "$id": "1467", + "kind": "string", + "type": { + "$ref": "375" + }, + "value": "jpiglusfxynfcewcjwvvnn" + } + } + } + } + ], + "responses": [ + { + "$id": "1468", + "response": { + "$ref": "1436" + }, + "statusCode": 200, + "bodyValue": { + "$id": "1469", + "kind": "model", + "type": { + "$ref": "366" + }, + "value": { + "$id": "1470", + "properties": { + "$id": "1471", + "kind": "model", + "type": { + "$ref": "379" + }, + "value": { + "$id": "1472", + "awsCloudProfile": { + "$id": "1473", + "kind": "model", + "type": { + "$ref": "381" + }, + "value": { + "$id": "1474", + "accountId": { + "$id": "1475", + "kind": "string", + "type": { + "$ref": "383" + }, + "value": "snbnuxckevyqpm" + }, + "excludedAccounts": { + "$id": "1476", + "kind": "array", + "type": { + "$ref": "387" + }, + "value": [ + { + "$id": "1477", + "kind": "string", + "type": { + "$ref": "388" + }, + "value": "rwgqpukglvbqmogqcliqolucp" + } + ] + }, + "isOrganizationalAccount": { + "$id": "1478", + "kind": "boolean", + "type": { + "$ref": "392" + }, + "value": true + } + } + }, + "hostType": { + "$id": "1479", + "kind": "string", + "type": { + "$ref": "34" + }, + "value": "AWS" + }, + "provisioningState": { + "$id": "1480", + "kind": "string", + "type": { + "$ref": "26" + }, + "value": "Succeeded" + }, + "connectorPrimaryIdentifier": { + "$id": "1481", + "kind": "string", + "type": { + "$ref": "404" + }, + "value": "20a4e2be-8158-4b9e-b512-7a1af6f827de" + } + } + }, + "tags": { + "$id": "1482", + "kind": "dict", + "type": { + "$ref": "369" + }, + "value": { + "$id": "1483" + } + }, + "location": { + "$id": "1484", + "kind": "string", + "type": { + "$ref": "375" + }, + "value": "jpiglusfxynfcewcjwvvnn" + }, + "id": { + "$id": "1485", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "/subscriptions/5ACC4579-DB34-4C2F-8F8C-25061168F342/providers/Microsoft.HybridConnectivity/PublicCloudConnectors/esixipkbydb" + }, + "name": { + "$id": "1486", + "kind": "string", + "type": { + "$ref": "87" + }, + "value": "esixipkbydb" + }, + "type": { + "$id": "1487", + "kind": "string", + "type": { + "$ref": "91" + }, + "value": "eelsjvqvkdxdncptsobrswhulnm" + }, + "systemData": { + "$id": "1488", + "kind": "model", + "type": { + "$ref": "96" + }, + "value": { + "$id": "1489", + "createdBy": { + "$id": "1490", + "kind": "string", + "type": { + "$ref": "98" + }, + "value": "rpxzkcrobprrdvuoqxz" + }, + "createdByType": { + "$id": "1491", + "kind": "string", + "type": { + "$ref": "2" + }, + "value": "User" + }, + "createdAt": { + "$id": "1492", + "kind": "string", + "type": { + "$ref": "105" + }, + "value": "2024-01-18T22:52:07.890Z" + }, + "lastModifiedBy": { + "$id": "1493", + "kind": "string", + "type": { + "$ref": "110" + }, + "value": "jidegyskxi" + }, + "lastModifiedByType": { + "$id": "1494", + "kind": "string", + "type": { + "$ref": "2" + }, + "value": "User" + }, + "lastModifiedAt": { + "$id": "1495", + "kind": "string", + "type": { + "$ref": "117" + }, + "value": "2024-01-18T22:52:07.890Z" + } + } + } + } + } + }, + { + "$id": "1496", + "response": { + "$ref": "1437" + }, + "statusCode": 201, + "bodyValue": { + "$id": "1497", + "kind": "model", + "type": { + "$ref": "366" + }, + "value": { + "$id": "1498", + "properties": { + "$id": "1499", + "kind": "model", + "type": { + "$ref": "379" + }, + "value": { + "$id": "1500", + "awsCloudProfile": { + "$id": "1501", + "kind": "model", + "type": { + "$ref": "381" + }, + "value": { + "$id": "1502", + "accountId": { + "$id": "1503", + "kind": "string", + "type": { + "$ref": "383" + }, + "value": "snbnuxckevyqpm" + }, + "excludedAccounts": { + "$id": "1504", + "kind": "array", + "type": { + "$ref": "387" + }, + "value": [ + { + "$id": "1505", + "kind": "string", + "type": { + "$ref": "388" + }, + "value": "rwgqpukglvbqmogqcliqolucp" + } + ] + }, + "isOrganizationalAccount": { + "$id": "1506", + "kind": "boolean", + "type": { + "$ref": "392" + }, + "value": true + } + } + }, + "hostType": { + "$id": "1507", + "kind": "string", + "type": { + "$ref": "34" + }, + "value": "AWS" + }, + "provisioningState": { + "$id": "1508", + "kind": "string", + "type": { + "$ref": "26" + }, + "value": "Succeeded" + }, + "connectorPrimaryIdentifier": { + "$id": "1509", + "kind": "string", + "type": { + "$ref": "404" + }, + "value": "20a4e2be-8158-4b9e-b512-7a1af6f827de" + } + } + }, + "tags": { + "$id": "1510", + "kind": "dict", + "type": { + "$ref": "369" + }, + "value": { + "$id": "1511" + } + }, + "location": { + "$id": "1512", + "kind": "string", + "type": { + "$ref": "375" + }, + "value": "jpiglusfxynfcewcjwvvnn" + }, + "id": { + "$id": "1513", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "/subscriptions/5ACC4579-DB34-4C2F-8F8C-25061168F342/providers/Microsoft.HybridConnectivity/PublicCloudConnectors/esixipkbydb" + }, + "name": { + "$id": "1514", + "kind": "string", + "type": { + "$ref": "87" + }, + "value": "esixipkbydb" + }, + "type": { + "$id": "1515", + "kind": "string", + "type": { + "$ref": "91" + }, + "value": "eelsjvqvkdxdncptsobrswhulnm" + }, + "systemData": { + "$id": "1516", + "kind": "model", + "type": { + "$ref": "96" + }, + "value": { + "$id": "1517", + "createdBy": { + "$id": "1518", + "kind": "string", + "type": { + "$ref": "98" + }, + "value": "rpxzkcrobprrdvuoqxz" + }, + "createdByType": { + "$id": "1519", + "kind": "string", + "type": { + "$ref": "2" + }, + "value": "User" + }, + "createdAt": { + "$id": "1520", + "kind": "string", + "type": { + "$ref": "105" + }, + "value": "2024-01-18T22:52:07.890Z" + }, + "lastModifiedBy": { + "$id": "1521", + "kind": "string", + "type": { + "$ref": "110" + }, + "value": "jidegyskxi" + }, + "lastModifiedByType": { + "$id": "1522", + "kind": "string", + "type": { + "$ref": "2" + }, + "value": "User" + }, + "lastModifiedAt": { + "$id": "1523", + "kind": "string", + "type": { + "$ref": "117" + }, + "value": "2024-01-18T22:52:07.890Z" + } + } + } + } + } + } + ] + } + ] + }, + { + "$id": "1524", + "name": "update", + "resourceName": "PublicCloudConnector", + "doc": "Update a PublicCloudConnector", + "accessibility": "public", + "parameters": [ + { + "$id": "1525", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1526", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1527", + "type": { + "$id": "1528", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-12-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1529", + "name": "subscriptionId", + "nameInRequest": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "1530", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1531", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1532", + "name": "resourceGroupName", + "nameInRequest": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "1533", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1534", + "name": "publicCloudConnector", + "nameInRequest": "publicCloudConnector", + "doc": "Represent public cloud connectors resource.", + "type": { + "$id": "1535", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1536", + "name": "contentType", + "nameInRequest": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$id": "1537", + "kind": "constant", + "valueType": { + "$id": "1538", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": true, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1539", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1540", + "kind": "constant", + "valueType": { + "$id": "1541", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1542", + "name": "properties", + "nameInRequest": "properties", + "doc": "The resource properties to be updated.", + "type": { + "$ref": "409" + }, + "location": "Body", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1543", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "366" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "PATCH", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector}", + "requestMediaTypes": [ + "application/json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": false, + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.PublicCloudConnectors.update", + "decorators": [], + "examples": [ + { + "$id": "1544", + "kind": "http", + "name": "PublicCloudConnectors_Update", + "description": "PublicCloudConnectors_Update", + "filePath": "2024-12-01/PublicCloudConnectors_Update.json", + "parameters": [ + { + "$id": "1545", + "parameter": { + "$ref": "1525" + }, + "value": { + "$id": "1546", + "kind": "string", + "type": { + "$ref": "1526" + }, + "value": "2024-12-01" + } + }, + { + "$id": "1547", + "parameter": { + "$ref": "1529" + }, + "value": { + "$id": "1548", + "kind": "string", + "type": { + "$ref": "1530" + }, + "value": "5ACC4579-DB34-4C2F-8F8C-25061168F342" + } + }, + { + "$id": "1549", + "parameter": { + "$ref": "1532" + }, + "value": { + "$id": "1550", + "kind": "string", + "type": { + "$ref": "1533" + }, + "value": "rgpublicCloud" + } + }, + { + "$id": "1551", + "parameter": { + "$ref": "1534" + }, + "value": { + "$id": "1552", + "kind": "string", + "type": { + "$ref": "1535" + }, + "value": "svtirlbyqpepbzyessjenlueeznhg" + } + }, + { + "$id": "1553", + "parameter": { + "$ref": "1542" + }, + "value": { + "$id": "1554", + "kind": "model", + "type": { + "$ref": "409" + }, + "value": { + "$id": "1555", + "tags": { + "$id": "1556", + "kind": "dict", + "type": { + "$ref": "412" + }, + "value": { + "$id": "1557" + } + }, + "properties": { + "$id": "1558", + "kind": "model", + "type": { + "$ref": "418" + }, + "value": { + "$id": "1559", + "awsCloudProfile": { + "$id": "1560", + "kind": "model", + "type": { + "$ref": "420" + }, + "value": { + "$id": "1561", + "excludedAccounts": { + "$id": "1562", + "kind": "array", + "type": { + "$ref": "422" + }, + "value": [ + { + "$id": "1563", + "kind": "string", + "type": { + "$ref": "423" + }, + "value": "zrbtd" + } + ] + } + } + } + } + } + } + } + } + ], + "responses": [ + { + "$id": "1564", + "response": { + "$ref": "1543" + }, + "statusCode": 200, + "bodyValue": { + "$id": "1565", + "kind": "model", + "type": { + "$ref": "366" + }, + "value": { + "$id": "1566", + "properties": { + "$id": "1567", + "kind": "model", + "type": { + "$ref": "379" + }, + "value": { + "$id": "1568", + "awsCloudProfile": { + "$id": "1569", + "kind": "model", + "type": { + "$ref": "381" + }, + "value": { + "$id": "1570", + "accountId": { + "$id": "1571", + "kind": "string", + "type": { + "$ref": "383" + }, + "value": "snbnuxckevyqpm" + }, + "excludedAccounts": { + "$id": "1572", + "kind": "array", + "type": { + "$ref": "387" + }, + "value": [ + { + "$id": "1573", + "kind": "string", + "type": { + "$ref": "388" + }, + "value": "zrbtd" + } + ] + }, + "isOrganizationalAccount": { + "$id": "1574", + "kind": "boolean", + "type": { + "$ref": "392" + }, + "value": true + } + } + }, + "hostType": { + "$id": "1575", + "kind": "string", + "type": { + "$ref": "34" + }, + "value": "AWS" + }, + "provisioningState": { + "$id": "1576", + "kind": "string", + "type": { + "$ref": "26" + }, + "value": "Succeeded" + }, + "connectorPrimaryIdentifier": { + "$id": "1577", + "kind": "string", + "type": { + "$ref": "404" + }, + "value": "20a4e2be-8158-4b9e-b512-7a1af6f827de" + } + } + }, + "tags": { + "$id": "1578", + "kind": "dict", + "type": { + "$ref": "369" + }, + "value": { + "$id": "1579" + } + }, + "location": { + "$id": "1580", + "kind": "string", + "type": { + "$ref": "375" + }, + "value": "jpiglusfxynfcewcjwvvnn" + }, + "id": { + "$id": "1581", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "/subscriptions/5ACC4579-DB34-4C2F-8F8C-25061168F342/providers/Microsoft.HybridConnectivity/PublicCloudConnectors/esixipkbydb" + }, + "name": { + "$id": "1582", + "kind": "string", + "type": { + "$ref": "87" + }, + "value": "esixipkbydb" + }, + "type": { + "$id": "1583", + "kind": "string", + "type": { + "$ref": "91" + }, + "value": "eelsjvqvkdxdncptsobrswhulnm" + }, + "systemData": { + "$id": "1584", + "kind": "model", + "type": { + "$ref": "96" + }, + "value": { + "$id": "1585", + "createdBy": { + "$id": "1586", + "kind": "string", + "type": { + "$ref": "98" + }, + "value": "rpxzkcrobprrdvuoqxz" + }, + "createdByType": { + "$id": "1587", + "kind": "string", + "type": { + "$ref": "2" + }, + "value": "User" + }, + "createdAt": { + "$id": "1588", + "kind": "string", + "type": { + "$ref": "105" + }, + "value": "2024-01-18T22:52:07.890Z" + }, + "lastModifiedBy": { + "$id": "1589", + "kind": "string", + "type": { + "$ref": "110" + }, + "value": "jidegyskxi" + }, + "lastModifiedByType": { + "$id": "1590", + "kind": "string", + "type": { + "$ref": "2" + }, + "value": "User" + }, + "lastModifiedAt": { + "$id": "1591", + "kind": "string", + "type": { + "$ref": "117" + }, + "value": "2024-01-18T22:52:07.890Z" + } + } + } + } + } + } + ] + } + ] + }, + { + "$id": "1592", + "name": "delete", + "resourceName": "PublicCloudConnector", + "doc": "Delete a PublicCloudConnector", + "accessibility": "public", + "parameters": [ + { + "$id": "1593", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1594", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1595", + "type": { + "$id": "1596", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-12-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1597", + "name": "subscriptionId", + "nameInRequest": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "1598", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1599", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1600", + "name": "resourceGroupName", + "nameInRequest": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "1601", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1602", + "name": "publicCloudConnector", + "nameInRequest": "publicCloudConnector", + "doc": "Represent public cloud connectors resource.", + "type": { + "$id": "1603", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1604", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1605", + "kind": "constant", + "valueType": { + "$id": "1606", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1607", + "statusCodes": [ + 200 + ], + "headers": [], + "isErrorResponse": false + }, + { + "$id": "1608", + "statusCodes": [ + 204 + ], + "headers": [], + "isErrorResponse": false + } + ], + "httpMethod": "DELETE", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector}", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.PublicCloudConnectors.delete", + "decorators": [], + "examples": [ + { + "$id": "1609", + "kind": "http", + "name": "PublicCloudConnectors_Delete", + "description": "PublicCloudConnectors_Delete", + "filePath": "2024-12-01/PublicCloudConnectors_Delete.json", + "parameters": [ + { + "$id": "1610", + "parameter": { + "$ref": "1593" + }, + "value": { + "$id": "1611", + "kind": "string", + "type": { + "$ref": "1594" + }, + "value": "2024-12-01" + } + }, + { + "$id": "1612", + "parameter": { + "$ref": "1597" + }, + "value": { + "$id": "1613", + "kind": "string", + "type": { + "$ref": "1598" + }, + "value": "5ACC4579-DB34-4C2F-8F8C-25061168F342" + } + }, + { + "$id": "1614", + "parameter": { + "$ref": "1600" + }, + "value": { + "$id": "1615", + "kind": "string", + "type": { + "$ref": "1601" + }, + "value": "rgpublicCloud" + } + }, + { + "$id": "1616", + "parameter": { + "$ref": "1602" + }, + "value": { + "$id": "1617", + "kind": "string", + "type": { + "$ref": "1603" + }, + "value": "skcfyjvflkhibdywjay" + } + } + ], + "responses": [ + { + "$id": "1618", + "response": { + "$ref": "1607" + }, + "statusCode": 200 + }, + { + "$id": "1619", + "response": { + "$ref": "1608" + }, + "statusCode": 204 + } + ] + } + ] + }, + { + "$id": "1620", + "name": "listByResourceGroup", + "resourceName": "PublicCloudConnector", + "doc": "List PublicCloudConnector resources by resource group", + "accessibility": "public", + "parameters": [ + { + "$id": "1621", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1622", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1623", + "type": { + "$id": "1624", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-12-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1625", + "name": "subscriptionId", + "nameInRequest": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "1626", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1627", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1628", + "name": "resourceGroupName", + "nameInRequest": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "1629", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1630", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1631", + "kind": "constant", + "valueType": { + "$id": "1632", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1633", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "430" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors", + "bufferResponse": true, + "paging": { + "$id": "1634", + "itemPropertySegments": [ + "value" + ], + "nextLink": { + "$id": "1635", + "responseSegments": [ + "nextLink" + ], + "responseLocation": "Body" + } + }, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.PublicCloudConnectors.listByResourceGroup", + "decorators": [], + "examples": [ + { + "$id": "1636", + "kind": "http", + "name": "PublicCloudConnectors_ListByResourceGroup", + "description": "PublicCloudConnectors_ListByResourceGroup", + "filePath": "2024-12-01/PublicCloudConnectors_ListByResourceGroup.json", + "parameters": [ + { + "$id": "1637", + "parameter": { + "$ref": "1621" + }, + "value": { + "$id": "1638", + "kind": "string", + "type": { + "$ref": "1622" + }, + "value": "2024-12-01" + } + }, + { + "$id": "1639", + "parameter": { + "$ref": "1625" + }, + "value": { + "$id": "1640", + "kind": "string", + "type": { + "$ref": "1626" + }, + "value": "5ACC4579-DB34-4C2F-8F8C-25061168F342" + } + }, + { + "$id": "1641", + "parameter": { + "$ref": "1628" + }, + "value": { + "$id": "1642", + "kind": "string", + "type": { + "$ref": "1629" + }, + "value": "rgpublicCloud" + } + } + ], + "responses": [ + { + "$id": "1643", + "response": { + "$ref": "1633" + }, + "statusCode": 200, + "bodyValue": { + "$id": "1644", + "kind": "model", + "type": { + "$ref": "430" + }, + "value": { + "$id": "1645", + "value": { + "$id": "1646", + "kind": "array", + "type": { + "$ref": "432" + }, + "value": [ + { + "$id": "1647", + "kind": "model", + "type": { + "$ref": "366" + }, + "value": { + "$id": "1648", + "properties": { + "$id": "1649", + "kind": "model", + "type": { + "$ref": "379" + }, + "value": { + "$id": "1650", + "awsCloudProfile": { + "$id": "1651", + "kind": "model", + "type": { + "$ref": "381" + }, + "value": { + "$id": "1652", + "excludedAccounts": { + "$id": "1653", + "kind": "array", + "type": { + "$ref": "387" + }, + "value": [ + { + "$id": "1654", + "kind": "string", + "type": { + "$ref": "388" + }, + "value": "rwgqpukglvbqmogqcliqolucp" + } + ] + }, + "accountId": { + "$id": "1655", + "kind": "string", + "type": { + "$ref": "383" + }, + "value": "troiiavknxmcpczvxwjhrdue" + }, + "isOrganizationalAccount": { + "$id": "1656", + "kind": "boolean", + "type": { + "$ref": "392" + }, + "value": true + } + } + }, + "hostType": { + "$id": "1657", + "kind": "string", + "type": { + "$ref": "34" + }, + "value": "AWS" + }, + "provisioningState": { + "$id": "1658", + "kind": "string", + "type": { + "$ref": "26" + }, + "value": "Succeeded" + }, + "connectorPrimaryIdentifier": { + "$id": "1659", + "kind": "string", + "type": { + "$ref": "404" + }, + "value": "20a4e2be-8158-4b9e-b512-7a1af6f827de" + } + } + }, + "tags": { + "$id": "1660", + "kind": "dict", + "type": { + "$ref": "369" + }, + "value": { + "$id": "1661" + } + }, + "location": { + "$id": "1662", + "kind": "string", + "type": { + "$ref": "375" + }, + "value": "jpiglusfxynfcewcjwvvnn" + }, + "id": { + "$id": "1663", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "/subscriptions/5ACC4579-DB34-4C2F-8F8C-25061168F342/providers/Microsoft.HybridConnectivity/PublicCloudConnectors/esixipkbydb" + }, + "name": { + "$id": "1664", + "kind": "string", + "type": { + "$ref": "87" + }, + "value": "esixipkbydb" + }, + "type": { + "$id": "1665", + "kind": "string", + "type": { + "$ref": "91" + }, + "value": "eelsjvqvkdxdncptsobrswhulnm" + }, + "systemData": { + "$id": "1666", + "kind": "model", + "type": { + "$ref": "96" + }, + "value": { + "$id": "1667", + "createdBy": { + "$id": "1668", + "kind": "string", + "type": { + "$ref": "98" + }, + "value": "rpxzkcrobprrdvuoqxz" + }, + "createdByType": { + "$id": "1669", + "kind": "string", + "type": { + "$ref": "2" + }, + "value": "User" + }, + "createdAt": { + "$id": "1670", + "kind": "string", + "type": { + "$ref": "105" + }, + "value": "2024-01-18T22:52:07.890Z" + }, + "lastModifiedBy": { + "$id": "1671", + "kind": "string", + "type": { + "$ref": "110" + }, + "value": "jidegyskxi" + }, + "lastModifiedByType": { + "$id": "1672", + "kind": "string", + "type": { + "$ref": "2" + }, + "value": "User" + }, + "lastModifiedAt": { + "$id": "1673", + "kind": "string", + "type": { + "$ref": "117" + }, + "value": "2024-01-18T22:52:07.890Z" + } + } + } + } + } + ] + }, + "nextLink": { + "$id": "1674", + "kind": "string", + "type": { + "$ref": "436" + }, + "value": "https://microsoft.com/a" + } + } + } + } + ] + } + ] + }, + { + "$id": "1675", + "name": "listBySubscription", + "resourceName": "PublicCloudConnector", + "doc": "List PublicCloudConnector resources by subscription ID", + "accessibility": "public", + "parameters": [ + { + "$id": "1676", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1677", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1678", + "type": { + "$id": "1679", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-12-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1680", + "name": "subscriptionId", + "nameInRequest": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "1681", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1682", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1683", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1684", + "kind": "constant", + "valueType": { + "$id": "1685", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1686", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "430" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridConnectivity/publicCloudConnectors", + "bufferResponse": true, + "paging": { + "$id": "1687", + "itemPropertySegments": [ + "value" + ], + "nextLink": { + "$id": "1688", + "responseSegments": [ + "nextLink" + ], + "responseLocation": "Body" + } + }, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.PublicCloudConnectors.listBySubscription", + "decorators": [], + "examples": [ + { + "$id": "1689", + "kind": "http", + "name": "PublicCloudConnectors_ListBySubscription", + "description": "PublicCloudConnectors_ListBySubscription", + "filePath": "2024-12-01/PublicCloudConnectors_ListBySubscription.json", + "parameters": [ + { + "$id": "1690", + "parameter": { + "$ref": "1676" + }, + "value": { + "$id": "1691", + "kind": "string", + "type": { + "$ref": "1677" + }, + "value": "2024-12-01" + } + }, + { + "$id": "1692", + "parameter": { + "$ref": "1680" + }, + "value": { + "$id": "1693", + "kind": "string", + "type": { + "$ref": "1681" + }, + "value": "5ACC4579-DB34-4C2F-8F8C-25061168F342" + } + } + ], + "responses": [ + { + "$id": "1694", + "response": { + "$ref": "1686" + }, + "statusCode": 200, + "bodyValue": { + "$id": "1695", + "kind": "model", + "type": { + "$ref": "430" + }, + "value": { + "$id": "1696", + "value": { + "$id": "1697", + "kind": "array", + "type": { + "$ref": "432" + }, + "value": [ + { + "$id": "1698", + "kind": "model", + "type": { + "$ref": "366" + }, + "value": { + "$id": "1699", + "properties": { + "$id": "1700", + "kind": "model", + "type": { + "$ref": "379" + }, + "value": { + "$id": "1701", + "awsCloudProfile": { + "$id": "1702", + "kind": "model", + "type": { + "$ref": "381" + }, + "value": { + "$id": "1703", + "excludedAccounts": { + "$id": "1704", + "kind": "array", + "type": { + "$ref": "387" + }, + "value": [ + { + "$id": "1705", + "kind": "string", + "type": { + "$ref": "388" + }, + "value": "rwgqpukglvbqmogqcliqolucp" + } + ] + }, + "accountId": { + "$id": "1706", + "kind": "string", + "type": { + "$ref": "383" + }, + "value": "troiiavknxmcpczvxwjhrdue" + }, + "isOrganizationalAccount": { + "$id": "1707", + "kind": "boolean", + "type": { + "$ref": "392" + }, + "value": true + } + } + }, + "hostType": { + "$id": "1708", + "kind": "string", + "type": { + "$ref": "34" + }, + "value": "AWS" + }, + "provisioningState": { + "$id": "1709", + "kind": "string", + "type": { + "$ref": "26" + }, + "value": "Succeeded" + }, + "connectorPrimaryIdentifier": { + "$id": "1710", + "kind": "string", + "type": { + "$ref": "404" + }, + "value": "20a4e2be-8158-4b9e-b512-7a1af6f827de" + } + } + }, + "tags": { + "$id": "1711", + "kind": "dict", + "type": { + "$ref": "369" + }, + "value": { + "$id": "1712" + } + }, + "location": { + "$id": "1713", + "kind": "string", + "type": { + "$ref": "375" + }, + "value": "jpiglusfxynfcewcjwvvnn" + }, + "id": { + "$id": "1714", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "/subscriptions/5ACC4579-DB34-4C2F-8F8C-25061168F342/providers/Microsoft.HybridConnectivity/PublicCloudConnectors/esixipkbydb" + }, + "name": { + "$id": "1715", + "kind": "string", + "type": { + "$ref": "87" + }, + "value": "esixipkbydb" + }, + "type": { + "$id": "1716", + "kind": "string", + "type": { + "$ref": "91" + }, + "value": "eelsjvqvkdxdncptsobrswhulnm" + }, + "systemData": { + "$id": "1717", + "kind": "model", + "type": { + "$ref": "96" + }, + "value": { + "$id": "1718", + "createdBy": { + "$id": "1719", + "kind": "string", + "type": { + "$ref": "98" + }, + "value": "rpxzkcrobprrdvuoqxz" + }, + "createdByType": { + "$id": "1720", + "kind": "string", + "type": { + "$ref": "2" + }, + "value": "User" + }, + "createdAt": { + "$id": "1721", + "kind": "string", + "type": { + "$ref": "105" + }, + "value": "2024-01-18T22:52:07.890Z" + }, + "lastModifiedBy": { + "$id": "1722", + "kind": "string", + "type": { + "$ref": "110" + }, + "value": "jidegyskxi" + }, + "lastModifiedByType": { + "$id": "1723", + "kind": "string", + "type": { + "$ref": "2" + }, + "value": "User" + }, + "lastModifiedAt": { + "$id": "1724", + "kind": "string", + "type": { + "$ref": "117" + }, + "value": "2024-01-18T22:52:07.890Z" + } + } + } + } + } + ] + }, + "nextLink": { + "$id": "1725", + "kind": "string", + "type": { + "$ref": "436" + }, + "value": "https://microsoft.com/a" + } + } + } + } + ] + } + ] + }, + { + "$id": "1726", + "name": "testPermissions", + "resourceName": "PublicCloudConnectors", + "doc": "A long-running resource action.", + "accessibility": "public", + "parameters": [ + { + "$id": "1727", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1728", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1729", + "type": { + "$id": "1730", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-12-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1731", + "name": "subscriptionId", + "nameInRequest": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "1732", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1733", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1734", + "name": "resourceGroupName", + "nameInRequest": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "1735", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1736", + "name": "publicCloudConnector", + "nameInRequest": "publicCloudConnector", + "doc": "Represent public cloud connectors resource.", + "type": { + "$id": "1737", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1738", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1739", + "kind": "constant", + "valueType": { + "$id": "1740", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1741", + "statusCodes": [ + 202 + ], + "headers": [ + { + "$id": "1742", + "name": "location", + "nameInResponse": "Location", + "doc": "The Location header contains the URL where the status of the long running operation can be checked.", + "type": { + "$id": "1743", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "$id": "1744", + "name": "retryAfter", + "nameInResponse": "Retry-After", + "doc": "The Retry-After header can indicate how long the client should wait before polling the operation status.", + "type": { + "$id": "1745", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + } + } + ], + "isErrorResponse": false + }, + { + "$id": "1746", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "302" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "POST", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector}/testPermissions", + "bufferResponse": true, + "longRunning": { + "$id": "1747", + "finalStateVia": 1, + "finalResponse": { + "$id": "1748", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "302" + } + } + }, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.PublicCloudConnectors.testPermissions", + "decorators": [], + "examples": [ + { + "$id": "1749", + "kind": "http", + "name": "PublicCloudConnectors_TestPermissions", + "description": "PublicCloudConnectors_TestPermissions", + "filePath": "2024-12-01/PublicCloudConnectors_TestPermissions.json", + "parameters": [ + { + "$id": "1750", + "parameter": { + "$ref": "1727" + }, + "value": { + "$id": "1751", + "kind": "string", + "type": { + "$ref": "1728" + }, + "value": "2024-12-01" + } + }, + { + "$id": "1752", + "parameter": { + "$ref": "1731" + }, + "value": { + "$id": "1753", + "kind": "string", + "type": { + "$ref": "1732" + }, + "value": "5ACC4579-DB34-4C2F-8F8C-25061168F342" + } + }, + { + "$id": "1754", + "parameter": { + "$ref": "1734" + }, + "value": { + "$id": "1755", + "kind": "string", + "type": { + "$ref": "1735" + }, + "value": "rgpublicCloud" + } + }, + { + "$id": "1756", + "parameter": { + "$ref": "1736" + }, + "value": { + "$id": "1757", + "kind": "string", + "type": { + "$ref": "1737" + }, + "value": "rzygvnpsnrdylwzdbsscjazvamyxmh" + } + } + ], + "responses": [ + { + "$id": "1758", + "response": { + "$ref": "1746" + }, + "statusCode": 200, + "bodyValue": { + "$id": "1759", + "kind": "model", + "type": { + "$ref": "302" + }, + "value": { + "$id": "1760", + "id": { + "$id": "1761", + "kind": "string", + "type": { + "$ref": "304" + }, + "value": "/subscriptions/5ACC4579-DB34-4C2F-8F8C-25061168F342/providers/Microsoft.HybridConnectivity/PublicCloudConnectors/esixipkbydb" + }, + "resourceId": { + "$id": "1762", + "kind": "string", + "type": { + "$ref": "338" + }, + "value": "/subscriptions/5ACC4579-DB34-4C2F-8F8C-25061168F342/providers/Microsoft.HybridConnectivity/PublicCloudConnectors/esixipkbydb" + }, + "name": { + "$id": "1763", + "kind": "string", + "type": { + "$ref": "309" + }, + "value": "ppeygvsnaspxmpwalpmkqva" + }, + "status": { + "$id": "1764", + "kind": "string", + "type": { + "$ref": "313" + }, + "value": "toyjllkvm" + }, + "percentComplete": { + "$id": "1765", + "kind": "number", + "type": { + "$ref": "317" + }, + "value": 81 + }, + "startTime": { + "$id": "1766", + "kind": "string", + "type": { + "$ref": "321" + }, + "value": "2024-10-02T18:38:19.143Z" + }, + "endTime": { + "$id": "1767", + "kind": "string", + "type": { + "$ref": "326" + }, + "value": "2024-10-02T18:38:19.143Z" + }, + "operations": { + "$id": "1768", + "kind": "array", + "type": { + "$ref": "331" + }, + "value": [ + { + "$id": "1769", + "kind": "model", + "type": { + "$ref": "302" + }, + "value": { + "$id": "1770", + "id": { + "$id": "1771", + "kind": "string", + "type": { + "$ref": "304" + }, + "value": "/subscriptions/5ACC4579-DB34-4C2F-8F8C-25061168F342/providers/Microsoft.HybridConnectivity/PublicCloudConnectors/esixipkbydb" + }, + "resourceId": { + "$id": "1772", + "kind": "string", + "type": { + "$ref": "338" + }, + "value": "/subscriptions/5ACC4579-DB34-4C2F-8F8C-25061168F342/providers/Microsoft.HybridConnectivity/PublicCloudConnectors/esixipkbydb" + }, + "name": { + "$id": "1773", + "kind": "string", + "type": { + "$ref": "309" + }, + "value": "svqtraeuwvyvblujlvqilypwpdrt" + }, + "status": { + "$id": "1774", + "kind": "string", + "type": { + "$ref": "313" + }, + "value": "bevmrejij" + }, + "percentComplete": { + "$id": "1775", + "kind": "number", + "type": { + "$ref": "317" + }, + "value": 15 + }, + "startTime": { + "$id": "1776", + "kind": "string", + "type": { + "$ref": "321" + }, + "value": "2024-10-02T18:38:19.143Z" + }, + "endTime": { + "$id": "1777", + "kind": "string", + "type": { + "$ref": "326" + }, + "value": "2024-10-02T18:38:19.143Z" + }, + "operations": { + "$id": "1778", + "kind": "array", + "type": { + "$ref": "331" + }, + "value": [] + }, + "error": { + "$id": "1779", + "kind": "model", + "type": { + "$ref": "172" + }, + "value": { + "$id": "1780", + "code": { + "$id": "1781", + "kind": "string", + "type": { + "$ref": "174" + }, + "value": "ykzvluyqiftfsumgvwzdh" + }, + "message": { + "$id": "1782", + "kind": "string", + "type": { + "$ref": "178" + }, + "value": "krbjgtqkjgiux" + }, + "target": { + "$id": "1783", + "kind": "string", + "type": { + "$ref": "182" + }, + "value": "nsaucxt" + }, + "details": { + "$id": "1784", + "kind": "array", + "type": { + "$ref": "186" + }, + "value": [] + }, + "additionalInfo": { + "$id": "1785", + "kind": "array", + "type": { + "$ref": "190" + }, + "value": [ + { + "$id": "1786", + "kind": "model", + "type": { + "$ref": "191" + }, + "value": { + "$id": "1787", + "type": { + "$id": "1788", + "kind": "string", + "type": { + "$ref": "193" + }, + "value": "qivvrewsjvcildjgwwytgimwklh" + }, + "info": { + "$id": "1789", + "kind": "model", + "type": { + "$ref": "197" + }, + "value": { + "$id": "1790" + } + } + } + } + ] + } + } + } + } + } + ] + }, + "error": { + "$id": "1791", + "kind": "model", + "type": { + "$ref": "172" + }, + "value": { + "$id": "1792", + "code": { + "$id": "1793", + "kind": "string", + "type": { + "$ref": "174" + }, + "value": "ykzvluyqiftfsumgvwzdh" + }, + "message": { + "$id": "1794", + "kind": "string", + "type": { + "$ref": "178" + }, + "value": "krbjgtqkjgiux" + }, + "target": { + "$id": "1795", + "kind": "string", + "type": { + "$ref": "182" + }, + "value": "nsaucxt" + }, + "details": { + "$id": "1796", + "kind": "array", + "type": { + "$ref": "186" + }, + "value": [] + }, + "additionalInfo": { + "$id": "1797", + "kind": "array", + "type": { + "$ref": "190" + }, + "value": [ + { + "$id": "1798", + "kind": "model", + "type": { + "$ref": "191" + }, + "value": { + "$id": "1799", + "type": { + "$id": "1800", + "kind": "string", + "type": { + "$ref": "193" + }, + "value": "qivvrewsjvcildjgwwytgimwklh" + }, + "info": { + "$id": "1801", + "kind": "model", + "type": { + "$ref": "197" + }, + "value": { + "$id": "1802" + } + } + } + } + ] + } + } + } + } + } + }, + { + "$id": "1803", + "response": { + "$ref": "1741" + }, + "statusCode": 202 + } + ] + } + ] + } + ], + "parameters": [ + { + "$id": "1804", + "name": "endpoint", + "nameInRequest": "endpoint", + "doc": "Service host", + "type": { + "$id": "1805", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url" + }, + "location": "Uri", + "isApiVersion": false, + "isContentType": false, + "isRequired": true, + "isEndpoint": true, + "skipUrlEncoding": false, + "explode": false, + "kind": "Client", + "defaultValue": { + "$id": "1806", + "type": { + "$id": "1807", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "https://management.azure.com" + } + } + ], + "decorators": [ + { + "$id": "1808", + "name": "Azure.ResourceManager.@armResourceOperations", + "arguments": { + "$id": "1809" + } + } + ], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.PublicCloudConnectors", + "apiVersions": [ + "2024-12-01" + ], + "parent": { + "$ref": "653" + } + }, + { + "$id": "1810", + "kind": "client", + "name": "SolutionConfigurations", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "operations": [ + { + "$id": "1811", + "name": "get", + "resourceName": "SolutionConfiguration", + "doc": "Get a SolutionConfiguration", + "accessibility": "public", + "parameters": [ + { + "$id": "1812", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1813", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1814", + "type": { + "$id": "1815", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-12-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1816", + "name": "resourceUri", + "nameInRequest": "resourceUri", + "doc": "The fully qualified Azure Resource manager identifier of the resource.", + "type": { + "$id": "1817", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "1818", + "name": "solutionConfiguration", + "nameInRequest": "solutionConfiguration", + "doc": "Represent Solution Configuration Resource.", + "type": { + "$id": "1819", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1820", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1821", + "kind": "constant", + "valueType": { + "$id": "1822", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1823", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "250" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionConfigurations.get", + "decorators": [], + "examples": [ + { + "$id": "1824", + "kind": "http", + "name": "SolutionConfigurations_Get", + "description": "SolutionConfigurations_Get", + "filePath": "2024-12-01/SolutionConfigurations_Get.json", + "parameters": [ + { + "$id": "1825", + "parameter": { + "$ref": "1812" + }, + "value": { + "$id": "1826", + "kind": "string", + "type": { + "$ref": "1813" + }, + "value": "2024-12-01" + } + }, + { + "$id": "1827", + "parameter": { + "$ref": "1816" + }, + "value": { + "$id": "1828", + "kind": "string", + "type": { + "$ref": "1817" + }, + "value": "ymuj" + } + }, + { + "$id": "1829", + "parameter": { + "$ref": "1818" + }, + "value": { + "$id": "1830", + "kind": "string", + "type": { + "$ref": "1819" + }, + "value": "tks" + } + } + ], + "responses": [ + { + "$id": "1831", + "response": { + "$ref": "1823" + }, + "statusCode": 200, + "bodyValue": { + "$id": "1832", + "kind": "model", + "type": { + "$ref": "250" + }, + "value": { + "$id": "1833", + "properties": { + "$id": "1834", + "kind": "model", + "type": { + "$ref": "253" + }, + "value": { + "$id": "1835", + "solutionType": { + "$id": "1836", + "kind": "string", + "type": { + "$ref": "258" + }, + "value": "nmtqllkyohwtsthxaimsye" + }, + "solutionSettings": { + "$id": "1837", + "kind": "model", + "type": { + "$ref": "262" + }, + "value": { + "$id": "1838" + } + }, + "provisioningState": { + "$id": "1839", + "kind": "string", + "type": { + "$ref": "26" + }, + "value": "Succeeded" + }, + "status": { + "$id": "1840", + "kind": "string", + "type": { + "$ref": "16" + }, + "value": "New" + }, + "statusDetails": { + "$id": "1841", + "kind": "string", + "type": { + "$ref": "270" + }, + "value": "rqbrzildwecankrpukkbjjqrczxboz" + }, + "lastSyncTime": { + "$id": "1842", + "kind": "string", + "type": { + "$ref": "274" + }, + "value": "2024-01-20T03:24:15.820Z" + } + } + }, + "id": { + "$id": "1843", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "/subscriptions/testSubcrptions/resourceGroups/testResourceGroup/providers/Microsoft.HybridConnectivity/SolutionConfigurations/qpwubemzmootxmtlxaerir" + }, + "name": { + "$id": "1844", + "kind": "string", + "type": { + "$ref": "87" + }, + "value": "qpwubemzmootxmtlxaerir" + }, + "type": { + "$id": "1845", + "kind": "string", + "type": { + "$ref": "91" + }, + "value": "uknrk" + }, + "systemData": { + "$id": "1846", + "kind": "model", + "type": { + "$ref": "96" + }, + "value": { + "$id": "1847", + "createdBy": { + "$id": "1848", + "kind": "string", + "type": { + "$ref": "98" + }, + "value": "rpxzkcrobprrdvuoqxz" + }, + "createdByType": { + "$id": "1849", + "kind": "string", + "type": { + "$ref": "2" + }, + "value": "User" + }, + "createdAt": { + "$id": "1850", + "kind": "string", + "type": { + "$ref": "105" + }, + "value": "2024-01-18T22:52:07.890Z" + }, + "lastModifiedBy": { + "$id": "1851", + "kind": "string", + "type": { + "$ref": "110" + }, + "value": "jidegyskxi" + }, + "lastModifiedByType": { + "$id": "1852", + "kind": "string", + "type": { + "$ref": "2" + }, + "value": "User" + }, + "lastModifiedAt": { + "$id": "1853", + "kind": "string", + "type": { + "$ref": "117" + }, + "value": "2024-01-18T22:52:07.890Z" + } + } + } + } + } + } + ] + } + ] + }, + { + "$id": "1854", + "name": "createOrUpdate", + "resourceName": "SolutionConfiguration", + "doc": "Create a SolutionConfiguration", + "accessibility": "public", + "parameters": [ + { + "$id": "1855", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1856", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1857", + "type": { + "$id": "1858", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-12-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1859", + "name": "resourceUri", + "nameInRequest": "resourceUri", + "doc": "The fully qualified Azure Resource manager identifier of the resource.", + "type": { + "$id": "1860", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "1861", + "name": "solutionConfiguration", + "nameInRequest": "solutionConfiguration", + "doc": "Represent Solution Configuration Resource.", + "type": { + "$id": "1862", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1863", + "name": "contentType", + "nameInRequest": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$id": "1864", + "kind": "constant", + "valueType": { + "$id": "1865", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": true, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1866", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1867", + "kind": "constant", + "valueType": { + "$id": "1868", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1869", + "name": "resource", + "nameInRequest": "resource", + "doc": "Resource create parameters.", + "type": { + "$ref": "250" + }, + "location": "Body", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1870", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "250" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + { + "$id": "1871", + "statusCodes": [ + 201 + ], + "bodyType": { + "$ref": "250" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "PUT", + "uri": "{endpoint}", + "path": "/{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}", + "requestMediaTypes": [ + "application/json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionConfigurations.createOrUpdate", + "decorators": [], + "examples": [ + { + "$id": "1872", + "kind": "http", + "name": "SolutionConfigurations_CreateOrUpdate", + "description": "SolutionConfigurations_CreateOrUpdate", + "filePath": "2024-12-01/SolutionConfigurations_CreateOrUpdate.json", + "parameters": [ + { + "$id": "1873", + "parameter": { + "$ref": "1855" + }, + "value": { + "$id": "1874", + "kind": "string", + "type": { + "$ref": "1856" + }, + "value": "2024-12-01" + } + }, + { + "$id": "1875", + "parameter": { + "$ref": "1859" + }, + "value": { + "$id": "1876", + "kind": "string", + "type": { + "$ref": "1860" + }, + "value": "ymuj" + } + }, + { + "$id": "1877", + "parameter": { + "$ref": "1861" + }, + "value": { + "$id": "1878", + "kind": "string", + "type": { + "$ref": "1862" + }, + "value": "keebwujt" + } + }, + { + "$id": "1879", + "parameter": { + "$ref": "1869" + }, + "value": { + "$id": "1880", + "kind": "model", + "type": { + "$ref": "250" + }, + "value": { + "$id": "1881", + "properties": { + "$id": "1882", + "kind": "model", + "type": { + "$ref": "253" + }, + "value": { + "$id": "1883", + "solutionType": { + "$id": "1884", + "kind": "string", + "type": { + "$ref": "258" + }, + "value": "nmtqllkyohwtsthxaimsye" + }, + "solutionSettings": { + "$id": "1885", + "kind": "model", + "type": { + "$ref": "262" + }, + "value": { + "$id": "1886" + } + } + } + } + } + } + } + ], + "responses": [ + { + "$id": "1887", + "response": { + "$ref": "1870" + }, + "statusCode": 200, + "bodyValue": { + "$id": "1888", + "kind": "model", + "type": { + "$ref": "250" + }, + "value": { + "$id": "1889", + "properties": { + "$id": "1890", + "kind": "model", + "type": { + "$ref": "253" + }, + "value": { + "$id": "1891", + "solutionType": { + "$id": "1892", + "kind": "string", + "type": { + "$ref": "258" + }, + "value": "nmtqllkyohwtsthxaimsye" + }, + "solutionSettings": { + "$id": "1893", + "kind": "model", + "type": { + "$ref": "262" + }, + "value": { + "$id": "1894" + } + }, + "provisioningState": { + "$id": "1895", + "kind": "string", + "type": { + "$ref": "26" + }, + "value": "Succeeded" + }, + "status": { + "$id": "1896", + "kind": "string", + "type": { + "$ref": "16" + }, + "value": "New" + }, + "statusDetails": { + "$id": "1897", + "kind": "string", + "type": { + "$ref": "270" + }, + "value": "rqbrzildwecankrpukkbjjqrczxboz" + }, + "lastSyncTime": { + "$id": "1898", + "kind": "string", + "type": { + "$ref": "274" + }, + "value": "2024-01-20T03:24:15.820Z" + } + } + }, + "id": { + "$id": "1899", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "/subscriptions/testSubcrptions/resourceGroups/testResourceGroup/providers/Microsoft.HybridConnectivity/SolutionConfigurations/qpwubemzmootxmtlxaerir" + }, + "name": { + "$id": "1900", + "kind": "string", + "type": { + "$ref": "87" + }, + "value": "qpwubemzmootxmtlxaerir" + }, + "type": { + "$id": "1901", + "kind": "string", + "type": { + "$ref": "91" + }, + "value": "uknrk" + }, + "systemData": { + "$id": "1902", + "kind": "model", + "type": { + "$ref": "96" + }, + "value": { + "$id": "1903", + "createdBy": { + "$id": "1904", + "kind": "string", + "type": { + "$ref": "98" + }, + "value": "rpxzkcrobprrdvuoqxz" + }, + "createdByType": { + "$id": "1905", + "kind": "string", + "type": { + "$ref": "2" + }, + "value": "User" + }, + "createdAt": { + "$id": "1906", + "kind": "string", + "type": { + "$ref": "105" + }, + "value": "2024-01-18T22:52:07.890Z" + }, + "lastModifiedBy": { + "$id": "1907", + "kind": "string", + "type": { + "$ref": "110" + }, + "value": "jidegyskxi" + }, + "lastModifiedByType": { + "$id": "1908", + "kind": "string", + "type": { + "$ref": "2" + }, + "value": "User" + }, + "lastModifiedAt": { + "$id": "1909", + "kind": "string", + "type": { + "$ref": "117" + }, + "value": "2024-01-18T22:52:07.890Z" + } + } + } + } + } + }, + { + "$id": "1910", + "response": { + "$ref": "1871" + }, + "statusCode": 201, + "bodyValue": { + "$id": "1911", + "kind": "model", + "type": { + "$ref": "250" + }, + "value": { + "$id": "1912", + "properties": { + "$id": "1913", + "kind": "model", + "type": { + "$ref": "253" + }, + "value": { + "$id": "1914", + "solutionType": { + "$id": "1915", + "kind": "string", + "type": { + "$ref": "258" + }, + "value": "nmtqllkyohwtsthxaimsye" + }, + "solutionSettings": { + "$id": "1916", + "kind": "model", + "type": { + "$ref": "262" + }, + "value": { + "$id": "1917" + } + }, + "provisioningState": { + "$id": "1918", + "kind": "string", + "type": { + "$ref": "26" + }, + "value": "Succeeded" + }, + "status": { + "$id": "1919", + "kind": "string", + "type": { + "$ref": "16" + }, + "value": "New" + }, + "statusDetails": { + "$id": "1920", + "kind": "string", + "type": { + "$ref": "270" + }, + "value": "rqbrzildwecankrpukkbjjqrczxboz" + }, + "lastSyncTime": { + "$id": "1921", + "kind": "string", + "type": { + "$ref": "274" + }, + "value": "2024-01-20T03:24:15.820Z" + } + } + }, + "id": { + "$id": "1922", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "/subscriptions/testSubcrptions/resourceGroups/testResourceGroup/providers/Microsoft.HybridConnectivity/SolutionConfigurations/qpwubemzmootxmtlxaerir" + }, + "name": { + "$id": "1923", + "kind": "string", + "type": { + "$ref": "87" + }, + "value": "qpwubemzmootxmtlxaerir" + }, + "type": { + "$id": "1924", + "kind": "string", + "type": { + "$ref": "91" + }, + "value": "uknrk" + }, + "systemData": { + "$id": "1925", + "kind": "model", + "type": { + "$ref": "96" + }, + "value": { + "$id": "1926", + "createdBy": { + "$id": "1927", + "kind": "string", + "type": { + "$ref": "98" + }, + "value": "rpxzkcrobprrdvuoqxz" + }, + "createdByType": { + "$id": "1928", + "kind": "string", + "type": { + "$ref": "2" + }, + "value": "User" + }, + "createdAt": { + "$id": "1929", + "kind": "string", + "type": { + "$ref": "105" + }, + "value": "2024-01-18T22:52:07.890Z" + }, + "lastModifiedBy": { + "$id": "1930", + "kind": "string", + "type": { + "$ref": "110" + }, + "value": "jidegyskxi" + }, + "lastModifiedByType": { + "$id": "1931", + "kind": "string", + "type": { + "$ref": "2" + }, + "value": "User" + }, + "lastModifiedAt": { + "$id": "1932", + "kind": "string", + "type": { + "$ref": "117" + }, + "value": "2024-01-18T22:52:07.890Z" + } + } + } + } + } + } + ] + } + ] + }, + { + "$id": "1933", + "name": "update", + "resourceName": "SolutionConfiguration", + "doc": "Update a SolutionConfiguration", + "accessibility": "public", + "parameters": [ + { + "$id": "1934", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1935", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1936", + "type": { + "$id": "1937", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-12-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1938", + "name": "resourceUri", + "nameInRequest": "resourceUri", + "doc": "The fully qualified Azure Resource manager identifier of the resource.", + "type": { + "$id": "1939", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "1940", + "name": "solutionConfiguration", + "nameInRequest": "solutionConfiguration", + "doc": "Represent Solution Configuration Resource.", + "type": { + "$id": "1941", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1942", + "name": "contentType", + "nameInRequest": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$id": "1943", + "kind": "constant", + "valueType": { + "$id": "1944", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": true, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1945", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1946", + "kind": "constant", + "valueType": { + "$id": "1947", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1948", + "name": "properties", + "nameInRequest": "properties", + "doc": "The resource properties to be updated.", + "type": { + "$ref": "280" + }, + "location": "Body", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1949", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "250" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "PATCH", + "uri": "{endpoint}", + "path": "/{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}", + "requestMediaTypes": [ + "application/json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": false, + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionConfigurations.update", + "decorators": [], + "examples": [ + { + "$id": "1950", + "kind": "http", + "name": "SolutionConfigurations_Update", + "description": "SolutionConfigurations_Update", + "filePath": "2024-12-01/SolutionConfigurations_Update.json", + "parameters": [ + { + "$id": "1951", + "parameter": { + "$ref": "1934" + }, + "value": { + "$id": "1952", + "kind": "string", + "type": { + "$ref": "1935" + }, + "value": "2024-12-01" + } + }, + { + "$id": "1953", + "parameter": { + "$ref": "1938" + }, + "value": { + "$id": "1954", + "kind": "string", + "type": { + "$ref": "1939" + }, + "value": "ymuj" + } + }, + { + "$id": "1955", + "parameter": { + "$ref": "1940" + }, + "value": { + "$id": "1956", + "kind": "string", + "type": { + "$ref": "1941" + }, + "value": "dxt" + } + }, + { + "$id": "1957", + "parameter": { + "$ref": "1948" + }, + "value": { + "$id": "1958", + "kind": "model", + "type": { + "$ref": "280" + }, + "value": { + "$id": "1959", + "properties": { + "$id": "1960", + "kind": "model", + "type": { + "$ref": "282" + }, + "value": { + "$id": "1961", + "solutionType": { + "$id": "1962", + "kind": "string", + "type": { + "$ref": "284" + }, + "value": "myzljlstvmgkp" + }, + "solutionSettings": { + "$id": "1963", + "kind": "model", + "type": { + "$ref": "262" + }, + "value": { + "$id": "1964" + } + } + } + } + } + } + } + ], + "responses": [ + { + "$id": "1965", + "response": { + "$ref": "1949" + }, + "statusCode": 200, + "bodyValue": { + "$id": "1966", + "kind": "model", + "type": { + "$ref": "250" + }, + "value": { + "$id": "1967", + "properties": { + "$id": "1968", + "kind": "model", + "type": { + "$ref": "253" + }, + "value": { + "$id": "1969", + "solutionType": { + "$id": "1970", + "kind": "string", + "type": { + "$ref": "258" + }, + "value": "nmtqllkyohwtsthxaimsye" + }, + "solutionSettings": { + "$id": "1971", + "kind": "model", + "type": { + "$ref": "262" + }, + "value": { + "$id": "1972" + } + }, + "provisioningState": { + "$id": "1973", + "kind": "string", + "type": { + "$ref": "26" + }, + "value": "Succeeded" + }, + "status": { + "$id": "1974", + "kind": "string", + "type": { + "$ref": "16" + }, + "value": "New" + }, + "statusDetails": { + "$id": "1975", + "kind": "string", + "type": { + "$ref": "270" + }, + "value": "rqbrzildwecankrpukkbjjqrczxboz" + }, + "lastSyncTime": { + "$id": "1976", + "kind": "string", + "type": { + "$ref": "274" + }, + "value": "2024-01-20T03:24:15.820Z" + } + } + }, + "id": { + "$id": "1977", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "/subscriptions/testSubcrptions/resourceGroups/testResourceGroup/providers/Microsoft.HybridConnectivity/SolutionConfigurations/qpwubemzmootxmtlxaerir" + }, + "name": { + "$id": "1978", + "kind": "string", + "type": { + "$ref": "87" + }, + "value": "qpwubemzmootxmtlxaerir" + }, + "type": { + "$id": "1979", + "kind": "string", + "type": { + "$ref": "91" + }, + "value": "uknrk" + }, + "systemData": { + "$id": "1980", + "kind": "model", + "type": { + "$ref": "96" + }, + "value": { + "$id": "1981", + "createdBy": { + "$id": "1982", + "kind": "string", + "type": { + "$ref": "98" + }, + "value": "rpxzkcrobprrdvuoqxz" + }, + "createdByType": { + "$id": "1983", + "kind": "string", + "type": { + "$ref": "2" + }, + "value": "User" + }, + "createdAt": { + "$id": "1984", + "kind": "string", + "type": { + "$ref": "105" + }, + "value": "2024-01-18T22:52:07.890Z" + }, + "lastModifiedBy": { + "$id": "1985", + "kind": "string", + "type": { + "$ref": "110" + }, + "value": "jidegyskxi" + }, + "lastModifiedByType": { + "$id": "1986", + "kind": "string", + "type": { + "$ref": "2" + }, + "value": "User" + }, + "lastModifiedAt": { + "$id": "1987", + "kind": "string", + "type": { + "$ref": "117" + }, + "value": "2024-01-18T22:52:07.890Z" + } + } + } + } + } + } + ] + } + ] + }, + { + "$id": "1988", + "name": "delete", + "resourceName": "SolutionConfiguration", + "doc": "Delete a SolutionConfiguration", + "accessibility": "public", + "parameters": [ + { + "$id": "1989", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1990", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1991", + "type": { + "$id": "1992", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-12-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1993", + "name": "resourceUri", + "nameInRequest": "resourceUri", + "doc": "The fully qualified Azure Resource manager identifier of the resource.", + "type": { + "$id": "1994", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "1995", + "name": "solutionConfiguration", + "nameInRequest": "solutionConfiguration", + "doc": "Represent Solution Configuration Resource.", + "type": { + "$id": "1996", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1997", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1998", + "kind": "constant", + "valueType": { + "$id": "1999", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "2000", + "statusCodes": [ + 200 + ], + "headers": [], + "isErrorResponse": false + }, + { + "$id": "2001", + "statusCodes": [ + 204 + ], + "headers": [], + "isErrorResponse": false + } + ], + "httpMethod": "DELETE", + "uri": "{endpoint}", + "path": "/{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionConfigurations.delete", + "decorators": [], + "examples": [ + { + "$id": "2002", + "kind": "http", + "name": "SolutionConfigurations_Delete", + "description": "SolutionConfigurations_Delete", + "filePath": "2024-12-01/SolutionConfigurations_Delete.json", + "parameters": [ + { + "$id": "2003", + "parameter": { + "$ref": "1989" + }, + "value": { + "$id": "2004", + "kind": "string", + "type": { + "$ref": "1990" + }, + "value": "2024-12-01" + } + }, + { + "$id": "2005", + "parameter": { + "$ref": "1993" + }, + "value": { + "$id": "2006", + "kind": "string", + "type": { + "$ref": "1994" + }, + "value": "ymuj" + } + }, + { + "$id": "2007", + "parameter": { + "$ref": "1995" + }, + "value": { + "$id": "2008", + "kind": "string", + "type": { + "$ref": "1996" + }, + "value": "stu" + } + } + ], + "responses": [ + { + "$id": "2009", + "response": { + "$ref": "2000" + }, + "statusCode": 200 + }, + { + "$id": "2010", + "response": { + "$ref": "2001" + }, + "statusCode": 204 + } + ] + } + ] + }, + { + "$id": "2011", + "name": "list", + "resourceName": "SolutionConfiguration", + "doc": "List SolutionConfiguration resources by parent", + "accessibility": "public", + "parameters": [ + { + "$id": "2012", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "2013", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "2014", + "type": { + "$id": "2015", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-12-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "2016", + "name": "resourceUri", + "nameInRequest": "resourceUri", + "doc": "The fully qualified Azure Resource manager identifier of the resource.", + "type": { + "$id": "2017", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "2018", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "2019", + "kind": "constant", + "valueType": { + "$id": "2020", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "2021", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "292" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations", + "bufferResponse": true, + "paging": { + "$id": "2022", + "itemPropertySegments": [ + "value" + ], + "nextLink": { + "$id": "2023", + "responseSegments": [ + "nextLink" + ], + "responseLocation": "Body" + } + }, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionConfigurations.list", + "decorators": [], + "examples": [ + { + "$id": "2024", + "kind": "http", + "name": "SolutionConfigurations_List", + "description": "SolutionConfigurations_List", + "filePath": "2024-12-01/SolutionConfigurations_List.json", + "parameters": [ + { + "$id": "2025", + "parameter": { + "$ref": "2012" + }, + "value": { + "$id": "2026", + "kind": "string", + "type": { + "$ref": "2013" + }, + "value": "2024-12-01" + } + }, + { + "$id": "2027", + "parameter": { + "$ref": "2016" + }, + "value": { + "$id": "2028", + "kind": "string", + "type": { + "$ref": "2017" + }, + "value": "ymuj" + } + } + ], + "responses": [ + { + "$id": "2029", + "response": { + "$ref": "2021" + }, + "statusCode": 200, + "bodyValue": { + "$id": "2030", + "kind": "model", + "type": { + "$ref": "292" + }, + "value": { + "$id": "2031", + "value": { + "$id": "2032", + "kind": "array", + "type": { + "$ref": "294" + }, + "value": [ + { + "$id": "2033", + "kind": "model", + "type": { + "$ref": "250" + }, + "value": { + "$id": "2034", + "properties": { + "$id": "2035", + "kind": "model", + "type": { + "$ref": "253" + }, + "value": { + "$id": "2036", + "solutionType": { + "$id": "2037", + "kind": "string", + "type": { + "$ref": "258" + }, + "value": "Microsoft.AssetManagement" + }, + "solutionSettings": { + "$id": "2038", + "kind": "model", + "type": { + "$ref": "262" + }, + "value": { + "$id": "2039" + } + }, + "provisioningState": { + "$id": "2040", + "kind": "string", + "type": { + "$ref": "26" + }, + "value": "Succeeded" + }, + "status": { + "$id": "2041", + "kind": "string", + "type": { + "$ref": "16" + }, + "value": "AuthorizationPending" + }, + "statusDetails": { + "$id": "2042", + "kind": "string", + "type": { + "$ref": "270" + }, + "value": "Aws authorization validation pending in Aws account" + }, + "lastSyncTime": { + "$id": "2043", + "kind": "string", + "type": { + "$ref": "274" + }, + "value": "2024-01-20T03:24:15.820Z" + } + } + }, + "id": { + "$id": "2044", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "/subscriptions/testSubcrptions/resourceGroups/testResourceGroup/providers/Microsoft.HybridConnectivity/SolutionConfigurations/solutionconfigurationtest" + }, + "name": { + "$id": "2045", + "kind": "string", + "type": { + "$ref": "87" + }, + "value": "solutionconfigurationtest" + }, + "type": { + "$id": "2046", + "kind": "string", + "type": { + "$ref": "91" + }, + "value": "microsoft.hybridconnectivity/solutionconfigurations" + }, + "systemData": { + "$id": "2047", + "kind": "model", + "type": { + "$ref": "96" + }, + "value": { + "$id": "2048", + "createdBy": { + "$id": "2049", + "kind": "string", + "type": { + "$ref": "98" + }, + "value": "rpxzkcrobprrdvuoqxz" + }, + "createdByType": { + "$id": "2050", + "kind": "string", + "type": { + "$ref": "2" + }, + "value": "User" + }, + "createdAt": { + "$id": "2051", + "kind": "string", + "type": { + "$ref": "105" + }, + "value": "2024-01-18T22:52:07.890Z" + }, + "lastModifiedBy": { + "$id": "2052", + "kind": "string", + "type": { + "$ref": "110" + }, + "value": "jidegyskxi" + }, + "lastModifiedByType": { + "$id": "2053", + "kind": "string", + "type": { + "$ref": "2" + }, + "value": "User" + }, + "lastModifiedAt": { + "$id": "2054", + "kind": "string", + "type": { + "$ref": "117" + }, + "value": "2024-01-18T22:52:07.890Z" + } + } + } + } + }, + { + "$id": "2055", + "kind": "model", + "type": { + "$ref": "250" + }, + "value": { + "$id": "2056", + "properties": { + "$id": "2057", + "kind": "model", + "type": { + "$ref": "253" + }, + "value": { + "$id": "2058", + "solutionType": { + "$id": "2059", + "kind": "string", + "type": { + "$ref": "258" + }, + "value": "Microsoft.HybridCompute" + }, + "solutionSettings": { + "$id": "2060", + "kind": "model", + "type": { + "$ref": "262" + }, + "value": { + "$id": "2061" + } + }, + "provisioningState": { + "$id": "2062", + "kind": "string", + "type": { + "$ref": "26" + }, + "value": "Succeeded" + }, + "status": { + "$id": "2063", + "kind": "string", + "type": { + "$ref": "16" + }, + "value": "AuthorizationSuccess" + }, + "statusDetails": { + "$id": "2064", + "kind": "string", + "type": { + "$ref": "270" + }, + "value": "Aws authorization validation succeeded in Aws account" + }, + "lastSyncTime": { + "$id": "2065", + "kind": "string", + "type": { + "$ref": "274" + }, + "value": "2024-01-20T03:24:15.820Z" + } + } + }, + "id": { + "$id": "2066", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "/subscriptions/testSubcrptions/resourceGroups/testResourceGroup/providers/Microsoft.HybridConnectivity/SolutionConfigurations/solutionconfigurationtest2" + }, + "name": { + "$id": "2067", + "kind": "string", + "type": { + "$ref": "87" + }, + "value": "solutionconfigurationtest2" + }, + "type": { + "$id": "2068", + "kind": "string", + "type": { + "$ref": "91" + }, + "value": "microsoft.hybridconnectivity/solutionconfigurations" + }, + "systemData": { + "$id": "2069", + "kind": "model", + "type": { + "$ref": "96" + }, + "value": { + "$id": "2070", + "createdBy": { + "$id": "2071", + "kind": "string", + "type": { + "$ref": "98" + }, + "value": "rpxzkcrobprrdvuoqxz" + }, + "createdByType": { + "$id": "2072", + "kind": "string", + "type": { + "$ref": "2" + }, + "value": "User" + }, + "createdAt": { + "$id": "2073", + "kind": "string", + "type": { + "$ref": "105" + }, + "value": "2024-01-18T22:52:07.890Z" + }, + "lastModifiedBy": { + "$id": "2074", + "kind": "string", + "type": { + "$ref": "110" + }, + "value": "jidegyskxi" + }, + "lastModifiedByType": { + "$id": "2075", + "kind": "string", + "type": { + "$ref": "2" + }, + "value": "User" + }, + "lastModifiedAt": { + "$id": "2076", + "kind": "string", + "type": { + "$ref": "117" + }, + "value": "2024-01-18T22:52:07.890Z" + } + } + } + } + } + ] + }, + "nextLink": { + "$id": "2077", + "kind": "string", + "type": { + "$ref": "298" + }, + "value": "https://microsoft.com/a" + } + } + } + } + ] + } + ] + }, + { + "$id": "2078", + "name": "syncNow", + "resourceName": "SolutionConfigurations", + "doc": "Trigger immediate sync with source cloud", + "accessibility": "public", + "parameters": [ + { + "$id": "2079", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "2080", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "2081", + "type": { + "$id": "2082", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-12-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "2083", + "name": "resourceUri", + "nameInRequest": "resourceUri", + "doc": "The fully qualified Azure Resource manager identifier of the resource.", + "type": { + "$id": "2084", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "2085", + "name": "solutionConfiguration", + "nameInRequest": "solutionConfiguration", + "doc": "Represent Solution Configuration Resource.", + "type": { + "$id": "2086", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "2087", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "2088", + "kind": "constant", + "valueType": { + "$id": "2089", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "2090", + "statusCodes": [ + 202 + ], + "headers": [ + { + "$id": "2091", + "name": "location", + "nameInResponse": "Location", + "doc": "The Location header contains the URL where the status of the long running operation can be checked.", + "type": { + "$id": "2092", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "$id": "2093", + "name": "retryAfter", + "nameInResponse": "Retry-After", + "doc": "The Retry-After header can indicate how long the client should wait before polling the operation status.", + "type": { + "$id": "2094", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + } + } + ], + "isErrorResponse": false + }, + { + "$id": "2095", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "302" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "POST", + "uri": "{endpoint}", + "path": "/{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}/syncNow", + "bufferResponse": true, + "longRunning": { + "$id": "2096", + "finalStateVia": 1, + "finalResponse": { + "$id": "2097", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "302" + } + } + }, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionConfigurations.syncNow", + "decorators": [], + "examples": [ + { + "$id": "2098", + "kind": "http", + "name": "SolutionConfigurations_SyncNow", + "description": "SolutionConfigurations_SyncNow", + "filePath": "2024-12-01/SolutionConfigurations_SyncNow.json", + "parameters": [ + { + "$id": "2099", + "parameter": { + "$ref": "2079" + }, + "value": { + "$id": "2100", + "kind": "string", + "type": { + "$ref": "2080" + }, + "value": "2024-12-01" + } + }, + { + "$id": "2101", + "parameter": { + "$ref": "2083" + }, + "value": { + "$id": "2102", + "kind": "string", + "type": { + "$ref": "2084" + }, + "value": "ymuj" + } + }, + { + "$id": "2103", + "parameter": { + "$ref": "2085" + }, + "value": { + "$id": "2104", + "kind": "string", + "type": { + "$ref": "2086" + }, + "value": "tks" + } + } + ], + "responses": [ + { + "$id": "2105", + "response": { + "$ref": "2095" + }, + "statusCode": 200, + "bodyValue": { + "$id": "2106", + "kind": "model", + "type": { + "$ref": "302" + }, + "value": { + "$id": "2107", + "id": { + "$id": "2108", + "kind": "string", + "type": { + "$ref": "304" + }, + "value": "/subscriptions/5ACC4579-DB34-4C2F-8F8C-25061168F342/providers/Microsoft.HybridConnectivity/PublicCloudConnectors/esixipkbydb" + }, + "resourceId": { + "$id": "2109", + "kind": "string", + "type": { + "$ref": "338" + }, + "value": "/subscriptions/5ACC4579-DB34-4C2F-8F8C-25061168F342/providers/Microsoft.HybridConnectivity/PublicCloudConnectors/esixipkbydb" + }, + "name": { + "$id": "2110", + "kind": "string", + "type": { + "$ref": "309" + }, + "value": "svqtraeuwvyvblujlvqilypwpdrt" + }, + "status": { + "$id": "2111", + "kind": "string", + "type": { + "$ref": "313" + }, + "value": "bevmrejij" + }, + "percentComplete": { + "$id": "2112", + "kind": "number", + "type": { + "$ref": "317" + }, + "value": 15 + }, + "startTime": { + "$id": "2113", + "kind": "string", + "type": { + "$ref": "321" + }, + "value": "2024-10-02T18:38:19.143Z" + }, + "endTime": { + "$id": "2114", + "kind": "string", + "type": { + "$ref": "326" + }, + "value": "2024-10-02T18:38:19.143Z" + }, + "operations": { + "$id": "2115", + "kind": "array", + "type": { + "$ref": "331" + }, + "value": [] + }, + "error": { + "$id": "2116", + "kind": "model", + "type": { + "$ref": "172" + }, + "value": { + "$id": "2117", + "code": { + "$id": "2118", + "kind": "string", + "type": { + "$ref": "174" + }, + "value": "ykzvluyqiftfsumgvwzdh" + }, + "message": { + "$id": "2119", + "kind": "string", + "type": { + "$ref": "178" + }, + "value": "krbjgtqkjgiux" + }, + "target": { + "$id": "2120", + "kind": "string", + "type": { + "$ref": "182" + }, + "value": "nsaucxt" + }, + "details": { + "$id": "2121", + "kind": "array", + "type": { + "$ref": "186" + }, + "value": [] + }, + "additionalInfo": { + "$id": "2122", + "kind": "array", + "type": { + "$ref": "190" + }, + "value": [ + { + "$id": "2123", + "kind": "model", + "type": { + "$ref": "191" + }, + "value": { + "$id": "2124", + "type": { + "$id": "2125", + "kind": "string", + "type": { + "$ref": "193" + }, + "value": "qivvrewsjvcildjgwwytgimwklh" + }, + "info": { + "$id": "2126", + "kind": "model", + "type": { + "$ref": "197" + }, + "value": { + "$id": "2127" + } + } + } + } + ] + } + } + } + } + } + }, + { + "$id": "2128", + "response": { + "$ref": "2090" + }, + "statusCode": 202 + } + ] + } + ] + } + ], + "parameters": [ + { + "$id": "2129", + "name": "endpoint", + "nameInRequest": "endpoint", + "doc": "Service host", + "type": { + "$id": "2130", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url" + }, + "location": "Uri", + "isApiVersion": false, + "isContentType": false, + "isRequired": true, + "isEndpoint": true, + "skipUrlEncoding": false, + "explode": false, + "kind": "Client", + "defaultValue": { + "$id": "2131", + "type": { + "$id": "2132", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "https://management.azure.com" + } + } + ], + "decorators": [ + { + "$id": "2133", + "name": "Azure.ResourceManager.@armResourceOperations", + "arguments": { + "$id": "2134" + } + } + ], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionConfigurations", + "apiVersions": [ + "2024-12-01" + ], + "parent": { + "$ref": "653" + } + }, + { + "$id": "2135", + "kind": "client", + "name": "Inventory", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "operations": [ + { + "$id": "2136", + "name": "get", + "resourceName": "InventoryResource", + "doc": "Get a InventoryResource", + "accessibility": "public", + "parameters": [ + { + "$id": "2137", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "2138", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "2139", + "type": { + "$id": "2140", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-12-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "2141", + "name": "resourceUri", + "nameInRequest": "resourceUri", + "doc": "The fully qualified Azure Resource manager identifier of the resource.", + "type": { + "$id": "2142", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "2143", + "name": "solutionConfiguration", + "nameInRequest": "solutionConfiguration", + "doc": "Represent Solution Configuration Resource.", + "type": { + "$id": "2144", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "2145", + "name": "inventoryId", + "nameInRequest": "inventoryId", + "doc": "Inventory resource", + "type": { + "$id": "2146", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "2147", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "2148", + "kind": "constant", + "valueType": { + "$id": "2149", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "2150", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "214" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}/inventory/{inventoryId}", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.Inventory.get", + "decorators": [], + "examples": [ + { + "$id": "2151", + "kind": "http", + "name": "Inventory_Get", + "description": "Inventory_Get", + "filePath": "2024-12-01/Inventory_Get.json", + "parameters": [ + { + "$id": "2152", + "parameter": { + "$ref": "2137" + }, + "value": { + "$id": "2153", + "kind": "string", + "type": { + "$ref": "2138" + }, + "value": "2024-12-01" + } + }, + { + "$id": "2154", + "parameter": { + "$ref": "2141" + }, + "value": { + "$id": "2155", + "kind": "string", + "type": { + "$ref": "2142" + }, + "value": "ymuj" + } + }, + { + "$id": "2156", + "parameter": { + "$ref": "2143" + }, + "value": { + "$id": "2157", + "kind": "string", + "type": { + "$ref": "2144" + }, + "value": "zarfsraogroxlaqjjnwixtn" + } + }, + { + "$id": "2158", + "parameter": { + "$ref": "2145" + }, + "value": { + "$id": "2159", + "kind": "string", + "type": { + "$ref": "2146" + }, + "value": "xofprmcboosrbd" + } + } + ], + "responses": [ + { + "$id": "2160", + "response": { + "$ref": "2150" + }, + "statusCode": 200, + "bodyValue": { + "$id": "2161", + "kind": "model", + "type": { + "$ref": "214" + }, + "value": { + "$id": "2162", + "properties": { + "$id": "2163", + "kind": "model", + "type": { + "$ref": "216" + }, + "value": { + "$id": "2164", + "cloudNativeType": { + "$id": "2165", + "kind": "string", + "type": { + "$ref": "12" + }, + "value": "ec2" + }, + "cloudNativeResourceId": { + "$id": "2166", + "kind": "string", + "type": { + "$ref": "221" + }, + "value": "ljnxclzxficxhdkr" + }, + "azureResourceId": { + "$id": "2167", + "kind": "string", + "type": { + "$ref": "225" + }, + "value": "ttzebbjzatugawuqxdupzmxkt" + }, + "status": { + "$id": "2168", + "kind": "string", + "type": { + "$ref": "16" + }, + "value": "New" + }, + "statusDetails": { + "$id": "2169", + "kind": "string", + "type": { + "$ref": "232" + }, + "value": "wxvnfzivtx" + }, + "provisioningState": { + "$id": "2170", + "kind": "string", + "type": { + "$ref": "26" + }, + "value": "Succeeded" + } + } + }, + "id": { + "$id": "2171", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "/subscriptions/testSubcrptions/resourceGroups/testResourceGroup/providers/Microsoft.HybridConnectivity/SolutionConfigurations/qpwubemzmootxmtlxaerir/Inventory/xipjenocwvsqhhrplwmxwl" + }, + "name": { + "$id": "2172", + "kind": "string", + "type": { + "$ref": "87" + }, + "value": "xipjenocwvsqhhrplwmxwl" + }, + "type": { + "$id": "2173", + "kind": "string", + "type": { + "$ref": "91" + }, + "value": "jahwzrspsufypeouigsywjrx" + }, + "systemData": { + "$id": "2174", + "kind": "model", + "type": { + "$ref": "96" + }, + "value": { + "$id": "2175", + "createdBy": { + "$id": "2176", + "kind": "string", + "type": { + "$ref": "98" + }, + "value": "rpxzkcrobprrdvuoqxz" + }, + "createdByType": { + "$id": "2177", + "kind": "string", + "type": { + "$ref": "2" + }, + "value": "User" + }, + "createdAt": { + "$id": "2178", + "kind": "string", + "type": { + "$ref": "105" + }, + "value": "2024-01-18T22:52:07.890Z" + }, + "lastModifiedBy": { + "$id": "2179", + "kind": "string", + "type": { + "$ref": "110" + }, + "value": "jidegyskxi" + }, + "lastModifiedByType": { + "$id": "2180", + "kind": "string", + "type": { + "$ref": "2" + }, + "value": "User" + }, + "lastModifiedAt": { + "$id": "2181", + "kind": "string", + "type": { + "$ref": "117" + }, + "value": "2024-01-18T22:52:07.890Z" + } + } + } + } + } + } + ] + } + ] + }, + { + "$id": "2182", + "name": "listBySolutionConfiguration", + "resourceName": "InventoryResource", + "doc": "List InventoryResource resources by SolutionConfiguration", + "accessibility": "public", + "parameters": [ + { + "$id": "2183", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "2184", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "2185", + "type": { + "$id": "2186", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-12-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "2187", + "name": "resourceUri", + "nameInRequest": "resourceUri", + "doc": "The fully qualified Azure Resource manager identifier of the resource.", + "type": { + "$id": "2188", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": true + }, + { + "$id": "2189", + "name": "solutionConfiguration", + "nameInRequest": "solutionConfiguration", + "doc": "Represent Solution Configuration Resource.", + "type": { + "$id": "2190", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "2191", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "2192", + "kind": "constant", + "valueType": { + "$id": "2193", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "2194", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "240" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}/inventory", + "bufferResponse": true, + "paging": { + "$id": "2195", + "itemPropertySegments": [ + "value" + ], + "nextLink": { + "$id": "2196", + "responseSegments": [ + "nextLink" + ], + "responseLocation": "Body" + } + }, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.Inventory.listBySolutionConfiguration", + "decorators": [], + "examples": [ + { + "$id": "2197", + "kind": "http", + "name": "Inventory_ListBySolutionConfiguration", + "description": "Inventory_ListBySolutionConfiguration", + "filePath": "2024-12-01/Inventory_ListBySolutionConfiguration.json", + "parameters": [ + { + "$id": "2198", + "parameter": { + "$ref": "2183" + }, + "value": { + "$id": "2199", + "kind": "string", + "type": { + "$ref": "2184" + }, + "value": "2024-12-01" + } + }, + { + "$id": "2200", + "parameter": { + "$ref": "2187" + }, + "value": { + "$id": "2201", + "kind": "string", + "type": { + "$ref": "2188" + }, + "value": "ymuj" + } + }, + { + "$id": "2202", + "parameter": { + "$ref": "2189" + }, + "value": { + "$id": "2203", + "kind": "string", + "type": { + "$ref": "2190" + }, + "value": "wsxt" + } + } + ], + "responses": [ + { + "$id": "2204", + "response": { + "$ref": "2194" + }, + "statusCode": 200, + "bodyValue": { + "$id": "2205", + "kind": "model", + "type": { + "$ref": "240" + }, + "value": { + "$id": "2206", + "value": { + "$id": "2207", + "kind": "array", + "type": { + "$ref": "242" + }, + "value": [ + { + "$id": "2208", + "kind": "model", + "type": { + "$ref": "214" + }, + "value": { + "$id": "2209", + "properties": { + "$id": "2210", + "kind": "model", + "type": { + "$ref": "216" + }, + "value": { + "$id": "2211", + "cloudNativeType": { + "$id": "2212", + "kind": "string", + "type": { + "$ref": "12" + }, + "value": "ec2" + }, + "cloudNativeResourceId": { + "$id": "2213", + "kind": "string", + "type": { + "$ref": "221" + }, + "value": "ljnxclzxficxhdkr" + }, + "azureResourceId": { + "$id": "2214", + "kind": "string", + "type": { + "$ref": "225" + }, + "value": "ttzebbjzatugawuqxdupzmxkt" + }, + "status": { + "$id": "2215", + "kind": "string", + "type": { + "$ref": "16" + }, + "value": "New" + }, + "statusDetails": { + "$id": "2216", + "kind": "string", + "type": { + "$ref": "232" + }, + "value": "wxvnfzivtx" + }, + "provisioningState": { + "$id": "2217", + "kind": "string", + "type": { + "$ref": "26" + }, + "value": "Succeeded" + } + } + }, + "id": { + "$id": "2218", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "/subscriptions/testSubcrptions/resourceGroups/testResourceGroup/providers/Microsoft.HybridConnectivity/SolutionConfigurations/qpwubemzmootxmtlxaerir/Inventory/xipjenocwvsqhhrplwmxwl" + }, + "name": { + "$id": "2219", + "kind": "string", + "type": { + "$ref": "87" + }, + "value": "xipjenocwvsqhhrplwmxwl" + }, + "type": { + "$id": "2220", + "kind": "string", + "type": { + "$ref": "91" + }, + "value": "jahwzrspsufypeouigsywjrx" + }, + "systemData": { + "$id": "2221", + "kind": "model", + "type": { + "$ref": "96" + }, + "value": { + "$id": "2222", + "createdBy": { + "$id": "2223", + "kind": "string", + "type": { + "$ref": "98" + }, + "value": "rpxzkcrobprrdvuoqxz" + }, + "createdByType": { + "$id": "2224", + "kind": "string", + "type": { + "$ref": "2" + }, + "value": "User" + }, + "createdAt": { + "$id": "2225", + "kind": "string", + "type": { + "$ref": "105" + }, + "value": "2024-01-18T22:52:07.890Z" + }, + "lastModifiedBy": { + "$id": "2226", + "kind": "string", + "type": { + "$ref": "110" + }, + "value": "jidegyskxi" + }, + "lastModifiedByType": { + "$id": "2227", + "kind": "string", + "type": { + "$ref": "2" + }, + "value": "User" + }, + "lastModifiedAt": { + "$id": "2228", + "kind": "string", + "type": { + "$ref": "117" + }, + "value": "2024-01-18T22:52:07.890Z" + } + } + } + } + } + ] + }, + "nextLink": { + "$id": "2229", + "kind": "string", + "type": { + "$ref": "246" + }, + "value": "https://microsoft.com/a" + } + } + } + } + ] + } + ] + } + ], + "parameters": [ + { + "$id": "2230", + "name": "endpoint", + "nameInRequest": "endpoint", + "doc": "Service host", + "type": { + "$id": "2231", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url" + }, + "location": "Uri", + "isApiVersion": false, + "isContentType": false, + "isRequired": true, + "isEndpoint": true, + "skipUrlEncoding": false, + "explode": false, + "kind": "Client", + "defaultValue": { + "$id": "2232", + "type": { + "$id": "2233", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "https://management.azure.com" + } + } + ], + "decorators": [ + { + "$id": "2234", + "name": "Azure.ResourceManager.@armResourceOperations", + "arguments": { + "$id": "2235" + } + } + ], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.Inventory", + "apiVersions": [ + "2024-12-01" + ], + "parent": { + "$ref": "653" + } + }, + { + "$id": "2236", + "kind": "client", + "name": "SolutionTypes", + "namespace": "Azure.ResourceManager.HybridConnectivity", + "operations": [ + { + "$id": "2237", + "name": "get", + "resourceName": "SolutionTypeResource", + "doc": "Get a SolutionTypeResource", + "accessibility": "public", + "parameters": [ + { + "$id": "2238", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "2239", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "2240", + "type": { + "$id": "2241", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-12-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "2242", + "name": "subscriptionId", + "nameInRequest": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "2243", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "2244", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "2245", + "name": "resourceGroupName", + "nameInRequest": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2246", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "2247", + "name": "solutionType", + "nameInRequest": "solutionType", + "doc": "Solution Type resource", + "type": { + "$id": "2248", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "2249", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "2250", + "kind": "constant", + "valueType": { + "$id": "2251", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "2252", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "78" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/solutionTypes/{solutionType}", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionTypes.get", + "decorators": [], + "examples": [ + { + "$id": "2253", + "kind": "http", + "name": "SolutionTypes_Get", + "description": "SolutionTypes_Get", + "filePath": "2024-12-01/SolutionTypes_Get.json", + "parameters": [ + { + "$id": "2254", + "parameter": { + "$ref": "2238" + }, + "value": { + "$id": "2255", + "kind": "string", + "type": { + "$ref": "2239" + }, + "value": "2024-12-01" + } + }, + { + "$id": "2256", + "parameter": { + "$ref": "2242" + }, + "value": { + "$id": "2257", + "kind": "string", + "type": { + "$ref": "2243" + }, + "value": "5ACC4579-DB34-4C2F-8F8C-25061168F342" + } + }, + { + "$id": "2258", + "parameter": { + "$ref": "2245" + }, + "value": { + "$id": "2259", + "kind": "string", + "type": { + "$ref": "2246" + }, + "value": "rgpublicCloud" + } + }, + { + "$id": "2260", + "parameter": { + "$ref": "2247" + }, + "value": { + "$id": "2261", + "kind": "string", + "type": { + "$ref": "2248" + }, + "value": "lulzqllpu" + } + } + ], + "responses": [ + { + "$id": "2262", + "response": { + "$ref": "2252" + }, + "statusCode": 200, + "bodyValue": { + "$id": "2263", + "kind": "model", + "type": { + "$ref": "78" + }, + "value": { + "$id": "2264", + "properties": { + "$id": "2265", + "kind": "model", + "type": { + "$ref": "124" + }, + "value": { + "$id": "2266", + "solutionType": { + "$id": "2267", + "kind": "string", + "type": { + "$ref": "126" + }, + "value": "tjtoeycxhyqxtgd" + }, + "description": { + "$id": "2268", + "kind": "string", + "type": { + "$ref": "130" + }, + "value": "wxyxcvtzuxgodtlanjevedwfdwnznc" + }, + "supportedAzureRegions": { + "$id": "2269", + "kind": "array", + "type": { + "$ref": "134" + }, + "value": [ + { + "$id": "2270", + "kind": "string", + "type": { + "$ref": "135" + }, + "value": "cimocdh" + } + ] + }, + "solutionSettings": { + "$id": "2271", + "kind": "array", + "type": { + "$ref": "139" + }, + "value": [ + { + "$id": "2272", + "kind": "model", + "type": { + "$ref": "140" + }, + "value": { + "$id": "2273", + "name": { + "$id": "2274", + "kind": "string", + "type": { + "$ref": "142" + }, + "value": "tepghdgbefujhnnue" + }, + "displayName": { + "$id": "2275", + "kind": "string", + "type": { + "$ref": "146" + }, + "value": "mwlzepoin" + }, + "type": { + "$id": "2276", + "kind": "string", + "type": { + "$ref": "150" + }, + "value": "je" + }, + "description": { + "$id": "2277", + "kind": "string", + "type": { + "$ref": "154" + }, + "value": "soq" + }, + "allowedValues": { + "$id": "2278", + "kind": "array", + "type": { + "$ref": "158" + }, + "value": [ + { + "$id": "2279", + "kind": "string", + "type": { + "$ref": "159" + }, + "value": "pwizyngpkpxsllpluffjspx" + } + ] + }, + "defaultValue": { + "$id": "2280", + "kind": "string", + "type": { + "$ref": "163" + }, + "value": "laekyetgapdpxyqervqaqfscfwagek" + } + } + } + ] + } + } + }, + "id": { + "$id": "2281", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "/subscriptions/testSubcrptions/resourceGroups/testResourceGroup/providers/Microsoft.HybridConnectivity/solutionTypes/j" + }, + "name": { + "$id": "2282", + "kind": "string", + "type": { + "$ref": "87" + }, + "value": "xczyyxuphhacyyj" + }, + "type": { + "$id": "2283", + "kind": "string", + "type": { + "$ref": "91" + }, + "value": "mf" + }, + "systemData": { + "$id": "2284", + "kind": "model", + "type": { + "$ref": "96" + }, + "value": { + "$id": "2285", + "createdBy": { + "$id": "2286", + "kind": "string", + "type": { + "$ref": "98" + }, + "value": "rpxzkcrobprrdvuoqxz" + }, + "createdByType": { + "$id": "2287", + "kind": "string", + "type": { + "$ref": "2" + }, + "value": "User" + }, + "createdAt": { + "$id": "2288", + "kind": "string", + "type": { + "$ref": "105" + }, + "value": "2024-01-18T22:52:07.890Z" + }, + "lastModifiedBy": { + "$id": "2289", + "kind": "string", + "type": { + "$ref": "110" + }, + "value": "jidegyskxi" + }, + "lastModifiedByType": { + "$id": "2290", + "kind": "string", + "type": { + "$ref": "2" + }, + "value": "User" + }, + "lastModifiedAt": { + "$id": "2291", + "kind": "string", + "type": { + "$ref": "117" + }, + "value": "2024-01-18T22:52:07.890Z" + } + } + } + } + } + } + ] + } + ] + }, + { + "$id": "2292", + "name": "listByResourceGroup", + "resourceName": "SolutionTypeResource", + "doc": "List SolutionTypeResource resources by resource group", + "accessibility": "public", + "parameters": [ + { + "$id": "2293", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "2294", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "2295", + "type": { + "$id": "2296", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-12-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "2297", + "name": "subscriptionId", + "nameInRequest": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "2298", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "2299", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "2300", + "name": "resourceGroupName", + "nameInRequest": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2301", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "2302", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "2303", + "kind": "constant", + "valueType": { + "$id": "2304", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "2305", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "204" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/solutionTypes", + "bufferResponse": true, + "paging": { + "$id": "2306", + "itemPropertySegments": [ + "value" + ], + "nextLink": { + "$id": "2307", + "responseSegments": [ + "nextLink" + ], + "responseLocation": "Body" + } + }, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionTypes.listByResourceGroup", + "decorators": [], + "examples": [ + { + "$id": "2308", + "kind": "http", + "name": "SolutionTypes_ListByResourceGroup", + "description": "SolutionTypes_ListByResourceGroup", + "filePath": "2024-12-01/SolutionTypes_ListByResourceGroup.json", + "parameters": [ + { + "$id": "2309", + "parameter": { + "$ref": "2293" + }, + "value": { + "$id": "2310", + "kind": "string", + "type": { + "$ref": "2294" + }, + "value": "2024-12-01" + } + }, + { + "$id": "2311", + "parameter": { + "$ref": "2297" + }, + "value": { + "$id": "2312", + "kind": "string", + "type": { + "$ref": "2298" + }, + "value": "5ACC4579-DB34-4C2F-8F8C-25061168F342" + } + }, + { + "$id": "2313", + "parameter": { + "$ref": "2300" + }, + "value": { + "$id": "2314", + "kind": "string", + "type": { + "$ref": "2301" + }, + "value": "rgpublicCloud" + } + } + ], + "responses": [ + { + "$id": "2315", + "response": { + "$ref": "2305" + }, + "statusCode": 200, + "bodyValue": { + "$id": "2316", + "kind": "model", + "type": { + "$ref": "204" + }, + "value": { + "$id": "2317", + "value": { + "$id": "2318", + "kind": "array", + "type": { + "$ref": "206" + }, + "value": [ + { + "$id": "2319", + "kind": "model", + "type": { + "$ref": "78" + }, + "value": { + "$id": "2320", + "properties": { + "$id": "2321", + "kind": "model", + "type": { + "$ref": "124" + }, + "value": { + "$id": "2322", + "solutionType": { + "$id": "2323", + "kind": "string", + "type": { + "$ref": "126" + }, + "value": "j" + }, + "description": { + "$id": "2324", + "kind": "string", + "type": { + "$ref": "130" + }, + "value": "mhasmuazxsr" + }, + "supportedAzureRegions": { + "$id": "2325", + "kind": "array", + "type": { + "$ref": "134" + }, + "value": [ + { + "$id": "2326", + "kind": "string", + "type": { + "$ref": "135" + }, + "value": "jfvkgljymtuzfwbumgabpdpjjnxit" + } + ] + }, + "solutionSettings": { + "$id": "2327", + "kind": "array", + "type": { + "$ref": "139" + }, + "value": [ + { + "$id": "2328", + "kind": "model", + "type": { + "$ref": "140" + }, + "value": { + "$id": "2329", + "name": { + "$id": "2330", + "kind": "string", + "type": { + "$ref": "142" + }, + "value": "eepvybtmsjwgcpf" + }, + "displayName": { + "$id": "2331", + "kind": "string", + "type": { + "$ref": "146" + }, + "value": "npxunbwkjrklbjsvdryzsjtecm" + }, + "type": { + "$id": "2332", + "kind": "string", + "type": { + "$ref": "150" + }, + "value": "fngmzlffmwmrglepeyce" + }, + "description": { + "$id": "2333", + "kind": "string", + "type": { + "$ref": "154" + }, + "value": "vdtvoysdagvae" + }, + "allowedValues": { + "$id": "2334", + "kind": "array", + "type": { + "$ref": "158" + }, + "value": [ + { + "$id": "2335", + "kind": "string", + "type": { + "$ref": "159" + }, + "value": "cgbkgbmsgsfofmcrjerg" + } + ] + }, + "defaultValue": { + "$id": "2336", + "kind": "string", + "type": { + "$ref": "163" + }, + "value": "knshmo" + } + } + } + ] + } + } + }, + "id": { + "$id": "2337", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "/subscriptions/testSubcrptions/resourceGroups/testResourceGroup/providers/Microsoft.HybridConnectivity/solutionTypes/j" + }, + "name": { + "$id": "2338", + "kind": "string", + "type": { + "$ref": "87" + }, + "value": "yzgpvbtzwvijawjgfvnhgbqefqq" + }, + "type": { + "$id": "2339", + "kind": "string", + "type": { + "$ref": "91" + }, + "value": "vamwfnqqpjosjnomwbkwnlnrg" + }, + "systemData": { + "$id": "2340", + "kind": "model", + "type": { + "$ref": "96" + }, + "value": { + "$id": "2341", + "createdBy": { + "$id": "2342", + "kind": "string", + "type": { + "$ref": "98" + }, + "value": "rpxzkcrobprrdvuoqxz" + }, + "createdByType": { + "$id": "2343", + "kind": "string", + "type": { + "$ref": "2" + }, + "value": "User" + }, + "createdAt": { + "$id": "2344", + "kind": "string", + "type": { + "$ref": "105" + }, + "value": "2024-01-18T22:52:07.890Z" + }, + "lastModifiedBy": { + "$id": "2345", + "kind": "string", + "type": { + "$ref": "110" + }, + "value": "jidegyskxi" + }, + "lastModifiedByType": { + "$id": "2346", + "kind": "string", + "type": { + "$ref": "2" + }, + "value": "User" + }, + "lastModifiedAt": { + "$id": "2347", + "kind": "string", + "type": { + "$ref": "117" + }, + "value": "2024-01-18T22:52:07.890Z" + } + } + } + } + } + ] + }, + "nextLink": { + "$id": "2348", + "kind": "string", + "type": { + "$ref": "210" + }, + "value": "https://microsoft.com/a" + } + } + } + } + ] + } + ] + }, + { + "$id": "2349", + "name": "listBySubscription", + "resourceName": "SolutionTypeResource", + "doc": "List SolutionTypeResource resources by subscription ID", + "accessibility": "public", + "parameters": [ + { + "$id": "2350", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "2351", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "2352", + "type": { + "$id": "2353", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-12-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "2354", + "name": "subscriptionId", + "nameInRequest": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "2355", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "2356", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "2357", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "2358", + "kind": "constant", + "valueType": { + "$id": "2359", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "2360", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "204" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridConnectivity/solutionTypes", + "bufferResponse": true, + "paging": { + "$id": "2361", + "itemPropertySegments": [ + "value" + ], + "nextLink": { + "$id": "2362", + "responseSegments": [ + "nextLink" + ], + "responseLocation": "Body" + } + }, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionTypes.listBySubscription", + "decorators": [], + "examples": [ + { + "$id": "2363", + "kind": "http", + "name": "SolutionTypes_ListBySubscription", + "description": "SolutionTypes_ListBySubscription", + "filePath": "2024-12-01/SolutionTypes_ListBySubscription.json", + "parameters": [ + { + "$id": "2364", + "parameter": { + "$ref": "2350" + }, + "value": { + "$id": "2365", + "kind": "string", + "type": { + "$ref": "2351" + }, + "value": "2024-12-01" + } + }, + { + "$id": "2366", + "parameter": { + "$ref": "2354" + }, + "value": { + "$id": "2367", + "kind": "string", + "type": { + "$ref": "2355" + }, + "value": "5ACC4579-DB34-4C2F-8F8C-25061168F342" + } + } + ], + "responses": [ + { + "$id": "2368", + "response": { + "$ref": "2360" + }, + "statusCode": 200, + "bodyValue": { + "$id": "2369", + "kind": "model", + "type": { + "$ref": "204" + }, + "value": { + "$id": "2370", + "value": { + "$id": "2371", + "kind": "array", + "type": { + "$ref": "206" + }, + "value": [ + { + "$id": "2372", + "kind": "model", + "type": { + "$ref": "78" + }, + "value": { + "$id": "2373", + "properties": { + "$id": "2374", + "kind": "model", + "type": { + "$ref": "124" + }, + "value": { + "$id": "2375", + "solutionType": { + "$id": "2376", + "kind": "string", + "type": { + "$ref": "126" + }, + "value": "dembhpcydwoiyszmjtniletpy" + }, + "description": { + "$id": "2377", + "kind": "string", + "type": { + "$ref": "130" + }, + "value": "fkegiumpjdwgkde" + }, + "supportedAzureRegions": { + "$id": "2378", + "kind": "array", + "type": { + "$ref": "134" + }, + "value": [ + { + "$id": "2379", + "kind": "string", + "type": { + "$ref": "135" + }, + "value": "ujawbfint" + } + ] + }, + "solutionSettings": { + "$id": "2380", + "kind": "array", + "type": { + "$ref": "139" + }, + "value": [ + { + "$id": "2381", + "kind": "model", + "type": { + "$ref": "140" + }, + "value": { + "$id": "2382", + "name": { + "$id": "2383", + "kind": "string", + "type": { + "$ref": "142" + }, + "value": "i" + }, + "displayName": { + "$id": "2384", + "kind": "string", + "type": { + "$ref": "146" + }, + "value": "forzmqskffaub" + }, + "type": { + "$id": "2385", + "kind": "string", + "type": { + "$ref": "150" + }, + "value": "d" + }, + "description": { + "$id": "2386", + "kind": "string", + "type": { + "$ref": "154" + }, + "value": "cbyxsxfsaye" + }, + "allowedValues": { + "$id": "2387", + "kind": "array", + "type": { + "$ref": "158" + }, + "value": [ + { + "$id": "2388", + "kind": "string", + "type": { + "$ref": "159" + }, + "value": "uecqnmmssdeusxejcxrtkskfugvl" + } + ] + }, + "defaultValue": { + "$id": "2389", + "kind": "string", + "type": { + "$ref": "163" + }, + "value": "uzwiymoxrummkoowwvzjhyazeavzr" + } + } + } + ] + } + } + }, + "id": { + "$id": "2390", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "/subscriptions/testSubcrptions/resourceGroups/testResourceGroup/providers/Microsoft.HybridConnectivity/solutionTypes/i" + }, + "name": { + "$id": "2391", + "kind": "string", + "type": { + "$ref": "87" + }, + "value": "jtlxwihbuftmaobxfmfjojalhpwrv" + }, + "type": { + "$id": "2392", + "kind": "string", + "type": { + "$ref": "91" + }, + "value": "zditfautattfhnffvjw" + }, + "systemData": { + "$id": "2393", + "kind": "model", + "type": { + "$ref": "96" + }, + "value": { + "$id": "2394", + "createdBy": { + "$id": "2395", + "kind": "string", + "type": { + "$ref": "98" + }, + "value": "rpxzkcrobprrdvuoqxz" + }, + "createdByType": { + "$id": "2396", + "kind": "string", + "type": { + "$ref": "2" + }, + "value": "User" + }, + "createdAt": { + "$id": "2397", + "kind": "string", + "type": { + "$ref": "105" + }, + "value": "2024-01-18T22:52:07.890Z" + }, + "lastModifiedBy": { + "$id": "2398", + "kind": "string", + "type": { + "$ref": "110" + }, + "value": "jidegyskxi" + }, + "lastModifiedByType": { + "$id": "2399", + "kind": "string", + "type": { + "$ref": "2" + }, + "value": "User" + }, + "lastModifiedAt": { + "$id": "2400", + "kind": "string", + "type": { + "$ref": "117" + }, + "value": "2024-01-18T22:52:07.890Z" + } + } + } + } + } + ] + }, + "nextLink": { + "$id": "2401", + "kind": "string", + "type": { + "$ref": "210" + }, + "value": "https://microsoft.com/a" + } + } + } + } + ] + } + ] + } + ], + "parameters": [ + { + "$id": "2402", + "name": "endpoint", + "nameInRequest": "endpoint", + "doc": "Service host", + "type": { + "$id": "2403", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url" + }, + "location": "Uri", + "isApiVersion": false, + "isContentType": false, + "isRequired": true, + "isEndpoint": true, + "skipUrlEncoding": false, + "explode": false, + "kind": "Client", + "defaultValue": { + "$id": "2404", + "type": { + "$id": "2405", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "https://management.azure.com" + } + } + ], + "decorators": [ + { + "$id": "2406", + "name": "Azure.ResourceManager.@armResourceOperations", + "arguments": { + "$id": "2407" + } + } + ], + "crossLanguageDefinitionId": "Microsoft.HybridConnectivity.SolutionTypes", + "apiVersions": [ + "2024-12-01" + ], + "parent": { + "$ref": "653" + } + } + ] + } + ], + "auth": { + "$id": "2408", + "oAuth2": { + "$id": "2409", + "scopes": [ + "user_impersonation" + ] + } + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/autorest.md b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/autorest.md index a3e642303165..e8fa50867901 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/autorest.md +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/autorest.md @@ -8,7 +8,7 @@ azure-arm: true csharp: true library-name: Kubernetes namespace: Azure.ResourceManager.Kubernetes -require: https://github.com/Azure/azure-rest-api-specs/blob/7d5d1db0c45d6fe0934c97b6a6f9bb34112d42d1/specification/hybridkubernetes/resource-manager/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/hybridkubernetes/resource-manager/readme.md tag: package-2022-05-01-preview output-folder: $(this-folder)/Generated clear-output-folder: true diff --git a/sdk/liftrarize/Azure.ResourceManager.ArizeAIObservabilityEval/tsp-location.yaml b/sdk/liftrarize/Azure.ResourceManager.ArizeAIObservabilityEval/tsp-location.yaml new file mode 100644 index 000000000000..002e8733abbd --- /dev/null +++ b/sdk/liftrarize/Azure.ResourceManager.ArizeAIObservabilityEval/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/liftrarize/ArizeAi.ObservabilityEval.Management +commit: 54b1384a56710dd114569774b5f90a6b5778bd31 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/tsp-location.yaml b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/tsp-location.yaml new file mode 100644 index 000000000000..2be6afa5d741 --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/liftrweightsandbiases/Liftr.WeightsAndBiases.Management +commit: 54b1384a56710dd114569774b5f90a6b5778bd31 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/pineconevectordb/Azure.ResourceManager.PineconeVectorDb/tsp-location.yaml b/sdk/pineconevectordb/Azure.ResourceManager.PineconeVectorDb/tsp-location.yaml new file mode 100644 index 000000000000..fddd92219c28 --- /dev/null +++ b/sdk/pineconevectordb/Azure.ResourceManager.PineconeVectorDb/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/liftrpinecone/Pinecone.VectorDb.Management +commit: 54b1384a56710dd114569774b5f90a6b5778bd31 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/resourcemanager/ci.mgmt.yml b/sdk/resourcemanager/ci.mgmt.yml index 4e3c032f60a4..466f1335c58e 100644 --- a/sdk/resourcemanager/ci.mgmt.yml +++ b/sdk/resourcemanager/ci.mgmt.yml @@ -79,6 +79,7 @@ trigger: - sdk/digitaltwins/Azure.ResourceManager.DigitalTwins - sdk/dns/Azure.ResourceManager.Dns - sdk/dnsresolver/Azure.ResourceManager.DnsResolver + - sdk/durabletask/Azure.ResourceManager.DurableTask - sdk/dynatrace/Azure.ResourceManager.Dynatrace - sdk/edgeorder/Azure.ResourceManager.EdgeOrder - sdk/edgezones/Azure.ResourceManager.EdgeZones @@ -288,6 +289,7 @@ pr: - sdk/digitaltwins/Azure.ResourceManager.DigitalTwins - sdk/dns/Azure.ResourceManager.Dns - sdk/dnsresolver/Azure.ResourceManager.DnsResolver + - sdk/durabletask/Azure.ResourceManager.DurableTask - sdk/dynatrace/Azure.ResourceManager.Dynatrace - sdk/edgeorder/Azure.ResourceManager.EdgeOrder - sdk/edgezones/Azure.ResourceManager.EdgeZones diff --git a/sdk/storage/ci.yml b/sdk/storage/ci.yml index 2ca0501b60bd..6d83bf7eebb6 100644 --- a/sdk/storage/ci.yml +++ b/sdk/storage/ci.yml @@ -9,9 +9,17 @@ trigger: paths: include: - sdk/storage/ + exclude: + - sdk/storage/Azure.ResourceManager.Storage/ - sdk/storage/Azure.Storage.DataMovement/ + exclude: + - sdk/storage/Azure.ResourceManager.Storage/ - sdk/storage/Azure.Storage.DataMovement.Blobs/ + exclude: + - sdk/storage/Azure.ResourceManager.Storage/ - sdk/storage/Azure.Storage.DataMovement.Files/ + exclude: + - sdk/storage/Azure.ResourceManager.Storage/ - sdk/storage/Azure.Storage.DataMovement.Blobs.Files.Shares/ exclude: - sdk/storage/Azure.ResourceManager.Storage/