diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/LICENSE b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/LICENSE new file mode 100644 index 0000000000..63447fd8bb --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/LICENSE @@ -0,0 +1,21 @@ +Copyright (c) Microsoft Corporation. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/README.md b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/README.md new file mode 100644 index 0000000000..b0331d0762 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/README.md @@ -0,0 +1,111 @@ +# Azure ConfluentManagement client library for JavaScript + +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure ConfluentManagement client. + + + +Key links: + +- [Package (NPM)](https://www.npmjs.com/package/@azure/arm-confluent) +- [API reference documentation](https://learn.microsoft.com/javascript/api/@azure/arm-confluent?view=azure-node-preview) + +## Getting started + +### Currently supported environments + +- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule) +- Latest versions of Safari, Chrome, Edge and Firefox. + +See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. + +### Prerequisites + +- An [Azure subscription][azure_sub]. + +### Install the `@azure/arm-confluent` package + +Install the Azure ConfluentManagement client library for JavaScript with `npm`: + +```bash +npm install @azure/arm-confluent +``` + +### Create and authenticate a `ConfluentClient` + +To create a client object to access the Azure ConfluentManagement API, you will need the `endpoint` of your Azure ConfluentManagement resource and a `credential`. The Azure ConfluentManagement client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure ConfluentManagement resource in the [Azure Portal][azure_portal]. + +You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). + +To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: + +```bash +npm install @azure/identity +``` + +You will also need to **register a new AAD application and grant access to Azure ConfluentManagement** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). + +For more information about how to create an Azure AD Application check out [this guide](https://learn.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). + +Using Node.js and Node-like environments, you can use the `DefaultAzureCredential` class to authenticate the client. + +```ts +import { ConfluentClient } from "@azure/arm-confluent"; +import { DefaultAzureCredential } from "@azure/identity"; + +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new ConfluentClient(new DefaultAzureCredential(), subscriptionId); +``` + +For browser environments, use the `InteractiveBrowserCredential` from the `@azure/identity` package to authenticate. + +```ts +import { InteractiveBrowserCredential } from "@azure/identity"; +import { ConfluentClient } from "@azure/arm-confluent"; + +const credential = new InteractiveBrowserCredential({ + tenantId: "", + clientId: "", + }); + +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new ConfluentClient(credential, subscriptionId); +``` + + +### JavaScript Bundle +To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling). + +## Key concepts + +### ConfluentClient + +`ConfluentClient` is the primary interface for developers using the Azure ConfluentManagement client library. Explore the methods on this client object to understand the different features of the Azure ConfluentManagement service that you can access. + +## Troubleshooting + +### Logging + +Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`: + +```ts +import { setLogLevel } from "@azure/logger"; + +setLogLevel("info"); +``` + +For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger). + + +## Contributing + +If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. + +## Related projects + +- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) + +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/api-extractor.json b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/api-extractor.json new file mode 100644 index 0000000000..f456a56834 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/api-extractor.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "dist/esm/index.d.ts", + "docModel": { "enabled": true }, + "apiReport": { "enabled": true, "reportFolder": "./review" }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "dist/arm-confluent.d.ts" + }, + "messages": { + "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "extractorMessageReporting": { + "ae-missing-release-tag": { "logLevel": "none" }, + "ae-unresolved-link": { "logLevel": "none" } + } + } +} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/eslint.config.mjs b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/eslint.config.mjs new file mode 100644 index 0000000000..9396819633 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/eslint.config.mjs @@ -0,0 +1,14 @@ +import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; + +export default azsdkEslint.config([ + { + rules: { + "@azure/azure-sdk/ts-modules-only-named": "warn", + "@azure/azure-sdk/ts-package-json-types": "warn", + "@azure/azure-sdk/ts-package-json-engine-is-present": "warn", + "@azure/azure-sdk/ts-package-json-files-required": "off", + "@azure/azure-sdk/ts-package-json-main-is-cjs": "off", + "tsdoc/syntax": "warn" + } + } +]); diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/package.json b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/package.json new file mode 100644 index 0000000000..7d7a12dd5d --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/package.json @@ -0,0 +1,325 @@ +{ + "name": "@azure/arm-confluent", + "version": "1.0.0-beta.1", + "description": "A generated SDK for ConfluentClient.", + "engines": { + "node": ">=20.0.0" + }, + "sideEffects": false, + "autoPublish": false, + "tshy": { + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts", + "./api": "./src/api/index.ts", + "./api/validations": "./src/api/validations/index.ts", + "./api/marketplaceAgreements": "./src/api/marketplaceAgreements/index.ts", + "./api/topics": "./src/api/topics/index.ts", + "./api/connector": "./src/api/connector/index.ts", + "./api/cluster": "./src/api/cluster/index.ts", + "./api/environment": "./src/api/environment/index.ts", + "./api/organization": "./src/api/organization/index.ts", + "./api/access": "./src/api/access/index.ts", + "./api/organizationOperations": "./src/api/organizationOperations/index.ts", + "./api/scClusterRecords": "./src/api/scClusterRecords/index.ts", + "./api/organizationResourceAPIKeyActions": "./src/api/organizationResourceAPIKeyActions/index.ts", + "./models": "./src/models/index.ts" + }, + "dialects": ["esm", "commonjs"], + "esmDialects": ["browser", "react-native"], + "selfLink": false + }, + "type": "module", + "browser": "./dist/browser/index.js", + "react-native": "./dist/react-native/index.js", + "keywords": ["node", "azure", "cloud", "typescript", "browser", "isomorphic"], + "author": "Microsoft Corporation", + "license": "MIT", + "files": ["dist/", "!dist/**/*.d.*ts.map", "README.md", "LICENSE"], + "dependencies": { + "@azure/core-util": "^1.9.2", + "@azure-rest/core-client": "^2.3.1", + "@azure/core-auth": "^1.6.0", + "@azure/core-rest-pipeline": "^1.5.0", + "@azure/logger": "^1.0.0", + "tslib": "^2.6.2", + "@azure/core-lro": "^3.1.0", + "@azure/abort-controller": "^2.1.2" + }, + "devDependencies": { + "dotenv": "^16.0.0", + "@types/node": "^20.0.0", + "eslint": "^9.9.0", + "typescript": "~5.8.2", + "tshy": "^2.0.0", + "@microsoft/api-extractor": "^7.40.3", + "rimraf": "^5.0.5", + "mkdirp": "^3.0.1" + }, + "scripts": { + "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "extract-api": "rimraf review && mkdirp ./review && api-extractor run --local", + "pack": "npm pack 2>&1", + "lint": "eslint package.json api-extractor.json src", + "lint:fix": "eslint package.json api-extractor.json src --fix --fix-type [problem,suggestion]", + "build": "npm run clean && tshy && npm run extract-api" + }, + "exports": { + "./package.json": "./package.json", + ".": { + "browser": { + "types": "./dist/browser/index.d.ts", + "default": "./dist/browser/index.js" + }, + "react-native": { + "types": "./dist/react-native/index.d.ts", + "default": "./dist/react-native/index.js" + }, + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" + } + }, + "./api": { + "browser": { + "types": "./dist/browser/api/index.d.ts", + "default": "./dist/browser/api/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/index.d.ts", + "default": "./dist/react-native/api/index.js" + }, + "import": { + "types": "./dist/esm/api/index.d.ts", + "default": "./dist/esm/api/index.js" + }, + "require": { + "types": "./dist/commonjs/api/index.d.ts", + "default": "./dist/commonjs/api/index.js" + } + }, + "./api/validations": { + "browser": { + "types": "./dist/browser/api/validations/index.d.ts", + "default": "./dist/browser/api/validations/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/validations/index.d.ts", + "default": "./dist/react-native/api/validations/index.js" + }, + "import": { + "types": "./dist/esm/api/validations/index.d.ts", + "default": "./dist/esm/api/validations/index.js" + }, + "require": { + "types": "./dist/commonjs/api/validations/index.d.ts", + "default": "./dist/commonjs/api/validations/index.js" + } + }, + "./api/marketplaceAgreements": { + "browser": { + "types": "./dist/browser/api/marketplaceAgreements/index.d.ts", + "default": "./dist/browser/api/marketplaceAgreements/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/marketplaceAgreements/index.d.ts", + "default": "./dist/react-native/api/marketplaceAgreements/index.js" + }, + "import": { + "types": "./dist/esm/api/marketplaceAgreements/index.d.ts", + "default": "./dist/esm/api/marketplaceAgreements/index.js" + }, + "require": { + "types": "./dist/commonjs/api/marketplaceAgreements/index.d.ts", + "default": "./dist/commonjs/api/marketplaceAgreements/index.js" + } + }, + "./api/topics": { + "browser": { + "types": "./dist/browser/api/topics/index.d.ts", + "default": "./dist/browser/api/topics/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/topics/index.d.ts", + "default": "./dist/react-native/api/topics/index.js" + }, + "import": { + "types": "./dist/esm/api/topics/index.d.ts", + "default": "./dist/esm/api/topics/index.js" + }, + "require": { + "types": "./dist/commonjs/api/topics/index.d.ts", + "default": "./dist/commonjs/api/topics/index.js" + } + }, + "./api/connector": { + "browser": { + "types": "./dist/browser/api/connector/index.d.ts", + "default": "./dist/browser/api/connector/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/connector/index.d.ts", + "default": "./dist/react-native/api/connector/index.js" + }, + "import": { + "types": "./dist/esm/api/connector/index.d.ts", + "default": "./dist/esm/api/connector/index.js" + }, + "require": { + "types": "./dist/commonjs/api/connector/index.d.ts", + "default": "./dist/commonjs/api/connector/index.js" + } + }, + "./api/cluster": { + "browser": { + "types": "./dist/browser/api/cluster/index.d.ts", + "default": "./dist/browser/api/cluster/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/cluster/index.d.ts", + "default": "./dist/react-native/api/cluster/index.js" + }, + "import": { + "types": "./dist/esm/api/cluster/index.d.ts", + "default": "./dist/esm/api/cluster/index.js" + }, + "require": { + "types": "./dist/commonjs/api/cluster/index.d.ts", + "default": "./dist/commonjs/api/cluster/index.js" + } + }, + "./api/environment": { + "browser": { + "types": "./dist/browser/api/environment/index.d.ts", + "default": "./dist/browser/api/environment/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/environment/index.d.ts", + "default": "./dist/react-native/api/environment/index.js" + }, + "import": { + "types": "./dist/esm/api/environment/index.d.ts", + "default": "./dist/esm/api/environment/index.js" + }, + "require": { + "types": "./dist/commonjs/api/environment/index.d.ts", + "default": "./dist/commonjs/api/environment/index.js" + } + }, + "./api/organization": { + "browser": { + "types": "./dist/browser/api/organization/index.d.ts", + "default": "./dist/browser/api/organization/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/organization/index.d.ts", + "default": "./dist/react-native/api/organization/index.js" + }, + "import": { + "types": "./dist/esm/api/organization/index.d.ts", + "default": "./dist/esm/api/organization/index.js" + }, + "require": { + "types": "./dist/commonjs/api/organization/index.d.ts", + "default": "./dist/commonjs/api/organization/index.js" + } + }, + "./api/access": { + "browser": { + "types": "./dist/browser/api/access/index.d.ts", + "default": "./dist/browser/api/access/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/access/index.d.ts", + "default": "./dist/react-native/api/access/index.js" + }, + "import": { + "types": "./dist/esm/api/access/index.d.ts", + "default": "./dist/esm/api/access/index.js" + }, + "require": { + "types": "./dist/commonjs/api/access/index.d.ts", + "default": "./dist/commonjs/api/access/index.js" + } + }, + "./api/organizationOperations": { + "browser": { + "types": "./dist/browser/api/organizationOperations/index.d.ts", + "default": "./dist/browser/api/organizationOperations/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/organizationOperations/index.d.ts", + "default": "./dist/react-native/api/organizationOperations/index.js" + }, + "import": { + "types": "./dist/esm/api/organizationOperations/index.d.ts", + "default": "./dist/esm/api/organizationOperations/index.js" + }, + "require": { + "types": "./dist/commonjs/api/organizationOperations/index.d.ts", + "default": "./dist/commonjs/api/organizationOperations/index.js" + } + }, + "./api/scClusterRecords": { + "browser": { + "types": "./dist/browser/api/scClusterRecords/index.d.ts", + "default": "./dist/browser/api/scClusterRecords/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/scClusterRecords/index.d.ts", + "default": "./dist/react-native/api/scClusterRecords/index.js" + }, + "import": { + "types": "./dist/esm/api/scClusterRecords/index.d.ts", + "default": "./dist/esm/api/scClusterRecords/index.js" + }, + "require": { + "types": "./dist/commonjs/api/scClusterRecords/index.d.ts", + "default": "./dist/commonjs/api/scClusterRecords/index.js" + } + }, + "./api/organizationResourceAPIKeyActions": { + "browser": { + "types": "./dist/browser/api/organizationResourceAPIKeyActions/index.d.ts", + "default": "./dist/browser/api/organizationResourceAPIKeyActions/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/organizationResourceAPIKeyActions/index.d.ts", + "default": "./dist/react-native/api/organizationResourceAPIKeyActions/index.js" + }, + "import": { + "types": "./dist/esm/api/organizationResourceAPIKeyActions/index.d.ts", + "default": "./dist/esm/api/organizationResourceAPIKeyActions/index.js" + }, + "require": { + "types": "./dist/commonjs/api/organizationResourceAPIKeyActions/index.d.ts", + "default": "./dist/commonjs/api/organizationResourceAPIKeyActions/index.js" + } + }, + "./models": { + "browser": { + "types": "./dist/browser/models/index.d.ts", + "default": "./dist/browser/models/index.js" + }, + "react-native": { + "types": "./dist/react-native/models/index.d.ts", + "default": "./dist/react-native/models/index.js" + }, + "import": { + "types": "./dist/esm/models/index.d.ts", + "default": "./dist/esm/models/index.js" + }, + "require": { + "types": "./dist/commonjs/models/index.d.ts", + "default": "./dist/commonjs/models/index.js" + } + } + }, + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + "module": "./dist/esm/index.js" +} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/review/arm-confluent.api.md b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/review/arm-confluent.api.md new file mode 100644 index 0000000000..53505ddb88 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/review/arm-confluent.api.md @@ -0,0 +1,1252 @@ +## API Report File for "@azure/arm-confluent" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { AbortSignalLike } from '@azure/abort-controller'; +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { OperationState } from '@azure/core-lro'; +import { PathUncheckedResponse } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; +import { PollerLike } from '@azure/core-lro'; +import { TokenCredential } from '@azure/core-auth'; + +// @public +export interface AccessCreateRoleBindingOptionalParams extends OperationOptions { +} + +// @public +export interface AccessCreateRoleBindingRequestModel { + crnPattern?: string; + principal?: string; + roleName?: string; +} + +// @public +export interface AccessDeleteRoleBindingOptionalParams extends OperationOptions { +} + +// @public +export interface AccessInvitedUserDetails { + authType?: string; + invitedEmail?: string; +} + +// @public +export interface AccessInviteUserAccountModel { + email?: string; + invitedUserDetails?: AccessInvitedUserDetails; + organizationId?: string; + upn?: string; +} + +// @public +export interface AccessInviteUserOptionalParams extends OperationOptions { +} + +// @public +export interface AccessListClustersOptionalParams extends OperationOptions { +} + +// @public +export interface AccessListClusterSuccessResponse { + data?: ClusterRecord[]; + kind?: string; + metadata?: ConfluentListMetadata; +} + +// @public +export interface AccessListEnvironmentsOptionalParams extends OperationOptions { +} + +// @public +export interface AccessListEnvironmentsSuccessResponse { + data?: EnvironmentRecord[]; + kind?: string; + metadata?: ConfluentListMetadata; +} + +// @public +export interface AccessListInvitationsOptionalParams extends OperationOptions { +} + +// @public +export interface AccessListInvitationsSuccessResponse { + data?: InvitationRecord[]; + kind?: string; + metadata?: ConfluentListMetadata; +} + +// @public +export interface AccessListRoleBindingNameListOptionalParams extends OperationOptions { +} + +// @public +export interface AccessListRoleBindingsOptionalParams extends OperationOptions { +} + +// @public +export interface AccessListRoleBindingsSuccessResponse { + data?: RoleBindingRecord[]; + kind?: string; + metadata?: ConfluentListMetadata; +} + +// @public +export interface AccessListServiceAccountsOptionalParams extends OperationOptions { +} + +// @public +export interface AccessListServiceAccountsSuccessResponse { + data?: ServiceAccountRecord[]; + kind?: string; + metadata?: ConfluentListMetadata; +} + +// @public +export interface AccessListUsersOptionalParams extends OperationOptions { +} + +// @public +export interface AccessListUsersSuccessResponse { + data?: UserRecord[]; + kind?: string; + metadata?: ConfluentListMetadata; +} + +// @public +export interface AccessOperations { + createRoleBinding: (resourceGroupName: string, organizationName: string, body: AccessCreateRoleBindingRequestModel, options?: AccessCreateRoleBindingOptionalParams) => Promise; + deleteRoleBinding: (resourceGroupName: string, organizationName: string, roleBindingId: string, options?: AccessDeleteRoleBindingOptionalParams) => Promise; + inviteUser: (resourceGroupName: string, organizationName: string, body: AccessInviteUserAccountModel, options?: AccessInviteUserOptionalParams) => Promise; + listClusters: (resourceGroupName: string, organizationName: string, body: ListAccessRequestModel, options?: AccessListClustersOptionalParams) => Promise; + listEnvironments: (resourceGroupName: string, organizationName: string, body: ListAccessRequestModel, options?: AccessListEnvironmentsOptionalParams) => Promise; + listInvitations: (resourceGroupName: string, organizationName: string, body: ListAccessRequestModel, options?: AccessListInvitationsOptionalParams) => Promise; + listRoleBindingNameList: (resourceGroupName: string, organizationName: string, body: ListAccessRequestModel, options?: AccessListRoleBindingNameListOptionalParams) => Promise; + listRoleBindings: (resourceGroupName: string, organizationName: string, body: ListAccessRequestModel, options?: AccessListRoleBindingsOptionalParams) => Promise; + listServiceAccounts: (resourceGroupName: string, organizationName: string, body: ListAccessRequestModel, options?: AccessListServiceAccountsOptionalParams) => Promise; + listUsers: (resourceGroupName: string, organizationName: string, body: ListAccessRequestModel, options?: AccessListUsersOptionalParams) => Promise; +} + +// @public +export interface AccessRoleBindingNameListSuccessResponse { + data?: string[]; + kind?: string; + metadata?: ConfluentListMetadata; +} + +// @public +export interface APIKeyOwnerEntity { + id?: string; + kind?: string; + related?: string; + resourceName?: string; +} + +// @public +export interface APIKeyProperties { + metadata?: SCMetadataEntity; + spec?: APIKeySpecEntity; +} + +// @public +export interface APIKeyRecord { + id?: string; + kind?: string; + properties?: APIKeyProperties; +} + +// @public +export interface APIKeyResourceEntity { + environment?: string; + id?: string; + kind?: string; + related?: string; + resourceName?: string; +} + +// @public +export interface APIKeySpecEntity { + description?: string; + name?: string; + owner?: APIKeyOwnerEntity; + resource?: APIKeyResourceEntity; + secret?: string; +} + +// @public +export type AuthType = string; + +// @public +export interface AzureBlobStorageSinkConnectorServiceInfo extends ConnectorServiceTypeInfoBase { + connectorServiceType: "AzureBlobStorageSinkConnector"; + storageAccountKey?: string; + storageAccountName?: string; + storageContainerName?: string; +} + +// @public +export interface AzureBlobStorageSourceConnectorServiceInfo extends ConnectorServiceTypeInfoBase { + connectorServiceType: "AzureBlobStorageSourceConnector"; + storageAccountKey?: string; + storageAccountName?: string; + storageContainerName?: string; +} + +// @public +export interface AzureCosmosDBSinkConnectorServiceInfo extends ConnectorServiceTypeInfoBase { + connectorServiceType: "AzureCosmosDBSinkConnector"; + cosmosConnectionEndpoint?: string; + cosmosContainersTopicMapping?: string; + cosmosDatabaseName?: string; + cosmosIdStrategy?: string; + cosmosMasterKey?: string; +} + +// @public +export interface AzureCosmosDBSourceConnectorServiceInfo extends ConnectorServiceTypeInfoBase { + connectorServiceType: "AzureCosmosDBSourceConnector"; + cosmosConnectionEndpoint?: string; + cosmosContainersTopicMapping?: string; + cosmosDatabaseName?: string; + cosmosMasterKey?: string; + cosmosMessageKeyEnabled?: boolean; + cosmosMessageKeyField?: string; +} + +// @public +export interface AzureSynapseAnalyticsSinkConnectorServiceInfo extends ConnectorServiceTypeInfoBase { + connectorServiceType: "AzureSynapseAnalyticsSinkConnector"; + synapseSqlDatabaseName?: string; + synapseSqlPassword?: string; + synapseSqlServerName?: string; + synapseSqlUser?: string; +} + +// @public +export interface ClusterByokEntity { + id?: string; + related?: string; + resourceName?: string; +} + +// @public +export interface ClusterConfigEntity { + kind?: string; +} + +// @public +export interface ClusterCreateOrUpdateOptionalParams extends OperationOptions { + body?: SCClusterRecord; +} + +// @public +export interface ClusterDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface ClusterEnvironmentEntity { + environment?: string; + id?: string; + related?: string; + resourceName?: string; +} + +// @public +export interface ClusterNetworkEntity { + environment?: string; + id?: string; + related?: string; + resourceName?: string; +} + +// @public +export interface ClusterOperations { + createOrUpdate: (resourceGroupName: string, organizationName: string, environmentId: string, clusterId: string, options?: ClusterCreateOrUpdateOptionalParams) => Promise; + delete: (resourceGroupName: string, organizationName: string, environmentId: string, clusterId: string, options?: ClusterDeleteOptionalParams) => PollerLike, void>; +} + +// @public +export interface ClusterProperties { + metadata?: SCMetadataEntity; + spec?: SCClusterSpecEntity; + status?: ClusterStatusEntity; +} + +// @public +export interface ClusterRecord { + displayName?: string; + id?: string; + kind?: string; + metadata?: MetadataEntity; + spec?: ClusterSpecEntity; + status?: ClusterStatusEntity; +} + +// @public +export interface ClusterSpecEntity { + apiEndpoint?: string; + availability?: string; + byok?: ClusterByokEntity; + cloud?: string; + config?: ClusterConfigEntity; + displayName?: string; + environment?: ClusterEnvironmentEntity; + httpEndpoint?: string; + kafkaBootstrapEndpoint?: string; + network?: ClusterNetworkEntity; + region?: string; + zone?: string; +} + +// @public +export interface ClusterStatusEntity { + cku?: number; + phase?: string; +} + +// @public +export interface ConfluentAgreementProperties { + accepted?: boolean; + licenseTextLink?: string; + plan?: string; + privacyPolicyLink?: string; + product?: string; + publisher?: string; + retrieveDatetime?: Date; + signature?: string; +} + +// @public +export interface ConfluentAgreementResource { + readonly id?: string; + readonly name?: string; + properties?: ConfluentAgreementProperties; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public (undocumented) +export class ConfluentClient { + constructor(credential: TokenCredential, subscriptionId: string, options?: ConfluentClientOptionalParams); + readonly access: AccessOperations; + readonly cluster: ClusterOperations; + readonly connector: ConnectorOperations; + readonly environment: EnvironmentOperations; + readonly marketplaceAgreements: MarketplaceAgreementsOperations; + readonly organization: OrganizationOperations; + readonly organizationOperations: OrganizationOperationsOperations; + readonly organizationResourceAPIKeyActions: OrganizationResourceAPIKeyActionsOperations; + readonly pipeline: Pipeline; + readonly scClusterRecords: SCClusterRecordsOperations; + readonly topics: TopicsOperations; + readonly validations: ValidationsOperations; +} + +// @public +export interface ConfluentClientOptionalParams extends ClientOptions { + apiVersion?: string; +} + +// @public +export interface ConfluentListMetadata { + first?: string; + last?: string; + next?: string; + prev?: string; + totalSize?: number; +} + +// @public +export type ConnectorClass = string; + +// @public +export interface ConnectorCreateOrUpdateOptionalParams extends OperationOptions { + body?: ConnectorResource; +} + +// @public +export interface ConnectorDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface ConnectorGetOptionalParams extends OperationOptions { +} + +// @public +export interface ConnectorInfoBase { + connectorClass?: ConnectorClass; + connectorId?: string; + connectorName?: string; + connectorState?: ConnectorStatus; + connectorType?: ConnectorType; +} + +// @public +export interface ConnectorListOptionalParams extends OperationOptions { + pageSize?: number; + pageToken?: string; +} + +// @public +export interface ConnectorOperations { + createOrUpdate: (resourceGroupName: string, organizationName: string, environmentId: string, clusterId: string, connectorName: string, options?: ConnectorCreateOrUpdateOptionalParams) => Promise; + delete: (resourceGroupName: string, organizationName: string, environmentId: string, clusterId: string, connectorName: string, options?: ConnectorDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, organizationName: string, environmentId: string, clusterId: string, connectorName: string, options?: ConnectorGetOptionalParams) => Promise; + list: (resourceGroupName: string, organizationName: string, environmentId: string, clusterId: string, options?: ConnectorListOptionalParams) => PagedAsyncIterableIterator; +} + +// @public +export interface ConnectorResource extends ProxyResource { + properties: ConnectorResourceProperties; +} + +// @public +export interface ConnectorResourceProperties { + connectorBasicInfo?: ConnectorInfoBase; + connectorServiceTypeInfo?: ConnectorServiceTypeInfoBaseUnion; + partnerConnectorInfo?: PartnerInfoBaseUnion; +} + +// @public +export type ConnectorServiceType = string; + +// @public +export interface ConnectorServiceTypeInfoBase { + connectorServiceType: ConnectorServiceType; +} + +// @public +export type ConnectorServiceTypeInfoBaseUnion = AzureBlobStorageSinkConnectorServiceInfo | AzureBlobStorageSourceConnectorServiceInfo | AzureCosmosDBSinkConnectorServiceInfo | AzureCosmosDBSourceConnectorServiceInfo | AzureSynapseAnalyticsSinkConnectorServiceInfo | ConnectorServiceTypeInfoBase; + +// @public +export type ConnectorStatus = string; + +// @public +export type ConnectorType = string; + +// @public +export type ContinuablePage = TPage & { + continuationToken?: string; +}; + +// @public +export interface CreateAPIKeyModel { + description?: string; + name?: string; +} + +// @public +export type CreatedByType = string; + +// @public +export type DataFormatType = string; + +// @public +export interface EnvironmentCreateOrUpdateOptionalParams extends OperationOptions { + body?: SCEnvironmentRecord; +} + +// @public +export interface EnvironmentDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface EnvironmentOperations { + createOrUpdate: (resourceGroupName: string, organizationName: string, environmentId: string, options?: EnvironmentCreateOrUpdateOptionalParams) => Promise; + delete: (resourceGroupName: string, organizationName: string, environmentId: string, options?: EnvironmentDeleteOptionalParams) => PollerLike, void>; +} + +// @public +export interface EnvironmentProperties { + metadata?: SCMetadataEntity; + streamGovernanceConfig?: StreamGovernanceConfig; +} + +// @public +export interface EnvironmentRecord { + displayName?: string; + id?: string; + kind?: string; + metadata?: MetadataEntity; +} + +// @public +export interface ErrorAdditionalInfo { + readonly info?: any; + readonly type?: string; +} + +// @public +export interface ErrorDetail { + readonly additionalInfo?: ErrorAdditionalInfo[]; + readonly code?: string; + readonly details?: ErrorDetail[]; + readonly message?: string; + readonly target?: string; +} + +// @public +export interface ErrorResponse { + error?: ErrorDetail; +} + +// @public +export interface ErrorResponseBody { + readonly code?: string; + readonly details?: ErrorResponseBody[]; + readonly message?: string; + readonly target?: string; +} + +// @public +export interface InvitationRecord { + acceptedAt?: string; + authType?: string; + email?: string; + expiresAt?: string; + id?: string; + kind?: string; + metadata?: MetadataEntity; + status?: string; +} + +// @public +export interface KafkaAzureBlobStorageSinkConnectorInfo extends PartnerInfoBase { + apiKey?: string; + apiSecret?: string; + authType?: AuthType; + flushSize?: string; + inputFormat?: DataFormatType; + maxTasks?: string; + outputFormat?: DataFormatType; + partnerConnectorType: "KafkaAzureBlobStorageSink"; + serviceAccountId?: string; + timeInterval?: string; + topics?: string[]; + topicsDir?: string; +} + +// @public +export interface KafkaAzureBlobStorageSourceConnectorInfo extends PartnerInfoBase { + apiKey?: string; + apiSecret?: string; + authType?: AuthType; + inputFormat?: DataFormatType; + maxTasks?: string; + outputFormat?: DataFormatType; + partnerConnectorType: "KafkaAzureBlobStorageSource"; + serviceAccountId?: string; + topicRegex?: string; + topicsDir?: string; +} + +// @public +export interface KafkaAzureCosmosDBSinkConnectorInfo extends PartnerInfoBase { + apiKey?: string; + apiSecret?: string; + authType?: AuthType; + flushSize?: string; + inputFormat?: DataFormatType; + maxTasks?: string; + outputFormat?: DataFormatType; + partnerConnectorType: "KafkaAzureCosmosDBSink"; + serviceAccountId?: string; + timeInterval?: string; + topics?: string[]; + topicsDir?: string; +} + +// @public +export interface KafkaAzureCosmosDBSourceConnectorInfo extends PartnerInfoBase { + apiKey?: string; + apiSecret?: string; + authType?: AuthType; + inputFormat?: DataFormatType; + maxTasks?: string; + outputFormat?: DataFormatType; + partnerConnectorType: "KafkaAzureCosmosDBSource"; + serviceAccountId?: string; + topicRegex?: string; + topicsDir?: string; +} + +// @public +export interface KafkaAzureSynapseAnalyticsSinkConnectorInfo extends PartnerInfoBase { + apiKey?: string; + apiSecret?: string; + authType?: AuthType; + flushSize?: string; + inputFormat?: DataFormatType; + maxTasks?: string; + outputFormat?: DataFormatType; + partnerConnectorType: "KafkaAzureSynapseAnalyticsSink"; + serviceAccountId?: string; + timeInterval?: string; + topics?: string[]; + topicsDir?: string; +} + +// @public +export enum KnownAuthType { + // (undocumented) + KafkaAPIKEY = "KAFKA_API_KEY", + // (undocumented) + ServiceAccount = "SERVICE_ACCOUNT" +} + +// @public +export enum KnownConnectorClass { + // (undocumented) + Azureblobsink = "AZUREBLOBSINK", + // (undocumented) + Azureblobsource = "AZUREBLOBSOURCE" +} + +// @public +export enum KnownConnectorServiceType { + // (undocumented) + AzureBlobStorageSinkConnector = "AzureBlobStorageSinkConnector", + // (undocumented) + AzureBlobStorageSourceConnector = "AzureBlobStorageSourceConnector", + // (undocumented) + AzureCosmosDBSinkConnector = "AzureCosmosDBSinkConnector", + // (undocumented) + AzureCosmosDBSourceConnector = "AzureCosmosDBSourceConnector", + // (undocumented) + AzureSynapseAnalyticsSinkConnector = "AzureSynapseAnalyticsSinkConnector" +} + +// @public +export enum KnownConnectorStatus { + // (undocumented) + Failed = "FAILED", + // (undocumented) + Paused = "PAUSED", + // (undocumented) + Provisioning = "PROVISIONING", + // (undocumented) + Running = "RUNNING" +} + +// @public +export enum KnownConnectorType { + // (undocumented) + Sink = "SINK", + // (undocumented) + Source = "SOURCE" +} + +// @public +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + +// @public +export enum KnownDataFormatType { + // (undocumented) + Avro = "AVRO", + // (undocumented) + Bytes = "BYTES", + // (undocumented) + Json = "JSON", + // (undocumented) + Protobuf = "PROTOBUF", + // (undocumented) + String = "STRING" +} + +// @public +export enum KnownPackage { + // (undocumented) + Advanced = "ADVANCED", + // (undocumented) + Essentials = "ESSENTIALS" +} + +// @public +export enum KnownPartnerConnectorType { + // (undocumented) + KafkaAzureBlobStorageSink = "KafkaAzureBlobStorageSink", + // (undocumented) + KafkaAzureBlobStorageSource = "KafkaAzureBlobStorageSource", + // (undocumented) + KafkaAzureCosmosDBSink = "KafkaAzureCosmosDBSink", + // (undocumented) + KafkaAzureCosmosDBSource = "KafkaAzureCosmosDBSource", + // (undocumented) + KafkaAzureSynapseAnalyticsSink = "KafkaAzureSynapseAnalyticsSink" +} + +// @public +export enum KnownProvisionState { + // (undocumented) + Accepted = "Accepted", + // (undocumented) + Canceled = "Canceled", + // (undocumented) + Creating = "Creating", + // (undocumented) + Deleted = "Deleted", + // (undocumented) + Deleting = "Deleting", + // (undocumented) + Failed = "Failed", + // (undocumented) + NotSpecified = "NotSpecified", + // (undocumented) + Succeeded = "Succeeded", + // (undocumented) + Updating = "Updating" +} + +// @public +export enum KnownSaaSOfferStatus { + // (undocumented) + Failed = "Failed", + // (undocumented) + InProgress = "InProgress", + // (undocumented) + PendingFulfillmentStart = "PendingFulfillmentStart", + // (undocumented) + Reinstated = "Reinstated", + // (undocumented) + Started = "Started", + // (undocumented) + Subscribed = "Subscribed", + // (undocumented) + Succeeded = "Succeeded", + // (undocumented) + Suspended = "Suspended", + // (undocumented) + Unsubscribed = "Unsubscribed", + // (undocumented) + Updating = "Updating" +} + +// @public +export enum KnownVersions { + V20240701 = "2024-07-01" +} + +// @public +export interface LinkOrganization { + token: string; +} + +// @public +export interface ListAccessRequestModel { + searchFilters?: Record; +} + +// @public +export interface ListRegionsSuccessResponse { + data?: RegionRecord[]; +} + +// @public +export interface MarketplaceAgreementsCreateOptionalParams extends OperationOptions { + body?: ConfluentAgreementResource; +} + +// @public +export interface MarketplaceAgreementsListOptionalParams extends OperationOptions { +} + +// @public +export interface MarketplaceAgreementsOperations { + create: (options?: MarketplaceAgreementsCreateOptionalParams) => Promise; + list: (options?: MarketplaceAgreementsListOptionalParams) => PagedAsyncIterableIterator; +} + +// @public +export interface MetadataEntity { + createdAt?: string; + deletedAt?: string; + resourceName?: string; + self?: string; + updatedAt?: string; +} + +// @public +export interface OfferDetail { + id: string; + planId: string; + planName: string; + privateOfferId?: string; + privateOfferIds?: string[]; + publisherId: string; + status?: SaaSOfferStatus; + termId?: string; + termUnit: string; +} + +// @public +export interface OperationDisplay { + description?: string; + operation?: string; + provider?: string; + resource?: string; +} + +// @public +export interface OperationResult { + display?: OperationDisplay; + isDataAction?: boolean; + name?: string; +} + +// @public +export interface OrganizationCreateOptionalParams extends OperationOptions { + body?: OrganizationResource; + updateIntervalInMs?: number; +} + +// @public +export interface OrganizationDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface OrganizationGetClusterByIdOptionalParams extends OperationOptions { +} + +// @public +export interface OrganizationGetEnvironmentByIdOptionalParams extends OperationOptions { +} + +// @public +export interface OrganizationGetOptionalParams extends OperationOptions { +} + +// @public +export interface OrganizationGetSchemaRegistryClusterByIdOptionalParams extends OperationOptions { +} + +// @public +export interface OrganizationListByResourceGroupOptionalParams extends OperationOptions { +} + +// @public +export interface OrganizationListBySubscriptionOptionalParams extends OperationOptions { +} + +// @public +export interface OrganizationListClustersOptionalParams extends OperationOptions { + pageSize?: number; + pageToken?: string; +} + +// @public +export interface OrganizationListEnvironmentsOptionalParams extends OperationOptions { + pageSize?: number; + pageToken?: string; +} + +// @public +export interface OrganizationListRegionsOptionalParams extends OperationOptions { +} + +// @public +export interface OrganizationListSchemaRegistryClustersOptionalParams extends OperationOptions { + pageSize?: number; + pageToken?: string; +} + +// @public +export interface OrganizationOperations { + create: (resourceGroupName: string, organizationName: string, options?: OrganizationCreateOptionalParams) => PollerLike, OrganizationResource>; + delete: (resourceGroupName: string, organizationName: string, options?: OrganizationDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, organizationName: string, options?: OrganizationGetOptionalParams) => Promise; + getClusterById: (resourceGroupName: string, organizationName: string, environmentId: string, clusterId: string, options?: OrganizationGetClusterByIdOptionalParams) => Promise; + getEnvironmentById: (resourceGroupName: string, organizationName: string, environmentId: string, options?: OrganizationGetEnvironmentByIdOptionalParams) => Promise; + getSchemaRegistryClusterById: (resourceGroupName: string, organizationName: string, environmentId: string, clusterId: string, options?: OrganizationGetSchemaRegistryClusterByIdOptionalParams) => Promise; + listByResourceGroup: (resourceGroupName: string, options?: OrganizationListByResourceGroupOptionalParams) => PagedAsyncIterableIterator; + listBySubscription: (options?: OrganizationListBySubscriptionOptionalParams) => PagedAsyncIterableIterator; + listClusters: (resourceGroupName: string, organizationName: string, environmentId: string, options?: OrganizationListClustersOptionalParams) => PagedAsyncIterableIterator; + listEnvironments: (resourceGroupName: string, organizationName: string, options?: OrganizationListEnvironmentsOptionalParams) => PagedAsyncIterableIterator; + listRegions: (resourceGroupName: string, organizationName: string, body: ListAccessRequestModel, options?: OrganizationListRegionsOptionalParams) => Promise; + listSchemaRegistryClusters: (resourceGroupName: string, organizationName: string, environmentId: string, options?: OrganizationListSchemaRegistryClustersOptionalParams) => PagedAsyncIterableIterator; + update: (resourceGroupName: string, organizationName: string, options?: OrganizationUpdateOptionalParams) => Promise; +} + +// @public +export interface OrganizationOperationsListOptionalParams extends OperationOptions { +} + +// @public +export interface OrganizationOperationsOperations { + list: (options?: OrganizationOperationsListOptionalParams) => PagedAsyncIterableIterator; +} + +// @public +export interface OrganizationResource extends TrackedResource { + properties: OrganizationResourceProperties; +} + +// @public +export interface OrganizationResourceAPIKeyActionsDeleteClusterAPIKeyOptionalParams extends OperationOptions { +} + +// @public +export interface OrganizationResourceAPIKeyActionsGetClusterAPIKeyOptionalParams extends OperationOptions { +} + +// @public +export interface OrganizationResourceAPIKeyActionsOperations { + deleteClusterAPIKey: (resourceGroupName: string, organizationName: string, apiKeyId: string, options?: OrganizationResourceAPIKeyActionsDeleteClusterAPIKeyOptionalParams) => Promise; + getClusterAPIKey: (resourceGroupName: string, organizationName: string, apiKeyId: string, options?: OrganizationResourceAPIKeyActionsGetClusterAPIKeyOptionalParams) => Promise; +} + +// @public +export interface OrganizationResourceProperties { + readonly createdTime?: Date; + linkOrganization?: LinkOrganization; + offerDetail: OfferDetail; + readonly organizationId?: string; + readonly provisioningState?: ProvisionState; + readonly ssoUrl?: string; + userDetail: UserDetail; +} + +// @public +export interface OrganizationResourceUpdate { + tags?: Record; +} + +// @public +export interface OrganizationUpdateOptionalParams extends OperationOptions { + body?: OrganizationResourceUpdate; +} + +// @public +export type Package = string; + +// @public +export interface PagedAsyncIterableIterator { + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + byPage: (settings?: TPageSettings) => AsyncIterableIterator>; + next(): Promise>; +} + +// @public +export interface PageSettings { + continuationToken?: string; +} + +// @public +export type PartnerConnectorType = string; + +// @public +export interface PartnerInfoBase { + partnerConnectorType: PartnerConnectorType; +} + +// @public +export type PartnerInfoBaseUnion = KafkaAzureBlobStorageSinkConnectorInfo | KafkaAzureBlobStorageSourceConnectorInfo | KafkaAzureCosmosDBSinkConnectorInfo | KafkaAzureCosmosDBSourceConnectorInfo | KafkaAzureSynapseAnalyticsSinkConnectorInfo | PartnerInfoBase; + +// @public +export type ProvisionState = string; + +// @public +export interface ProxyResource extends Resource { +} + +// @public +export interface RegionProperties { + metadata?: SCMetadataEntity; + spec?: RegionSpecEntity; +} + +// @public +export interface RegionRecord { + id?: string; + kind?: string; + properties?: RegionProperties; +} + +// @public +export interface RegionSpecEntity { + cloud?: string; + name?: string; + // (undocumented) + packages?: string[]; + regionName?: string; +} + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export interface ResourceProviderDefaultErrorResponse { + readonly error?: ErrorResponseBody; +} + +// @public +export function restorePoller(client: ConfluentClient, serializedState: string, sourceOperation: (...args: any[]) => PollerLike, TResult>, options?: RestorePollerOptions): PollerLike, TResult>; + +// @public (undocumented) +export interface RestorePollerOptions extends OperationOptions { + abortSignal?: AbortSignalLike; + processResponseBody?: (result: TResponse) => Promise; + updateIntervalInMs?: number; +} + +// @public +export interface RoleBindingRecord { + crnPattern?: string; + id?: string; + kind?: string; + metadata?: MetadataEntity; + principal?: string; + roleName?: string; +} + +// @public +export type SaaSOfferStatus = string; + +// @public +export interface SCClusterByokEntity { + id?: string; + related?: string; + resourceName?: string; +} + +// @public +export interface SCClusterNetworkEnvironmentEntity { + environment?: string; + id?: string; + related?: string; + resourceName?: string; +} + +// @public +export interface SCClusterRecord extends ProxyResource { + kind?: string; + properties?: ClusterProperties; +} + +// @public +export interface SCClusterRecordsCreateAPIKeyOptionalParams extends OperationOptions { +} + +// @public +export interface SCClusterRecordsOperations { + createAPIKey: (resourceGroupName: string, organizationName: string, environmentId: string, clusterId: string, body: CreateAPIKeyModel, options?: SCClusterRecordsCreateAPIKeyOptionalParams) => Promise; +} + +// @public +export interface SCClusterSpecEntity { + apiEndpoint?: string; + availability?: string; + byok?: SCClusterByokEntity; + cloud?: string; + config?: ClusterConfigEntity; + environment?: SCClusterNetworkEnvironmentEntity; + httpEndpoint?: string; + kafkaBootstrapEndpoint?: string; + name?: string; + network?: SCClusterNetworkEnvironmentEntity; + package?: Package; + region?: string; + zone?: string; +} + +// @public +export interface SCEnvironmentRecord extends ProxyResource { + kind?: string; + properties?: EnvironmentProperties; +} + +// @public +export interface SchemaRegistryClusterEnvironmentRegionEntity { + id?: string; + related?: string; + resourceName?: string; +} + +// @public +export interface SchemaRegistryClusterProperties { + metadata?: SCMetadataEntity; + spec?: SchemaRegistryClusterSpecEntity; + status?: SchemaRegistryClusterStatusEntity; +} + +// @public +export interface SchemaRegistryClusterRecord { + id?: string; + kind?: string; + properties?: SchemaRegistryClusterProperties; +} + +// @public +export interface SchemaRegistryClusterSpecEntity { + cloud?: string; + environment?: SchemaRegistryClusterEnvironmentRegionEntity; + httpEndpoint?: string; + name?: string; + package?: string; + region?: SchemaRegistryClusterEnvironmentRegionEntity; +} + +// @public +export interface SchemaRegistryClusterStatusEntity { + phase?: string; +} + +// @public +export interface SCMetadataEntity { + createdTimestamp?: string; + deletedTimestamp?: string; + resourceName?: string; + self?: string; + updatedTimestamp?: string; +} + +// @public +export interface ServiceAccountRecord { + description?: string; + displayName?: string; + id?: string; + kind?: string; + metadata?: MetadataEntity; +} + +// @public +export interface StreamGovernanceConfig { + package?: Package; +} + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export interface TopicMetadataEntity { + resourceName?: string; + self?: string; +} + +// @public +export interface TopicProperties { + configs?: TopicsRelatedLink; + inputConfigs?: TopicsInputConfig[]; + kind?: string; + metadata?: TopicMetadataEntity; + partitions?: TopicsRelatedLink; + partitionsCount?: string; + partitionsReassignments?: TopicsRelatedLink; + replicationFactor?: string; + topicId?: string; +} + +// @public +export interface TopicRecord extends ProxyResource { + properties?: TopicProperties; +} + +// @public +export interface TopicsCreateOptionalParams extends OperationOptions { + body?: TopicRecord; +} + +// @public +export interface TopicsDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface TopicsGetOptionalParams extends OperationOptions { +} + +// @public +export interface TopicsInputConfig { + name?: string; + value?: string; +} + +// @public +export interface TopicsListOptionalParams extends OperationOptions { + pageSize?: number; + pageToken?: string; +} + +// @public +export interface TopicsOperations { + create: (resourceGroupName: string, organizationName: string, environmentId: string, clusterId: string, topicName: string, options?: TopicsCreateOptionalParams) => Promise; + delete: (resourceGroupName: string, organizationName: string, environmentId: string, clusterId: string, topicName: string, options?: TopicsDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, organizationName: string, environmentId: string, clusterId: string, topicName: string, options?: TopicsGetOptionalParams) => Promise; + list: (resourceGroupName: string, organizationName: string, environmentId: string, clusterId: string, options?: TopicsListOptionalParams) => PagedAsyncIterableIterator; +} + +// @public +export interface TopicsRelatedLink { + related?: string; +} + +// @public +export interface TrackedResource extends Resource { + location: string; + tags?: Record; +} + +// @public +export interface UserDetail { + aadEmail?: string; + emailAddress: string; + firstName?: string; + lastName?: string; + userPrincipalName?: string; +} + +// @public +export interface UserRecord { + authType?: string; + email?: string; + fullName?: string; + id?: string; + kind?: string; + metadata?: MetadataEntity; +} + +// @public +export interface ValidationResponse { + info?: Record; +} + +// @public +export interface ValidationsOperations { + validateOrganization: (resourceGroupName: string, organizationName: string, body: OrganizationResource, options?: ValidationsValidateOrganizationOptionalParams) => Promise; + validateOrganizationV2: (resourceGroupName: string, organizationName: string, body: OrganizationResource, options?: ValidationsValidateOrganizationV2OptionalParams) => Promise; +} + +// @public +export interface ValidationsValidateOrganizationOptionalParams extends OperationOptions { +} + +// @public +export interface ValidationsValidateOrganizationV2OptionalParams extends OperationOptions { +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/rollup.config.js b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/rollup.config.js new file mode 100644 index 0000000000..843de501bf --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/rollup.config.js @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import nodeResolve from "@rollup/plugin-node-resolve"; +import cjs from "@rollup/plugin-commonjs"; +import sourcemaps from "rollup-plugin-sourcemaps"; +import multiEntry from "@rollup/plugin-multi-entry"; +import json from "@rollup/plugin-json"; + +import nodeBuiltins from "builtin-modules"; + +// #region Warning Handler + +/** + * A function that can determine whether a rollup warning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEval(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependency(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && + warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval]; + +/** + * Construct a warning handler for the shared rollup configuration + * that ignores certain warnings that are not relevant to testing. + */ +function makeOnWarnForTesting() { + return (warning, warn) => { + // If every inhibitor returns false (i.e. no inhibitors), then show the warning + if (warningInhibitors.every((inhib) => !inhib(warning))) { + warn(warning); + } + }; +} + +// #endregion + +function makeBrowserTestConfig() { + const config = { + input: { + include: ["dist-esm/test/**/*.spec.js"], + exclude: ["dist-esm/test/**/node/**"], + }, + output: { + file: `dist-test/index.browser.js`, + format: "umd", + sourcemap: true, + }, + preserveSymlinks: false, + plugins: [ + multiEntry({ exports: false }), + nodeResolve({ + mainFields: ["module", "browser"], + }), + cjs(), + json(), + sourcemaps(), + //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) + ], + onwarn: makeOnWarnForTesting(), + // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, + // rollup started respecting the "sideEffects" field in package.json. Since + // our package.json sets "sideEffects=false", this also applies to test + // code, which causes all tests to be removed by tree-shaking. + treeshake: false, + }; + + return config; +} + +const defaultConfigurationOptions = { + disableBrowserBundle: false, +}; + +export function makeConfig(pkg, options) { + options = { + ...defaultConfigurationOptions, + ...(options || {}), + }; + + const baseConfig = { + // Use the package's module field if it has one + input: pkg["module"] || "dist-esm/src/index.js", + external: [ + ...nodeBuiltins, + ...Object.keys(pkg.dependencies), + ...Object.keys(pkg.devDependencies), + ], + output: { file: "dist/index.js", format: "cjs", sourcemap: true }, + preserveSymlinks: false, + plugins: [sourcemaps(), nodeResolve()], + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/access/index.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/access/index.ts new file mode 100644 index 0000000000..c85d9453e0 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/access/index.ts @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + listRoleBindingNameList, + createRoleBinding, + listRoleBindings, + listClusters, + listEnvironments, + inviteUser, + listInvitations, + listServiceAccounts, + listUsers, + deleteRoleBinding, +} from "./operations.js"; +export { + AccessListRoleBindingNameListOptionalParams, + AccessCreateRoleBindingOptionalParams, + AccessListRoleBindingsOptionalParams, + AccessListClustersOptionalParams, + AccessListEnvironmentsOptionalParams, + AccessInviteUserOptionalParams, + AccessListInvitationsOptionalParams, + AccessListServiceAccountsOptionalParams, + AccessListUsersOptionalParams, + AccessDeleteRoleBindingOptionalParams, +} from "./options.js"; diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/access/operations.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/access/operations.ts new file mode 100644 index 0000000000..8e4e9dbb7d --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/access/operations.ts @@ -0,0 +1,699 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ConfluentContext as Client } from "../index.js"; +import { + resourceProviderDefaultErrorResponseDeserializer, + ListAccessRequestModel, + listAccessRequestModelSerializer, + AccessListUsersSuccessResponse, + accessListUsersSuccessResponseDeserializer, + AccessListServiceAccountsSuccessResponse, + accessListServiceAccountsSuccessResponseDeserializer, + AccessListInvitationsSuccessResponse, + accessListInvitationsSuccessResponseDeserializer, + InvitationRecord, + invitationRecordDeserializer, + AccessInviteUserAccountModel, + accessInviteUserAccountModelSerializer, + AccessListEnvironmentsSuccessResponse, + accessListEnvironmentsSuccessResponseDeserializer, + AccessListClusterSuccessResponse, + accessListClusterSuccessResponseDeserializer, + AccessListRoleBindingsSuccessResponse, + accessListRoleBindingsSuccessResponseDeserializer, + RoleBindingRecord, + roleBindingRecordDeserializer, + AccessCreateRoleBindingRequestModel, + accessCreateRoleBindingRequestModelSerializer, + AccessRoleBindingNameListSuccessResponse, + accessRoleBindingNameListSuccessResponseDeserializer, +} from "../../models/models.js"; +import { + AccessListRoleBindingNameListOptionalParams, + AccessCreateRoleBindingOptionalParams, + AccessListRoleBindingsOptionalParams, + AccessListClustersOptionalParams, + AccessListEnvironmentsOptionalParams, + AccessInviteUserOptionalParams, + AccessListInvitationsOptionalParams, + AccessListServiceAccountsOptionalParams, + AccessListUsersOptionalParams, + AccessDeleteRoleBindingOptionalParams, +} from "./options.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _listRoleBindingNameListSend( + context: Client, + resourceGroupName: string, + organizationName: string, + body: ListAccessRequestModel, + options: AccessListRoleBindingNameListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/access/default/listRoleBindingNameList{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: listAccessRequestModelSerializer(body), + }); +} + +export async function _listRoleBindingNameListDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return accessRoleBindingNameListSuccessResponseDeserializer(result.body); +} + +/** Organization role bindings */ +export async function listRoleBindingNameList( + context: Client, + resourceGroupName: string, + organizationName: string, + body: ListAccessRequestModel, + options: AccessListRoleBindingNameListOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listRoleBindingNameListSend( + context, + resourceGroupName, + organizationName, + body, + options, + ); + return _listRoleBindingNameListDeserialize(result); +} + +export function _createRoleBindingSend( + context: Client, + resourceGroupName: string, + organizationName: string, + body: AccessCreateRoleBindingRequestModel, + options: AccessCreateRoleBindingOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/access/default/createRoleBinding{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: accessCreateRoleBindingRequestModelSerializer(body), + }); +} + +export async function _createRoleBindingDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return roleBindingRecordDeserializer(result.body); +} + +/** Organization role bindings */ +export async function createRoleBinding( + context: Client, + resourceGroupName: string, + organizationName: string, + body: AccessCreateRoleBindingRequestModel, + options: AccessCreateRoleBindingOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createRoleBindingSend( + context, + resourceGroupName, + organizationName, + body, + options, + ); + return _createRoleBindingDeserialize(result); +} + +export function _listRoleBindingsSend( + context: Client, + resourceGroupName: string, + organizationName: string, + body: ListAccessRequestModel, + options: AccessListRoleBindingsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/access/default/listRoleBindings{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: listAccessRequestModelSerializer(body), + }); +} + +export async function _listRoleBindingsDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return accessListRoleBindingsSuccessResponseDeserializer(result.body); +} + +/** Organization role bindings */ +export async function listRoleBindings( + context: Client, + resourceGroupName: string, + organizationName: string, + body: ListAccessRequestModel, + options: AccessListRoleBindingsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listRoleBindingsSend( + context, + resourceGroupName, + organizationName, + body, + options, + ); + return _listRoleBindingsDeserialize(result); +} + +export function _listClustersSend( + context: Client, + resourceGroupName: string, + organizationName: string, + body: ListAccessRequestModel, + options: AccessListClustersOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/access/default/listClusters{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: listAccessRequestModelSerializer(body), + }); +} + +export async function _listClustersDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return accessListClusterSuccessResponseDeserializer(result.body); +} + +/** Cluster details */ +export async function listClusters( + context: Client, + resourceGroupName: string, + organizationName: string, + body: ListAccessRequestModel, + options: AccessListClustersOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listClustersSend( + context, + resourceGroupName, + organizationName, + body, + options, + ); + return _listClustersDeserialize(result); +} + +export function _listEnvironmentsSend( + context: Client, + resourceGroupName: string, + organizationName: string, + body: ListAccessRequestModel, + options: AccessListEnvironmentsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/access/default/listEnvironments{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: listAccessRequestModelSerializer(body), + }); +} + +export async function _listEnvironmentsDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return accessListEnvironmentsSuccessResponseDeserializer(result.body); +} + +/** Environment list of an organization */ +export async function listEnvironments( + context: Client, + resourceGroupName: string, + organizationName: string, + body: ListAccessRequestModel, + options: AccessListEnvironmentsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listEnvironmentsSend( + context, + resourceGroupName, + organizationName, + body, + options, + ); + return _listEnvironmentsDeserialize(result); +} + +export function _inviteUserSend( + context: Client, + resourceGroupName: string, + organizationName: string, + body: AccessInviteUserAccountModel, + options: AccessInviteUserOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/access/default/createInvitation{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: accessInviteUserAccountModelSerializer(body), + }); +} + +export async function _inviteUserDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return invitationRecordDeserializer(result.body); +} + +/** Invite user to the organization */ +export async function inviteUser( + context: Client, + resourceGroupName: string, + organizationName: string, + body: AccessInviteUserAccountModel, + options: AccessInviteUserOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _inviteUserSend( + context, + resourceGroupName, + organizationName, + body, + options, + ); + return _inviteUserDeserialize(result); +} + +export function _listInvitationsSend( + context: Client, + resourceGroupName: string, + organizationName: string, + body: ListAccessRequestModel, + options: AccessListInvitationsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/access/default/listInvitations{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: listAccessRequestModelSerializer(body), + }); +} + +export async function _listInvitationsDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return accessListInvitationsSuccessResponseDeserializer(result.body); +} + +/** Organization accounts invitation details */ +export async function listInvitations( + context: Client, + resourceGroupName: string, + organizationName: string, + body: ListAccessRequestModel, + options: AccessListInvitationsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listInvitationsSend( + context, + resourceGroupName, + organizationName, + body, + options, + ); + return _listInvitationsDeserialize(result); +} + +export function _listServiceAccountsSend( + context: Client, + resourceGroupName: string, + organizationName: string, + body: ListAccessRequestModel, + options: AccessListServiceAccountsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/access/default/listServiceAccounts{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: listAccessRequestModelSerializer(body), + }); +} + +export async function _listServiceAccountsDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return accessListServiceAccountsSuccessResponseDeserializer(result.body); +} + +/** Organization service accounts details */ +export async function listServiceAccounts( + context: Client, + resourceGroupName: string, + organizationName: string, + body: ListAccessRequestModel, + options: AccessListServiceAccountsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listServiceAccountsSend( + context, + resourceGroupName, + organizationName, + body, + options, + ); + return _listServiceAccountsDeserialize(result); +} + +export function _listUsersSend( + context: Client, + resourceGroupName: string, + organizationName: string, + body: ListAccessRequestModel, + options: AccessListUsersOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/access/default/listUsers{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: listAccessRequestModelSerializer(body), + }); +} + +export async function _listUsersDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return accessListUsersSuccessResponseDeserializer(result.body); +} + +/** Organization users details */ +export async function listUsers( + context: Client, + resourceGroupName: string, + organizationName: string, + body: ListAccessRequestModel, + options: AccessListUsersOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listUsersSend( + context, + resourceGroupName, + organizationName, + body, + options, + ); + return _listUsersDeserialize(result); +} + +export function _deleteRoleBindingSend( + context: Client, + resourceGroupName: string, + organizationName: string, + roleBindingId: string, + options: AccessDeleteRoleBindingOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/access/default/deleteRoleBinding/{roleBindingId}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + roleBindingId: roleBindingId, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .delete({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _deleteRoleBindingDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return; +} + +/** Organization role bindings */ +export async function deleteRoleBinding( + context: Client, + resourceGroupName: string, + organizationName: string, + roleBindingId: string, + options: AccessDeleteRoleBindingOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _deleteRoleBindingSend( + context, + resourceGroupName, + organizationName, + roleBindingId, + options, + ); + return _deleteRoleBindingDeserialize(result); +} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/access/options.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/access/options.ts new file mode 100644 index 0000000000..4108913207 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/access/options.ts @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface AccessListRoleBindingNameListOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface AccessCreateRoleBindingOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface AccessListRoleBindingsOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface AccessListClustersOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AccessListEnvironmentsOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface AccessInviteUserOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AccessListInvitationsOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AccessListServiceAccountsOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface AccessListUsersOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AccessDeleteRoleBindingOptionalParams + extends OperationOptions {} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/cluster/index.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/cluster/index.ts new file mode 100644 index 0000000000..3717629523 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/cluster/index.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { $delete, createOrUpdate } from "./operations.js"; +export { + ClusterDeleteOptionalParams, + ClusterCreateOrUpdateOptionalParams, +} from "./options.js"; diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/cluster/operations.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/cluster/operations.ts new file mode 100644 index 0000000000..f9d02c418b --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/cluster/operations.ts @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ConfluentContext as Client } from "../index.js"; +import { + resourceProviderDefaultErrorResponseDeserializer, + SCClusterRecord, + scClusterRecordSerializer, + scClusterRecordDeserializer, + errorResponseDeserializer, +} from "../../models/models.js"; +import { + ClusterDeleteOptionalParams, + ClusterCreateOrUpdateOptionalParams, +} from "./options.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + options: ClusterDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/environments/{environmentId}/clusters/{clusterId}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + environmentId: environmentId, + clusterId: clusterId, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .delete({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _$deleteDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["202", "204", "200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Delete confluent cluster by id */ +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export function $delete( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + options: ClusterDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller( + context, + _$deleteDeserialize, + ["202", "204", "200"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _$deleteSend( + context, + resourceGroupName, + organizationName, + environmentId, + clusterId, + options, + ), + resourceLocationConfig: "location", + }, + ) as PollerLike, void>; +} + +export function _createOrUpdateSend( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + options: ClusterCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/environments/{environmentId}/clusters/{clusterId}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + environmentId: environmentId, + clusterId: clusterId, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: !options["body"] + ? options["body"] + : scClusterRecordSerializer(options["body"]), + }); +} + +export async function _createOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return scClusterRecordDeserializer(result.body); +} + +/** Create confluent clusters */ +export async function createOrUpdate( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + options: ClusterCreateOrUpdateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createOrUpdateSend( + context, + resourceGroupName, + organizationName, + environmentId, + clusterId, + options, + ); + return _createOrUpdateDeserialize(result); +} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/cluster/options.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/cluster/options.ts new file mode 100644 index 0000000000..1c0ed1c36a --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/cluster/options.ts @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { SCClusterRecord } from "../../models/models.js"; +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface ClusterDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface ClusterCreateOrUpdateOptionalParams extends OperationOptions { + /** Confluent Cluster resource model */ + body?: SCClusterRecord; +} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/confluentContext.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/confluentContext.ts new file mode 100644 index 0000000000..25a40f8613 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/confluentContext.ts @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { logger } from "../logger.js"; +import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; +import { TokenCredential } from "@azure/core-auth"; + +export interface ConfluentContext extends Client { + /** The ID of the target subscription. The value must be an UUID. */ + subscriptionId: string; +} + +/** Optional parameters for the client. */ +export interface ConfluentClientOptionalParams extends ClientOptions {} + +export function createConfluent( + credential: TokenCredential, + subscriptionId: string, + options: ConfluentClientOptionalParams = {}, +): ConfluentContext { + const endpointUrl = options.endpoint ?? "https://management.azure.com"; + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentInfo = `azsdk-js-arm-confluent/1.0.0-beta.1`; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}` + : `azsdk-js-api ${userAgentInfo}`; + const { apiVersion: _, ...updatedOptions } = { + ...options, + userAgentOptions: { userAgentPrefix }, + loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info }, + credentials: { + scopes: options.credentials?.scopes ?? [`${endpointUrl}/.default`], + }, + }; + const clientContext = getClient(endpointUrl, credential, updatedOptions); + clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + if (options.apiVersion) { + logger.warning( + "This client does not support client api-version, please change it at the operation level", + ); + } + return { ...clientContext, subscriptionId } as ConfluentContext; +} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/connector/index.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/connector/index.ts new file mode 100644 index 0000000000..825fc2b5b7 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/connector/index.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { list, $delete, createOrUpdate, get } from "./operations.js"; +export { + ConnectorListOptionalParams, + ConnectorDeleteOptionalParams, + ConnectorCreateOrUpdateOptionalParams, + ConnectorGetOptionalParams, +} from "./options.js"; diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/connector/operations.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/connector/operations.ts new file mode 100644 index 0000000000..94d2c2ed8f --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/connector/operations.ts @@ -0,0 +1,341 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ConfluentContext as Client } from "../index.js"; +import { + resourceProviderDefaultErrorResponseDeserializer, + errorResponseDeserializer, + ConnectorResource, + connectorResourceSerializer, + connectorResourceDeserializer, + _ListConnectorsSuccessResponse, + _listConnectorsSuccessResponseDeserializer, +} from "../../models/models.js"; +import { + ConnectorListOptionalParams, + ConnectorDeleteOptionalParams, + ConnectorCreateOrUpdateOptionalParams, + ConnectorGetOptionalParams, +} from "./options.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +export function _listSend( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + options: ConnectorListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/environments/{environmentId}/clusters/{clusterId}/connectors{?api%2Dversion,pageSize,pageToken}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + environmentId: environmentId, + clusterId: clusterId, + "api%2Dversion": context.apiVersion, + pageSize: options?.pageSize, + pageToken: options?.pageToken, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listDeserialize( + result: PathUncheckedResponse, +): Promise<_ListConnectorsSuccessResponse> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return _listConnectorsSuccessResponseDeserializer(result.body); +} + +/** Lists all the connectors in a cluster */ +export function list( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + options: ConnectorListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => + _listSend( + context, + resourceGroupName, + organizationName, + environmentId, + clusterId, + options, + ), + _listDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + connectorName: string, + options: ConnectorDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/environments/{environmentId}/clusters/{clusterId}/connectors/{connectorName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + environmentId: environmentId, + clusterId: clusterId, + connectorName: connectorName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .delete({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _$deleteDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["202", "204", "200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Delete confluent connector by name */ +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export function $delete( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + connectorName: string, + options: ConnectorDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller( + context, + _$deleteDeserialize, + ["202", "204", "200"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _$deleteSend( + context, + resourceGroupName, + organizationName, + environmentId, + clusterId, + connectorName, + options, + ), + resourceLocationConfig: "location", + }, + ) as PollerLike, void>; +} + +export function _createOrUpdateSend( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + connectorName: string, + options: ConnectorCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/environments/{environmentId}/clusters/{clusterId}/connectors/{connectorName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + environmentId: environmentId, + clusterId: clusterId, + connectorName: connectorName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: !options["body"] + ? options["body"] + : connectorResourceSerializer(options["body"]), + }); +} + +export async function _createOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return connectorResourceDeserializer(result.body); +} + +/** Create confluent connector by Name */ +export async function createOrUpdate( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + connectorName: string, + options: ConnectorCreateOrUpdateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createOrUpdateSend( + context, + resourceGroupName, + organizationName, + environmentId, + clusterId, + connectorName, + options, + ); + return _createOrUpdateDeserialize(result); +} + +export function _getSend( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + connectorName: string, + options: ConnectorGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/environments/{environmentId}/clusters/{clusterId}/connectors/{connectorName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + environmentId: environmentId, + clusterId: clusterId, + connectorName: connectorName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return connectorResourceDeserializer(result.body); +} + +/** Get confluent connector by Name */ +export async function get( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + connectorName: string, + options: ConnectorGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend( + context, + resourceGroupName, + organizationName, + environmentId, + clusterId, + connectorName, + options, + ); + return _getDeserialize(result); +} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/connector/options.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/connector/options.ts new file mode 100644 index 0000000000..e33c12b74e --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/connector/options.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ConnectorResource } from "../../models/models.js"; +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface ConnectorListOptionalParams extends OperationOptions { + /** Pagination size */ + pageSize?: number; + /** An opaque pagination token to fetch the next set of records */ + pageToken?: string; +} + +/** Optional parameters. */ +export interface ConnectorDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface ConnectorCreateOrUpdateOptionalParams + extends OperationOptions { + /** Confluent Connector resource model */ + body?: ConnectorResource; +} + +/** Optional parameters. */ +export interface ConnectorGetOptionalParams extends OperationOptions {} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/environment/index.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/environment/index.ts new file mode 100644 index 0000000000..bf9f6b53e6 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/environment/index.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { $delete, createOrUpdate } from "./operations.js"; +export { + EnvironmentDeleteOptionalParams, + EnvironmentCreateOrUpdateOptionalParams, +} from "./options.js"; diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/environment/operations.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/environment/operations.ts new file mode 100644 index 0000000000..1e1d881d18 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/environment/operations.ts @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ConfluentContext as Client } from "../index.js"; +import { + resourceProviderDefaultErrorResponseDeserializer, + SCEnvironmentRecord, + scEnvironmentRecordSerializer, + scEnvironmentRecordDeserializer, + errorResponseDeserializer, +} from "../../models/models.js"; +import { + EnvironmentDeleteOptionalParams, + EnvironmentCreateOrUpdateOptionalParams, +} from "./options.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + options: EnvironmentDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/environments/{environmentId}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + environmentId: environmentId, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .delete({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _$deleteDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["202", "204", "200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Delete confluent environment by id */ +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export function $delete( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + options: EnvironmentDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller( + context, + _$deleteDeserialize, + ["202", "204", "200"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _$deleteSend( + context, + resourceGroupName, + organizationName, + environmentId, + options, + ), + resourceLocationConfig: "location", + }, + ) as PollerLike, void>; +} + +export function _createOrUpdateSend( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + options: EnvironmentCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/environments/{environmentId}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + environmentId: environmentId, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: !options["body"] + ? options["body"] + : scEnvironmentRecordSerializer(options["body"]), + }); +} + +export async function _createOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return scEnvironmentRecordDeserializer(result.body); +} + +/** Create confluent environment */ +export async function createOrUpdate( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + options: EnvironmentCreateOrUpdateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createOrUpdateSend( + context, + resourceGroupName, + organizationName, + environmentId, + options, + ); + return _createOrUpdateDeserialize(result); +} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/environment/options.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/environment/options.ts new file mode 100644 index 0000000000..d1fff78866 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/environment/options.ts @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { SCEnvironmentRecord } from "../../models/models.js"; +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface EnvironmentDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface EnvironmentCreateOrUpdateOptionalParams + extends OperationOptions { + /** Confluent Environment resource model */ + body?: SCEnvironmentRecord; +} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/index.ts new file mode 100644 index 0000000000..51436db6be --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/index.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + createConfluent, + ConfluentContext, + ConfluentClientOptionalParams, +} from "./confluentContext.js"; diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/marketplaceAgreements/index.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/marketplaceAgreements/index.ts new file mode 100644 index 0000000000..fbe5eb73a2 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/marketplaceAgreements/index.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { create, list } from "./operations.js"; +export { + MarketplaceAgreementsCreateOptionalParams, + MarketplaceAgreementsListOptionalParams, +} from "./options.js"; diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/marketplaceAgreements/operations.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/marketplaceAgreements/operations.ts new file mode 100644 index 0000000000..9fd8a18f49 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/marketplaceAgreements/operations.ts @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ConfluentContext as Client } from "../index.js"; +import { + resourceProviderDefaultErrorResponseDeserializer, + _ConfluentAgreementResourceListResponse, + _confluentAgreementResourceListResponseDeserializer, + ConfluentAgreementResource, + confluentAgreementResourceSerializer, + confluentAgreementResourceDeserializer, +} from "../../models/models.js"; +import { + MarketplaceAgreementsCreateOptionalParams, + MarketplaceAgreementsListOptionalParams, +} from "./options.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _createSend( + context: Client, + options: MarketplaceAgreementsCreateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/providers/Microsoft.Confluent/agreements/default{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: !options["body"] + ? options["body"] + : confluentAgreementResourceSerializer(options["body"]), + }); +} + +export async function _createDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return confluentAgreementResourceDeserializer(result.body); +} + +/** Create Confluent Marketplace agreement in the subscription. */ +export async function create( + context: Client, + options: MarketplaceAgreementsCreateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createSend(context, options); + return _createDeserialize(result); +} + +export function _listSend( + context: Client, + options: MarketplaceAgreementsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/providers/Microsoft.Confluent/agreements{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listDeserialize( + result: PathUncheckedResponse, +): Promise<_ConfluentAgreementResourceListResponse> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return _confluentAgreementResourceListResponseDeserializer(result.body); +} + +/** List Confluent marketplace agreements in the subscription. */ +export function list( + context: Client, + options: MarketplaceAgreementsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, options), + _listDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/marketplaceAgreements/options.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/marketplaceAgreements/options.ts new file mode 100644 index 0000000000..c7fbf149fa --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/marketplaceAgreements/options.ts @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ConfluentAgreementResource } from "../../models/models.js"; +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface MarketplaceAgreementsCreateOptionalParams + extends OperationOptions { + /** The request body */ + body?: ConfluentAgreementResource; +} + +/** Optional parameters. */ +export interface MarketplaceAgreementsListOptionalParams + extends OperationOptions {} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/organization/index.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/organization/index.ts new file mode 100644 index 0000000000..64cc264926 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/organization/index.ts @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + createApiKey, + listClusters, + getClusterById, + getSchemaRegistryClusterById, + listSchemaRegistryClusters, + listEnvironments, + getEnvironmentById, + listRegions, + listBySubscription, + listByResourceGroup, + $delete, + update, + create, + get, + deleteClusterAPIKey, + getClusterAPIKey, +} from "./operations.js"; +export { + OrganizationCreateApiKeyOptionalParams, + OrganizationListClustersOptionalParams, + OrganizationGetClusterByIdOptionalParams, + OrganizationGetSchemaRegistryClusterByIdOptionalParams, + OrganizationListSchemaRegistryClustersOptionalParams, + OrganizationListEnvironmentsOptionalParams, + OrganizationGetEnvironmentByIdOptionalParams, + OrganizationListRegionsOptionalParams, + OrganizationListBySubscriptionOptionalParams, + OrganizationListByResourceGroupOptionalParams, + OrganizationDeleteOptionalParams, + OrganizationUpdateOptionalParams, + OrganizationCreateOptionalParams, + OrganizationGetOptionalParams, + OrganizationDeleteClusterAPIKeyOptionalParams, + OrganizationGetClusterAPIKeyOptionalParams, +} from "./options.js"; diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/organization/operations.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/organization/operations.ts new file mode 100644 index 0000000000..99df4cd018 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/organization/operations.ts @@ -0,0 +1,1140 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ConfluentContext as Client } from "../index.js"; +import { + resourceProviderDefaultErrorResponseDeserializer, + APIKeyRecord, + apiKeyRecordDeserializer, + OrganizationResource, + organizationResourceSerializer, + organizationResourceDeserializer, + organizationResourceUpdateSerializer, + _OrganizationResourceListResult, + _organizationResourceListResultDeserializer, + ListAccessRequestModel, + listAccessRequestModelSerializer, + ListRegionsSuccessResponse, + listRegionsSuccessResponseDeserializer, + SCEnvironmentRecord, + scEnvironmentRecordDeserializer, + _GetEnvironmentsResponse, + _getEnvironmentsResponseDeserializer, + _ListSchemaRegistryClustersResponse, + _listSchemaRegistryClustersResponseDeserializer, + SchemaRegistryClusterRecord, + schemaRegistryClusterRecordDeserializer, + SCClusterRecord, + scClusterRecordDeserializer, + _ListClustersSuccessResponse, + _listClustersSuccessResponseDeserializer, + CreateAPIKeyModel, + createAPIKeyModelSerializer, +} from "../../models/models.js"; +import { + OrganizationCreateApiKeyOptionalParams, + OrganizationListClustersOptionalParams, + OrganizationGetClusterByIdOptionalParams, + OrganizationGetSchemaRegistryClusterByIdOptionalParams, + OrganizationListSchemaRegistryClustersOptionalParams, + OrganizationListEnvironmentsOptionalParams, + OrganizationGetEnvironmentByIdOptionalParams, + OrganizationListRegionsOptionalParams, + OrganizationListBySubscriptionOptionalParams, + OrganizationListByResourceGroupOptionalParams, + OrganizationDeleteOptionalParams, + OrganizationUpdateOptionalParams, + OrganizationCreateOptionalParams, + OrganizationGetOptionalParams, + OrganizationDeleteClusterAPIKeyOptionalParams, + OrganizationGetClusterAPIKeyOptionalParams, +} from "./options.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +export function _createApiKeySend( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + body: CreateAPIKeyModel, + options: OrganizationCreateApiKeyOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/environments/{environmentId}/clusters/{clusterId}/createAPIKey{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + environmentId: environmentId, + clusterId: clusterId, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: createAPIKeyModelSerializer(body), + }); +} + +export async function _createApiKeyDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return apiKeyRecordDeserializer(result.body); +} + +/** Creates API key for a schema registry Cluster ID or Kafka Cluster ID under a environment */ +export async function createApiKey( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + body: CreateAPIKeyModel, + options: OrganizationCreateApiKeyOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createApiKeySend( + context, + resourceGroupName, + organizationName, + environmentId, + clusterId, + body, + options, + ); + return _createApiKeyDeserialize(result); +} + +export function _listClustersSend( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + options: OrganizationListClustersOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/environments/{environmentId}/clusters{?api%2Dversion,pageSize,pageToken}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + environmentId: environmentId, + "api%2Dversion": context.apiVersion, + pageSize: options?.pageSize, + pageToken: options?.pageToken, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listClustersDeserialize( + result: PathUncheckedResponse, +): Promise<_ListClustersSuccessResponse> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return _listClustersSuccessResponseDeserializer(result.body); +} + +/** Lists of all the clusters in a environment */ +export function listClusters( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + options: OrganizationListClustersOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => + _listClustersSend( + context, + resourceGroupName, + organizationName, + environmentId, + options, + ), + _listClustersDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _getClusterByIdSend( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + options: OrganizationGetClusterByIdOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/environments/{environmentId}/clusters/{clusterId}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + environmentId: environmentId, + clusterId: clusterId, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getClusterByIdDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return scClusterRecordDeserializer(result.body); +} + +/** Get cluster by Id */ +export async function getClusterById( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + options: OrganizationGetClusterByIdOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getClusterByIdSend( + context, + resourceGroupName, + organizationName, + environmentId, + clusterId, + options, + ); + return _getClusterByIdDeserialize(result); +} + +export function _getSchemaRegistryClusterByIdSend( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + options: OrganizationGetSchemaRegistryClusterByIdOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/environments/{environmentId}/schemaRegistryClusters/{clusterId}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + environmentId: environmentId, + clusterId: clusterId, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getSchemaRegistryClusterByIdDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return schemaRegistryClusterRecordDeserializer(result.body); +} + +/** Get schema registry cluster by Id */ +export async function getSchemaRegistryClusterById( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + options: OrganizationGetSchemaRegistryClusterByIdOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _getSchemaRegistryClusterByIdSend( + context, + resourceGroupName, + organizationName, + environmentId, + clusterId, + options, + ); + return _getSchemaRegistryClusterByIdDeserialize(result); +} + +export function _listSchemaRegistryClustersSend( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + options: OrganizationListSchemaRegistryClustersOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/environments/{environmentId}/schemaRegistryClusters{?api%2Dversion,pageSize,pageToken}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + environmentId: environmentId, + "api%2Dversion": context.apiVersion, + pageSize: options?.pageSize, + pageToken: options?.pageToken, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listSchemaRegistryClustersDeserialize( + result: PathUncheckedResponse, +): Promise<_ListSchemaRegistryClustersResponse> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return _listSchemaRegistryClustersResponseDeserializer(result.body); +} + +/** Get schema registry clusters */ +export function listSchemaRegistryClusters( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + options: OrganizationListSchemaRegistryClustersOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => + _listSchemaRegistryClustersSend( + context, + resourceGroupName, + organizationName, + environmentId, + options, + ), + _listSchemaRegistryClustersDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _listEnvironmentsSend( + context: Client, + resourceGroupName: string, + organizationName: string, + options: OrganizationListEnvironmentsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/environments{?api%2Dversion,pageSize,pageToken}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + "api%2Dversion": context.apiVersion, + pageSize: options?.pageSize, + pageToken: options?.pageToken, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listEnvironmentsDeserialize( + result: PathUncheckedResponse, +): Promise<_GetEnvironmentsResponse> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return _getEnvironmentsResponseDeserializer(result.body); +} + +/** Lists of all the environments in a organization */ +export function listEnvironments( + context: Client, + resourceGroupName: string, + organizationName: string, + options: OrganizationListEnvironmentsOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => + _listEnvironmentsSend( + context, + resourceGroupName, + organizationName, + options, + ), + _listEnvironmentsDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _getEnvironmentByIdSend( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + options: OrganizationGetEnvironmentByIdOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/environments/{environmentId}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + environmentId: environmentId, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getEnvironmentByIdDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return scEnvironmentRecordDeserializer(result.body); +} + +/** Get Environment details by environment Id */ +export async function getEnvironmentById( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + options: OrganizationGetEnvironmentByIdOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _getEnvironmentByIdSend( + context, + resourceGroupName, + organizationName, + environmentId, + options, + ); + return _getEnvironmentByIdDeserialize(result); +} + +export function _listRegionsSend( + context: Client, + resourceGroupName: string, + organizationName: string, + body: ListAccessRequestModel, + options: OrganizationListRegionsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/listRegions{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: listAccessRequestModelSerializer(body), + }); +} + +export async function _listRegionsDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return listRegionsSuccessResponseDeserializer(result.body); +} + +/** cloud provider regions available for creating Schema Registry clusters. */ +export async function listRegions( + context: Client, + resourceGroupName: string, + organizationName: string, + body: ListAccessRequestModel, + options: OrganizationListRegionsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listRegionsSend( + context, + resourceGroupName, + organizationName, + body, + options, + ); + return _listRegionsDeserialize(result); +} + +export function _listBySubscriptionSend( + context: Client, + options: OrganizationListBySubscriptionOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/providers/Microsoft.Confluent/organizations{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listBySubscriptionDeserialize( + result: PathUncheckedResponse, +): Promise<_OrganizationResourceListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return _organizationResourceListResultDeserializer(result.body); +} + +/** List all organizations under the specified subscription. */ +export function listBySubscription( + context: Client, + options: OrganizationListBySubscriptionOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listBySubscriptionSend(context, options), + _listBySubscriptionDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _listByResourceGroupSend( + context: Client, + resourceGroupName: string, + options: OrganizationListByResourceGroupOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listByResourceGroupDeserialize( + result: PathUncheckedResponse, +): Promise<_OrganizationResourceListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return _organizationResourceListResultDeserializer(result.body); +} + +/** List all Organizations under the specified resource group. */ +export function listByResourceGroup( + context: Client, + resourceGroupName: string, + options: OrganizationListByResourceGroupOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByResourceGroupSend(context, resourceGroupName, options), + _listByResourceGroupDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + organizationName: string, + options: OrganizationDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .delete({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _$deleteDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return; +} + +/** Delete Organization resource */ +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export function $delete( + context: Client, + resourceGroupName: string, + organizationName: string, + options: OrganizationDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller( + context, + _$deleteDeserialize, + ["200", "202", "204"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _$deleteSend(context, resourceGroupName, organizationName, options), + resourceLocationConfig: "location", + }, + ) as PollerLike, void>; +} + +export function _updateSend( + context: Client, + resourceGroupName: string, + organizationName: string, + options: OrganizationUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .patch({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: !options["body"] + ? options["body"] + : organizationResourceUpdateSerializer(options["body"]), + }); +} + +export async function _updateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return organizationResourceDeserializer(result.body); +} + +/** Update Organization resource */ +export async function update( + context: Client, + resourceGroupName: string, + organizationName: string, + options: OrganizationUpdateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _updateSend( + context, + resourceGroupName, + organizationName, + options, + ); + return _updateDeserialize(result); +} + +export function _createSend( + context: Client, + resourceGroupName: string, + organizationName: string, + options: OrganizationCreateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: !options["body"] + ? options["body"] + : organizationResourceSerializer(options["body"]), + }); +} + +export async function _createDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201", "202"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return organizationResourceDeserializer(result.body); +} + +/** Create Organization resource */ +export function create( + context: Client, + resourceGroupName: string, + organizationName: string, + options: OrganizationCreateOptionalParams = { requestOptions: {} }, +): PollerLike, OrganizationResource> { + return getLongRunningPoller( + context, + _createDeserialize, + ["200", "201", "202"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createSend(context, resourceGroupName, organizationName, options), + resourceLocationConfig: "azure-async-operation", + }, + ) as PollerLike, OrganizationResource>; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + organizationName: string, + options: OrganizationGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return organizationResourceDeserializer(result.body); +} + +/** Get the properties of a specific Organization resource. */ +export async function get( + context: Client, + resourceGroupName: string, + organizationName: string, + options: OrganizationGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend( + context, + resourceGroupName, + organizationName, + options, + ); + return _getDeserialize(result); +} + +export function _deleteClusterAPIKeySend( + context: Client, + resourceGroupName: string, + organizationName: string, + apiKeyId: string, + options: OrganizationDeleteClusterAPIKeyOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/apiKeys/{apiKeyId}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + apiKeyId: apiKeyId, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .delete({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _deleteClusterAPIKeyDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return; +} + +/** Deletes API key of a kafka or schema registry cluster */ +export async function deleteClusterAPIKey( + context: Client, + resourceGroupName: string, + organizationName: string, + apiKeyId: string, + options: OrganizationDeleteClusterAPIKeyOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _deleteClusterAPIKeySend( + context, + resourceGroupName, + organizationName, + apiKeyId, + options, + ); + return _deleteClusterAPIKeyDeserialize(result); +} + +export function _getClusterAPIKeySend( + context: Client, + resourceGroupName: string, + organizationName: string, + apiKeyId: string, + options: OrganizationGetClusterAPIKeyOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/apiKeys/{apiKeyId}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + apiKeyId: apiKeyId, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getClusterAPIKeyDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return apiKeyRecordDeserializer(result.body); +} + +/** Get API key details of a kafka or schema registry cluster */ +export async function getClusterAPIKey( + context: Client, + resourceGroupName: string, + organizationName: string, + apiKeyId: string, + options: OrganizationGetClusterAPIKeyOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getClusterAPIKeySend( + context, + resourceGroupName, + organizationName, + apiKeyId, + options, + ); + return _getClusterAPIKeyDeserialize(result); +} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/organization/options.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/organization/options.ts new file mode 100644 index 0000000000..405947d607 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/organization/options.ts @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + OrganizationResource, + OrganizationResourceUpdate, +} from "../../models/models.js"; +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface OrganizationCreateApiKeyOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface OrganizationListClustersOptionalParams + extends OperationOptions { + /** Pagination size */ + pageSize?: number; + /** An opaque pagination token to fetch the next set of records */ + pageToken?: string; +} + +/** Optional parameters. */ +export interface OrganizationGetClusterByIdOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface OrganizationGetSchemaRegistryClusterByIdOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface OrganizationListSchemaRegistryClustersOptionalParams + extends OperationOptions { + /** Pagination size */ + pageSize?: number; + /** An opaque pagination token to fetch the next set of records */ + pageToken?: string; +} + +/** Optional parameters. */ +export interface OrganizationListEnvironmentsOptionalParams + extends OperationOptions { + /** Pagination size */ + pageSize?: number; + /** An opaque pagination token to fetch the next set of records */ + pageToken?: string; +} + +/** Optional parameters. */ +export interface OrganizationGetEnvironmentByIdOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface OrganizationListRegionsOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface OrganizationListBySubscriptionOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface OrganizationListByResourceGroupOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface OrganizationDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface OrganizationUpdateOptionalParams extends OperationOptions { + /** Updated Organization resource */ + body?: OrganizationResourceUpdate; +} + +/** Optional parameters. */ +export interface OrganizationCreateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** Organization resource model */ + body?: OrganizationResource; +} + +/** Optional parameters. */ +export interface OrganizationGetOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface OrganizationDeleteClusterAPIKeyOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface OrganizationGetClusterAPIKeyOptionalParams + extends OperationOptions {} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/organizationOperations/index.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/organizationOperations/index.ts new file mode 100644 index 0000000000..c8f63b62b0 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/organizationOperations/index.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { list } from "./operations.js"; +export { OrganizationOperationsListOptionalParams } from "./options.js"; diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/organizationOperations/operations.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/organizationOperations/operations.ts new file mode 100644 index 0000000000..62e5d5c58b --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/organizationOperations/operations.ts @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ConfluentContext as Client } from "../index.js"; +import { + _OperationListResult, + _operationListResultDeserializer, + OperationResult, + resourceProviderDefaultErrorResponseDeserializer, +} from "../../models/models.js"; +import { OrganizationOperationsListOptionalParams } from "./options.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _listSend( + context: Client, + options: OrganizationOperationsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.Confluent/operations{?api%2Dversion}", + { + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listDeserialize( + result: PathUncheckedResponse, +): Promise<_OperationListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return _operationListResultDeserializer(result.body); +} + +/** List the operations for the provider */ +export function list( + context: Client, + options: OrganizationOperationsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, options), + _listDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/organizationOperations/options.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/organizationOperations/options.ts new file mode 100644 index 0000000000..8ddc3748aa --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/organizationOperations/options.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface OrganizationOperationsListOptionalParams + extends OperationOptions {} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/topics/index.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/topics/index.ts new file mode 100644 index 0000000000..a4138eb355 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/topics/index.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { list, $delete, create, get } from "./operations.js"; +export { + TopicsListOptionalParams, + TopicsDeleteOptionalParams, + TopicsCreateOptionalParams, + TopicsGetOptionalParams, +} from "./options.js"; diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/topics/operations.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/topics/operations.ts new file mode 100644 index 0000000000..4fcf106a65 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/topics/operations.ts @@ -0,0 +1,341 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ConfluentContext as Client } from "../index.js"; +import { + resourceProviderDefaultErrorResponseDeserializer, + errorResponseDeserializer, + TopicRecord, + topicRecordSerializer, + topicRecordDeserializer, + _ListTopicsSuccessResponse, + _listTopicsSuccessResponseDeserializer, +} from "../../models/models.js"; +import { + TopicsListOptionalParams, + TopicsDeleteOptionalParams, + TopicsCreateOptionalParams, + TopicsGetOptionalParams, +} from "./options.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +export function _listSend( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + options: TopicsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/environments/{environmentId}/clusters/{clusterId}/topics{?api%2Dversion,pageSize,pageToken}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + environmentId: environmentId, + clusterId: clusterId, + "api%2Dversion": context.apiVersion, + pageSize: options?.pageSize, + pageToken: options?.pageToken, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listDeserialize( + result: PathUncheckedResponse, +): Promise<_ListTopicsSuccessResponse> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return _listTopicsSuccessResponseDeserializer(result.body); +} + +/** Lists of all the topics in a clusters */ +export function list( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + options: TopicsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => + _listSend( + context, + resourceGroupName, + organizationName, + environmentId, + clusterId, + options, + ), + _listDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + topicName: string, + options: TopicsDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/environments/{environmentId}/clusters/{clusterId}/topics/{topicName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + environmentId: environmentId, + clusterId: clusterId, + topicName: topicName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .delete({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _$deleteDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["202", "204", "200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Delete confluent topic by name */ +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export function $delete( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + topicName: string, + options: TopicsDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller( + context, + _$deleteDeserialize, + ["202", "204", "200"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _$deleteSend( + context, + resourceGroupName, + organizationName, + environmentId, + clusterId, + topicName, + options, + ), + resourceLocationConfig: "location", + }, + ) as PollerLike, void>; +} + +export function _createSend( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + topicName: string, + options: TopicsCreateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/environments/{environmentId}/clusters/{clusterId}/topics/{topicName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + environmentId: environmentId, + clusterId: clusterId, + topicName: topicName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: !options["body"] + ? options["body"] + : topicRecordSerializer(options["body"]), + }); +} + +export async function _createDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return topicRecordDeserializer(result.body); +} + +/** Create confluent topics by Name */ +export async function create( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + topicName: string, + options: TopicsCreateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createSend( + context, + resourceGroupName, + organizationName, + environmentId, + clusterId, + topicName, + options, + ); + return _createDeserialize(result); +} + +export function _getSend( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + topicName: string, + options: TopicsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/environments/{environmentId}/clusters/{clusterId}/topics/{topicName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + environmentId: environmentId, + clusterId: clusterId, + topicName: topicName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return topicRecordDeserializer(result.body); +} + +/** Get confluent topic by Name */ +export async function get( + context: Client, + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + topicName: string, + options: TopicsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend( + context, + resourceGroupName, + organizationName, + environmentId, + clusterId, + topicName, + options, + ); + return _getDeserialize(result); +} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/topics/options.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/topics/options.ts new file mode 100644 index 0000000000..dd343a41a0 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/topics/options.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { TopicRecord } from "../../models/models.js"; +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface TopicsListOptionalParams extends OperationOptions { + /** Pagination size */ + pageSize?: number; + /** An opaque pagination token to fetch the next set of records */ + pageToken?: string; +} + +/** Optional parameters. */ +export interface TopicsDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface TopicsCreateOptionalParams extends OperationOptions { + /** Confluent Topics resource model */ + body?: TopicRecord; +} + +/** Optional parameters. */ +export interface TopicsGetOptionalParams extends OperationOptions {} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/validations/index.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/validations/index.ts new file mode 100644 index 0000000000..76a968543f --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/validations/index.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { validateOrganizationV2, validateOrganization } from "./operations.js"; +export { + ValidationsValidateOrganizationV2OptionalParams, + ValidationsValidateOrganizationOptionalParams, +} from "./options.js"; diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/validations/operations.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/validations/operations.ts new file mode 100644 index 0000000000..d421dd0181 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/validations/operations.ts @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ConfluentContext as Client } from "../index.js"; +import { + resourceProviderDefaultErrorResponseDeserializer, + OrganizationResource, + organizationResourceSerializer, + organizationResourceDeserializer, + ValidationResponse, + validationResponseDeserializer, +} from "../../models/models.js"; +import { + ValidationsValidateOrganizationV2OptionalParams, + ValidationsValidateOrganizationOptionalParams, +} from "./options.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _validateOrganizationV2Send( + context: Client, + resourceGroupName: string, + organizationName: string, + body: OrganizationResource, + options: ValidationsValidateOrganizationV2OptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/validations/{organizationName}/orgvalidateV2{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: organizationResourceSerializer(body), + }); +} + +export async function _validateOrganizationV2Deserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return validationResponseDeserializer(result.body); +} + +/** Organization Validate proxy resource */ +export async function validateOrganizationV2( + context: Client, + resourceGroupName: string, + organizationName: string, + body: OrganizationResource, + options: ValidationsValidateOrganizationV2OptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _validateOrganizationV2Send( + context, + resourceGroupName, + organizationName, + body, + options, + ); + return _validateOrganizationV2Deserialize(result); +} + +export function _validateOrganizationSend( + context: Client, + resourceGroupName: string, + organizationName: string, + body: OrganizationResource, + options: ValidationsValidateOrganizationOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/validations/{organizationName}/orgvalidate{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + organizationName: organizationName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: organizationResourceSerializer(body), + }); +} + +export async function _validateOrganizationDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = resourceProviderDefaultErrorResponseDeserializer( + result.body, + ); + throw error; + } + + return organizationResourceDeserializer(result.body); +} + +/** Organization Validate proxy resource */ +export async function validateOrganization( + context: Client, + resourceGroupName: string, + organizationName: string, + body: OrganizationResource, + options: ValidationsValidateOrganizationOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _validateOrganizationSend( + context, + resourceGroupName, + organizationName, + body, + options, + ); + return _validateOrganizationDeserialize(result); +} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/validations/options.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/validations/options.ts new file mode 100644 index 0000000000..a91e09e4b4 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/api/validations/options.ts @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface ValidationsValidateOrganizationV2OptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface ValidationsValidateOrganizationOptionalParams + extends OperationOptions {} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/classic/access/index.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/classic/access/index.ts new file mode 100644 index 0000000000..07b09bfd63 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/classic/access/index.ts @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ConfluentContext } from "../../api/confluentContext.js"; +import { + ListAccessRequestModel, + AccessListUsersSuccessResponse, + AccessListServiceAccountsSuccessResponse, + AccessListInvitationsSuccessResponse, + InvitationRecord, + AccessInviteUserAccountModel, + AccessListEnvironmentsSuccessResponse, + AccessListClusterSuccessResponse, + AccessListRoleBindingsSuccessResponse, + RoleBindingRecord, + AccessCreateRoleBindingRequestModel, + AccessRoleBindingNameListSuccessResponse, +} from "../../models/models.js"; +import { + AccessListRoleBindingNameListOptionalParams, + AccessCreateRoleBindingOptionalParams, + AccessListRoleBindingsOptionalParams, + AccessListClustersOptionalParams, + AccessListEnvironmentsOptionalParams, + AccessInviteUserOptionalParams, + AccessListInvitationsOptionalParams, + AccessListServiceAccountsOptionalParams, + AccessListUsersOptionalParams, + AccessDeleteRoleBindingOptionalParams, +} from "../../api/access/options.js"; +import { + listRoleBindingNameList, + createRoleBinding, + listRoleBindings, + listClusters, + listEnvironments, + inviteUser, + listInvitations, + listServiceAccounts, + listUsers, + deleteRoleBinding, +} from "../../api/access/operations.js"; + +/** Interface representing a Access operations. */ +export interface AccessOperations { + /** Organization role bindings */ + listRoleBindingNameList: ( + resourceGroupName: string, + organizationName: string, + body: ListAccessRequestModel, + options?: AccessListRoleBindingNameListOptionalParams, + ) => Promise; + /** Organization role bindings */ + createRoleBinding: ( + resourceGroupName: string, + organizationName: string, + body: AccessCreateRoleBindingRequestModel, + options?: AccessCreateRoleBindingOptionalParams, + ) => Promise; + /** Organization role bindings */ + listRoleBindings: ( + resourceGroupName: string, + organizationName: string, + body: ListAccessRequestModel, + options?: AccessListRoleBindingsOptionalParams, + ) => Promise; + /** Cluster details */ + listClusters: ( + resourceGroupName: string, + organizationName: string, + body: ListAccessRequestModel, + options?: AccessListClustersOptionalParams, + ) => Promise; + /** Environment list of an organization */ + listEnvironments: ( + resourceGroupName: string, + organizationName: string, + body: ListAccessRequestModel, + options?: AccessListEnvironmentsOptionalParams, + ) => Promise; + /** Invite user to the organization */ + inviteUser: ( + resourceGroupName: string, + organizationName: string, + body: AccessInviteUserAccountModel, + options?: AccessInviteUserOptionalParams, + ) => Promise; + /** Organization accounts invitation details */ + listInvitations: ( + resourceGroupName: string, + organizationName: string, + body: ListAccessRequestModel, + options?: AccessListInvitationsOptionalParams, + ) => Promise; + /** Organization service accounts details */ + listServiceAccounts: ( + resourceGroupName: string, + organizationName: string, + body: ListAccessRequestModel, + options?: AccessListServiceAccountsOptionalParams, + ) => Promise; + /** Organization users details */ + listUsers: ( + resourceGroupName: string, + organizationName: string, + body: ListAccessRequestModel, + options?: AccessListUsersOptionalParams, + ) => Promise; + /** Organization role bindings */ + deleteRoleBinding: ( + resourceGroupName: string, + organizationName: string, + roleBindingId: string, + options?: AccessDeleteRoleBindingOptionalParams, + ) => Promise; +} + +function _getAccess(context: ConfluentContext) { + return { + listRoleBindingNameList: ( + resourceGroupName: string, + organizationName: string, + body: ListAccessRequestModel, + options?: AccessListRoleBindingNameListOptionalParams, + ) => + listRoleBindingNameList( + context, + resourceGroupName, + organizationName, + body, + options, + ), + createRoleBinding: ( + resourceGroupName: string, + organizationName: string, + body: AccessCreateRoleBindingRequestModel, + options?: AccessCreateRoleBindingOptionalParams, + ) => + createRoleBinding( + context, + resourceGroupName, + organizationName, + body, + options, + ), + listRoleBindings: ( + resourceGroupName: string, + organizationName: string, + body: ListAccessRequestModel, + options?: AccessListRoleBindingsOptionalParams, + ) => + listRoleBindings( + context, + resourceGroupName, + organizationName, + body, + options, + ), + listClusters: ( + resourceGroupName: string, + organizationName: string, + body: ListAccessRequestModel, + options?: AccessListClustersOptionalParams, + ) => + listClusters(context, resourceGroupName, organizationName, body, options), + listEnvironments: ( + resourceGroupName: string, + organizationName: string, + body: ListAccessRequestModel, + options?: AccessListEnvironmentsOptionalParams, + ) => + listEnvironments( + context, + resourceGroupName, + organizationName, + body, + options, + ), + inviteUser: ( + resourceGroupName: string, + organizationName: string, + body: AccessInviteUserAccountModel, + options?: AccessInviteUserOptionalParams, + ) => + inviteUser(context, resourceGroupName, organizationName, body, options), + listInvitations: ( + resourceGroupName: string, + organizationName: string, + body: ListAccessRequestModel, + options?: AccessListInvitationsOptionalParams, + ) => + listInvitations( + context, + resourceGroupName, + organizationName, + body, + options, + ), + listServiceAccounts: ( + resourceGroupName: string, + organizationName: string, + body: ListAccessRequestModel, + options?: AccessListServiceAccountsOptionalParams, + ) => + listServiceAccounts( + context, + resourceGroupName, + organizationName, + body, + options, + ), + listUsers: ( + resourceGroupName: string, + organizationName: string, + body: ListAccessRequestModel, + options?: AccessListUsersOptionalParams, + ) => listUsers(context, resourceGroupName, organizationName, body, options), + deleteRoleBinding: ( + resourceGroupName: string, + organizationName: string, + roleBindingId: string, + options?: AccessDeleteRoleBindingOptionalParams, + ) => + deleteRoleBinding( + context, + resourceGroupName, + organizationName, + roleBindingId, + options, + ), + }; +} + +export function _getAccessOperations( + context: ConfluentContext, +): AccessOperations { + return { + ..._getAccess(context), + }; +} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/classic/cluster/index.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/classic/cluster/index.ts new file mode 100644 index 0000000000..b4103e69ca --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/classic/cluster/index.ts @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ConfluentContext } from "../../api/confluentContext.js"; +import { SCClusterRecord } from "../../models/models.js"; +import { + ClusterDeleteOptionalParams, + ClusterCreateOrUpdateOptionalParams, +} from "../../api/cluster/options.js"; +import { $delete, createOrUpdate } from "../../api/cluster/operations.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a Cluster operations. */ +export interface ClusterOperations { + /** Delete confluent cluster by id */ + /** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ + delete: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + options?: ClusterDeleteOptionalParams, + ) => PollerLike, void>; + /** Create confluent clusters */ + createOrUpdate: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + options?: ClusterCreateOrUpdateOptionalParams, + ) => Promise; +} + +function _getCluster(context: ConfluentContext) { + return { + delete: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + options?: ClusterDeleteOptionalParams, + ) => + $delete( + context, + resourceGroupName, + organizationName, + environmentId, + clusterId, + options, + ), + createOrUpdate: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + options?: ClusterCreateOrUpdateOptionalParams, + ) => + createOrUpdate( + context, + resourceGroupName, + organizationName, + environmentId, + clusterId, + options, + ), + }; +} + +export function _getClusterOperations( + context: ConfluentContext, +): ClusterOperations { + return { + ..._getCluster(context), + }; +} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/classic/connector/index.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/classic/connector/index.ts new file mode 100644 index 0000000000..1fc0fcf895 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/classic/connector/index.ts @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ConfluentContext } from "../../api/confluentContext.js"; +import { ConnectorResource } from "../../models/models.js"; +import { + ConnectorListOptionalParams, + ConnectorDeleteOptionalParams, + ConnectorCreateOrUpdateOptionalParams, + ConnectorGetOptionalParams, +} from "../../api/connector/options.js"; +import { + list, + $delete, + createOrUpdate, + get, +} from "../../api/connector/operations.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a Connector operations. */ +export interface ConnectorOperations { + /** Lists all the connectors in a cluster */ + list: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + options?: ConnectorListOptionalParams, + ) => PagedAsyncIterableIterator; + /** Delete confluent connector by name */ + /** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ + delete: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + connectorName: string, + options?: ConnectorDeleteOptionalParams, + ) => PollerLike, void>; + /** Create confluent connector by Name */ + createOrUpdate: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + connectorName: string, + options?: ConnectorCreateOrUpdateOptionalParams, + ) => Promise; + /** Get confluent connector by Name */ + get: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + connectorName: string, + options?: ConnectorGetOptionalParams, + ) => Promise; +} + +function _getConnector(context: ConfluentContext) { + return { + list: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + options?: ConnectorListOptionalParams, + ) => + list( + context, + resourceGroupName, + organizationName, + environmentId, + clusterId, + options, + ), + delete: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + connectorName: string, + options?: ConnectorDeleteOptionalParams, + ) => + $delete( + context, + resourceGroupName, + organizationName, + environmentId, + clusterId, + connectorName, + options, + ), + createOrUpdate: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + connectorName: string, + options?: ConnectorCreateOrUpdateOptionalParams, + ) => + createOrUpdate( + context, + resourceGroupName, + organizationName, + environmentId, + clusterId, + connectorName, + options, + ), + get: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + connectorName: string, + options?: ConnectorGetOptionalParams, + ) => + get( + context, + resourceGroupName, + organizationName, + environmentId, + clusterId, + connectorName, + options, + ), + }; +} + +export function _getConnectorOperations( + context: ConfluentContext, +): ConnectorOperations { + return { + ..._getConnector(context), + }; +} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/classic/environment/index.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/classic/environment/index.ts new file mode 100644 index 0000000000..04d0fe9f47 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/classic/environment/index.ts @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ConfluentContext } from "../../api/confluentContext.js"; +import { SCEnvironmentRecord } from "../../models/models.js"; +import { + EnvironmentDeleteOptionalParams, + EnvironmentCreateOrUpdateOptionalParams, +} from "../../api/environment/options.js"; +import { $delete, createOrUpdate } from "../../api/environment/operations.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a Environment operations. */ +export interface EnvironmentOperations { + /** Delete confluent environment by id */ + /** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ + delete: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + options?: EnvironmentDeleteOptionalParams, + ) => PollerLike, void>; + /** Create confluent environment */ + createOrUpdate: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + options?: EnvironmentCreateOrUpdateOptionalParams, + ) => Promise; +} + +function _getEnvironment(context: ConfluentContext) { + return { + delete: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + options?: EnvironmentDeleteOptionalParams, + ) => + $delete( + context, + resourceGroupName, + organizationName, + environmentId, + options, + ), + createOrUpdate: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + options?: EnvironmentCreateOrUpdateOptionalParams, + ) => + createOrUpdate( + context, + resourceGroupName, + organizationName, + environmentId, + options, + ), + }; +} + +export function _getEnvironmentOperations( + context: ConfluentContext, +): EnvironmentOperations { + return { + ..._getEnvironment(context), + }; +} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/classic/index.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/classic/index.ts new file mode 100644 index 0000000000..78dbdb6c78 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/classic/index.ts @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { AccessOperations } from "./access/index.js"; +export { ClusterOperations } from "./cluster/index.js"; +export { ConnectorOperations } from "./connector/index.js"; +export { EnvironmentOperations } from "./environment/index.js"; +export { MarketplaceAgreementsOperations } from "./marketplaceAgreements/index.js"; +export { OrganizationOperations } from "./organization/index.js"; +export { OrganizationOperationsOperations } from "./organizationOperations/index.js"; +export { TopicsOperations } from "./topics/index.js"; +export { ValidationsOperations } from "./validations/index.js"; diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/classic/marketplaceAgreements/index.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/classic/marketplaceAgreements/index.ts new file mode 100644 index 0000000000..81cd0d045e --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/classic/marketplaceAgreements/index.ts @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ConfluentContext } from "../../api/confluentContext.js"; +import { ConfluentAgreementResource } from "../../models/models.js"; +import { + MarketplaceAgreementsCreateOptionalParams, + MarketplaceAgreementsListOptionalParams, +} from "../../api/marketplaceAgreements/options.js"; +import { create, list } from "../../api/marketplaceAgreements/operations.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a MarketplaceAgreements operations. */ +export interface MarketplaceAgreementsOperations { + /** Create Confluent Marketplace agreement in the subscription. */ + create: ( + options?: MarketplaceAgreementsCreateOptionalParams, + ) => Promise; + /** List Confluent marketplace agreements in the subscription. */ + list: ( + options?: MarketplaceAgreementsListOptionalParams, + ) => PagedAsyncIterableIterator; +} + +function _getMarketplaceAgreements(context: ConfluentContext) { + return { + create: (options?: MarketplaceAgreementsCreateOptionalParams) => + create(context, options), + list: (options?: MarketplaceAgreementsListOptionalParams) => + list(context, options), + }; +} + +export function _getMarketplaceAgreementsOperations( + context: ConfluentContext, +): MarketplaceAgreementsOperations { + return { + ..._getMarketplaceAgreements(context), + }; +} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/classic/organization/index.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/classic/organization/index.ts new file mode 100644 index 0000000000..b5f48f3be3 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/classic/organization/index.ts @@ -0,0 +1,332 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ConfluentContext } from "../../api/confluentContext.js"; +import { + APIKeyRecord, + OrganizationResource, + ListAccessRequestModel, + ListRegionsSuccessResponse, + SCEnvironmentRecord, + SchemaRegistryClusterRecord, + SCClusterRecord, + CreateAPIKeyModel, +} from "../../models/models.js"; +import { + OrganizationCreateApiKeyOptionalParams, + OrganizationListClustersOptionalParams, + OrganizationGetClusterByIdOptionalParams, + OrganizationGetSchemaRegistryClusterByIdOptionalParams, + OrganizationListSchemaRegistryClustersOptionalParams, + OrganizationListEnvironmentsOptionalParams, + OrganizationGetEnvironmentByIdOptionalParams, + OrganizationListRegionsOptionalParams, + OrganizationListBySubscriptionOptionalParams, + OrganizationListByResourceGroupOptionalParams, + OrganizationDeleteOptionalParams, + OrganizationUpdateOptionalParams, + OrganizationCreateOptionalParams, + OrganizationGetOptionalParams, + OrganizationDeleteClusterAPIKeyOptionalParams, + OrganizationGetClusterAPIKeyOptionalParams, +} from "../../api/organization/options.js"; +import { + createApiKey, + listClusters, + getClusterById, + getSchemaRegistryClusterById, + listSchemaRegistryClusters, + listEnvironments, + getEnvironmentById, + listRegions, + listBySubscription, + listByResourceGroup, + $delete, + update, + create, + get, + deleteClusterAPIKey, + getClusterAPIKey, +} from "../../api/organization/operations.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a Organization operations. */ +export interface OrganizationOperations { + /** Creates API key for a schema registry Cluster ID or Kafka Cluster ID under a environment */ + createApiKey: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + body: CreateAPIKeyModel, + options?: OrganizationCreateApiKeyOptionalParams, + ) => Promise; + /** Lists of all the clusters in a environment */ + listClusters: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + options?: OrganizationListClustersOptionalParams, + ) => PagedAsyncIterableIterator; + /** Get cluster by Id */ + getClusterById: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + options?: OrganizationGetClusterByIdOptionalParams, + ) => Promise; + /** Get schema registry cluster by Id */ + getSchemaRegistryClusterById: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + options?: OrganizationGetSchemaRegistryClusterByIdOptionalParams, + ) => Promise; + /** Get schema registry clusters */ + listSchemaRegistryClusters: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + options?: OrganizationListSchemaRegistryClustersOptionalParams, + ) => PagedAsyncIterableIterator; + /** Lists of all the environments in a organization */ + listEnvironments: ( + resourceGroupName: string, + organizationName: string, + options?: OrganizationListEnvironmentsOptionalParams, + ) => PagedAsyncIterableIterator; + /** Get Environment details by environment Id */ + getEnvironmentById: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + options?: OrganizationGetEnvironmentByIdOptionalParams, + ) => Promise; + /** cloud provider regions available for creating Schema Registry clusters. */ + listRegions: ( + resourceGroupName: string, + organizationName: string, + body: ListAccessRequestModel, + options?: OrganizationListRegionsOptionalParams, + ) => Promise; + /** List all organizations under the specified subscription. */ + listBySubscription: ( + options?: OrganizationListBySubscriptionOptionalParams, + ) => PagedAsyncIterableIterator; + /** List all Organizations under the specified resource group. */ + listByResourceGroup: ( + resourceGroupName: string, + options?: OrganizationListByResourceGroupOptionalParams, + ) => PagedAsyncIterableIterator; + /** Delete Organization resource */ + /** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ + delete: ( + resourceGroupName: string, + organizationName: string, + options?: OrganizationDeleteOptionalParams, + ) => PollerLike, void>; + /** Update Organization resource */ + update: ( + resourceGroupName: string, + organizationName: string, + options?: OrganizationUpdateOptionalParams, + ) => Promise; + /** Create Organization resource */ + create: ( + resourceGroupName: string, + organizationName: string, + options?: OrganizationCreateOptionalParams, + ) => PollerLike, OrganizationResource>; + /** Get the properties of a specific Organization resource. */ + get: ( + resourceGroupName: string, + organizationName: string, + options?: OrganizationGetOptionalParams, + ) => Promise; + /** Deletes API key of a kafka or schema registry cluster */ + deleteClusterAPIKey: ( + resourceGroupName: string, + organizationName: string, + apiKeyId: string, + options?: OrganizationDeleteClusterAPIKeyOptionalParams, + ) => Promise; + /** Get API key details of a kafka or schema registry cluster */ + getClusterAPIKey: ( + resourceGroupName: string, + organizationName: string, + apiKeyId: string, + options?: OrganizationGetClusterAPIKeyOptionalParams, + ) => Promise; +} + +function _getOrganization(context: ConfluentContext) { + return { + createApiKey: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + body: CreateAPIKeyModel, + options?: OrganizationCreateApiKeyOptionalParams, + ) => + createApiKey( + context, + resourceGroupName, + organizationName, + environmentId, + clusterId, + body, + options, + ), + listClusters: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + options?: OrganizationListClustersOptionalParams, + ) => + listClusters( + context, + resourceGroupName, + organizationName, + environmentId, + options, + ), + getClusterById: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + options?: OrganizationGetClusterByIdOptionalParams, + ) => + getClusterById( + context, + resourceGroupName, + organizationName, + environmentId, + clusterId, + options, + ), + getSchemaRegistryClusterById: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + options?: OrganizationGetSchemaRegistryClusterByIdOptionalParams, + ) => + getSchemaRegistryClusterById( + context, + resourceGroupName, + organizationName, + environmentId, + clusterId, + options, + ), + listSchemaRegistryClusters: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + options?: OrganizationListSchemaRegistryClustersOptionalParams, + ) => + listSchemaRegistryClusters( + context, + resourceGroupName, + organizationName, + environmentId, + options, + ), + listEnvironments: ( + resourceGroupName: string, + organizationName: string, + options?: OrganizationListEnvironmentsOptionalParams, + ) => + listEnvironments(context, resourceGroupName, organizationName, options), + getEnvironmentById: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + options?: OrganizationGetEnvironmentByIdOptionalParams, + ) => + getEnvironmentById( + context, + resourceGroupName, + organizationName, + environmentId, + options, + ), + listRegions: ( + resourceGroupName: string, + organizationName: string, + body: ListAccessRequestModel, + options?: OrganizationListRegionsOptionalParams, + ) => + listRegions(context, resourceGroupName, organizationName, body, options), + listBySubscription: ( + options?: OrganizationListBySubscriptionOptionalParams, + ) => listBySubscription(context, options), + listByResourceGroup: ( + resourceGroupName: string, + options?: OrganizationListByResourceGroupOptionalParams, + ) => listByResourceGroup(context, resourceGroupName, options), + delete: ( + resourceGroupName: string, + organizationName: string, + options?: OrganizationDeleteOptionalParams, + ) => $delete(context, resourceGroupName, organizationName, options), + update: ( + resourceGroupName: string, + organizationName: string, + options?: OrganizationUpdateOptionalParams, + ) => update(context, resourceGroupName, organizationName, options), + create: ( + resourceGroupName: string, + organizationName: string, + options?: OrganizationCreateOptionalParams, + ) => create(context, resourceGroupName, organizationName, options), + get: ( + resourceGroupName: string, + organizationName: string, + options?: OrganizationGetOptionalParams, + ) => get(context, resourceGroupName, organizationName, options), + deleteClusterAPIKey: ( + resourceGroupName: string, + organizationName: string, + apiKeyId: string, + options?: OrganizationDeleteClusterAPIKeyOptionalParams, + ) => + deleteClusterAPIKey( + context, + resourceGroupName, + organizationName, + apiKeyId, + options, + ), + getClusterAPIKey: ( + resourceGroupName: string, + organizationName: string, + apiKeyId: string, + options?: OrganizationGetClusterAPIKeyOptionalParams, + ) => + getClusterAPIKey( + context, + resourceGroupName, + organizationName, + apiKeyId, + options, + ), + }; +} + +export function _getOrganizationOperations( + context: ConfluentContext, +): OrganizationOperations { + return { + ..._getOrganization(context), + }; +} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/classic/organizationOperations/index.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/classic/organizationOperations/index.ts new file mode 100644 index 0000000000..5c5b554d4a --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/classic/organizationOperations/index.ts @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ConfluentContext } from "../../api/confluentContext.js"; +import { OperationResult } from "../../models/models.js"; +import { OrganizationOperationsListOptionalParams } from "../../api/organizationOperations/options.js"; +import { list } from "../../api/organizationOperations/operations.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a OrganizationOperations operations. */ +export interface OrganizationOperationsOperations { + /** List the operations for the provider */ + list: ( + options?: OrganizationOperationsListOptionalParams, + ) => PagedAsyncIterableIterator; +} + +function _getOrganizationOperations(context: ConfluentContext) { + return { + list: (options?: OrganizationOperationsListOptionalParams) => + list(context, options), + }; +} + +export function _getOrganizationOperationsOperations( + context: ConfluentContext, +): OrganizationOperationsOperations { + return { + ..._getOrganizationOperations(context), + }; +} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/classic/topics/index.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/classic/topics/index.ts new file mode 100644 index 0000000000..9e0f774667 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/classic/topics/index.ts @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ConfluentContext } from "../../api/confluentContext.js"; +import { TopicRecord } from "../../models/models.js"; +import { + TopicsListOptionalParams, + TopicsDeleteOptionalParams, + TopicsCreateOptionalParams, + TopicsGetOptionalParams, +} from "../../api/topics/options.js"; +import { list, $delete, create, get } from "../../api/topics/operations.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a Topics operations. */ +export interface TopicsOperations { + /** Lists of all the topics in a clusters */ + list: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + options?: TopicsListOptionalParams, + ) => PagedAsyncIterableIterator; + /** Delete confluent topic by name */ + /** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ + delete: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + topicName: string, + options?: TopicsDeleteOptionalParams, + ) => PollerLike, void>; + /** Create confluent topics by Name */ + create: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + topicName: string, + options?: TopicsCreateOptionalParams, + ) => Promise; + /** Get confluent topic by Name */ + get: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + topicName: string, + options?: TopicsGetOptionalParams, + ) => Promise; +} + +function _getTopics(context: ConfluentContext) { + return { + list: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + options?: TopicsListOptionalParams, + ) => + list( + context, + resourceGroupName, + organizationName, + environmentId, + clusterId, + options, + ), + delete: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + topicName: string, + options?: TopicsDeleteOptionalParams, + ) => + $delete( + context, + resourceGroupName, + organizationName, + environmentId, + clusterId, + topicName, + options, + ), + create: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + topicName: string, + options?: TopicsCreateOptionalParams, + ) => + create( + context, + resourceGroupName, + organizationName, + environmentId, + clusterId, + topicName, + options, + ), + get: ( + resourceGroupName: string, + organizationName: string, + environmentId: string, + clusterId: string, + topicName: string, + options?: TopicsGetOptionalParams, + ) => + get( + context, + resourceGroupName, + organizationName, + environmentId, + clusterId, + topicName, + options, + ), + }; +} + +export function _getTopicsOperations( + context: ConfluentContext, +): TopicsOperations { + return { + ..._getTopics(context), + }; +} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/classic/validations/index.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/classic/validations/index.ts new file mode 100644 index 0000000000..f7d265d23a --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/classic/validations/index.ts @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ConfluentContext } from "../../api/confluentContext.js"; +import { + OrganizationResource, + ValidationResponse, +} from "../../models/models.js"; +import { + ValidationsValidateOrganizationV2OptionalParams, + ValidationsValidateOrganizationOptionalParams, +} from "../../api/validations/options.js"; +import { + validateOrganizationV2, + validateOrganization, +} from "../../api/validations/operations.js"; + +/** Interface representing a Validations operations. */ +export interface ValidationsOperations { + /** Organization Validate proxy resource */ + validateOrganizationV2: ( + resourceGroupName: string, + organizationName: string, + body: OrganizationResource, + options?: ValidationsValidateOrganizationV2OptionalParams, + ) => Promise; + /** Organization Validate proxy resource */ + validateOrganization: ( + resourceGroupName: string, + organizationName: string, + body: OrganizationResource, + options?: ValidationsValidateOrganizationOptionalParams, + ) => Promise; +} + +function _getValidations(context: ConfluentContext) { + return { + validateOrganizationV2: ( + resourceGroupName: string, + organizationName: string, + body: OrganizationResource, + options?: ValidationsValidateOrganizationV2OptionalParams, + ) => + validateOrganizationV2( + context, + resourceGroupName, + organizationName, + body, + options, + ), + validateOrganization: ( + resourceGroupName: string, + organizationName: string, + body: OrganizationResource, + options?: ValidationsValidateOrganizationOptionalParams, + ) => + validateOrganization( + context, + resourceGroupName, + organizationName, + body, + options, + ), + }; +} + +export function _getValidationsOperations( + context: ConfluentContext, +): ValidationsOperations { + return { + ..._getValidations(context), + }; +} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/confluentClient.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/confluentClient.ts new file mode 100644 index 0000000000..ae0c07d8f6 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/confluentClient.ts @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + createConfluent, + ConfluentContext, + ConfluentClientOptionalParams, +} from "./api/index.js"; +import { + ValidationsOperations, + _getValidationsOperations, +} from "./classic/validations/index.js"; +import { + MarketplaceAgreementsOperations, + _getMarketplaceAgreementsOperations, +} from "./classic/marketplaceAgreements/index.js"; +import { + TopicsOperations, + _getTopicsOperations, +} from "./classic/topics/index.js"; +import { + ConnectorOperations, + _getConnectorOperations, +} from "./classic/connector/index.js"; +import { + ClusterOperations, + _getClusterOperations, +} from "./classic/cluster/index.js"; +import { + EnvironmentOperations, + _getEnvironmentOperations, +} from "./classic/environment/index.js"; +import { + AccessOperations, + _getAccessOperations, +} from "./classic/access/index.js"; +import { + OrganizationOperations, + _getOrganizationOperations, +} from "./classic/organization/index.js"; +import { + OrganizationOperationsOperations, + _getOrganizationOperationsOperations, +} from "./classic/organizationOperations/index.js"; +import { Pipeline } from "@azure/core-rest-pipeline"; +import { TokenCredential } from "@azure/core-auth"; + +export { ConfluentClientOptionalParams } from "./api/confluentContext.js"; + +export class ConfluentClient { + private _client: ConfluentContext; + /** The pipeline used by this client to make requests */ + public readonly pipeline: Pipeline; + + constructor( + credential: TokenCredential, + subscriptionId: string, + options: ConfluentClientOptionalParams = {}, + ) { + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-client` + : `azsdk-js-client`; + this._client = createConfluent(credential, subscriptionId, { + ...options, + userAgentOptions: { userAgentPrefix }, + }); + this.pipeline = this._client.pipeline; + this.validations = _getValidationsOperations(this._client); + this.marketplaceAgreements = _getMarketplaceAgreementsOperations( + this._client, + ); + this.topics = _getTopicsOperations(this._client); + this.connector = _getConnectorOperations(this._client); + this.cluster = _getClusterOperations(this._client); + this.environment = _getEnvironmentOperations(this._client); + this.access = _getAccessOperations(this._client); + this.organization = _getOrganizationOperations(this._client); + this.organizationOperations = _getOrganizationOperationsOperations( + this._client, + ); + } + + /** The operation groups for validations */ + public readonly validations: ValidationsOperations; + /** The operation groups for marketplaceAgreements */ + public readonly marketplaceAgreements: MarketplaceAgreementsOperations; + /** The operation groups for topics */ + public readonly topics: TopicsOperations; + /** The operation groups for connector */ + public readonly connector: ConnectorOperations; + /** The operation groups for cluster */ + public readonly cluster: ClusterOperations; + /** The operation groups for environment */ + public readonly environment: EnvironmentOperations; + /** The operation groups for access */ + public readonly access: AccessOperations; + /** The operation groups for organization */ + public readonly organization: OrganizationOperations; + /** The operation groups for organizationOperations */ + public readonly organizationOperations: OrganizationOperationsOperations; +} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/index.ts new file mode 100644 index 0000000000..20f81da16e --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/index.ts @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + PageSettings, + ContinuablePage, + PagedAsyncIterableIterator, +} from "./static-helpers/pagingHelpers.js"; + +export { ConfluentClient } from "./confluentClient.js"; +export { restorePoller, RestorePollerOptions } from "./restorePollerHelpers.js"; +export { + OperationResult, + OperationDisplay, + ResourceProviderDefaultErrorResponse, + ErrorResponseBody, + APIKeyRecord, + APIKeyProperties, + SCMetadataEntity, + APIKeySpecEntity, + APIKeyResourceEntity, + APIKeyOwnerEntity, + OrganizationResource, + OrganizationResourceProperties, + KnownProvisionState, + ProvisionState, + OfferDetail, + KnownSaaSOfferStatus, + SaaSOfferStatus, + UserDetail, + LinkOrganization, + TrackedResource, + Resource, + SystemData, + KnownCreatedByType, + CreatedByType, + ErrorDetail, + ErrorAdditionalInfo, + OrganizationResourceUpdate, + ListAccessRequestModel, + ListRegionsSuccessResponse, + RegionRecord, + RegionProperties, + RegionSpecEntity, + SCEnvironmentRecord, + EnvironmentProperties, + StreamGovernanceConfig, + KnownPackage, + Package, + ProxyResource, + SchemaRegistryClusterRecord, + SchemaRegistryClusterProperties, + SchemaRegistryClusterSpecEntity, + SchemaRegistryClusterEnvironmentRegionEntity, + SchemaRegistryClusterStatusEntity, + SCClusterRecord, + ClusterProperties, + SCClusterSpecEntity, + ClusterConfigEntity, + SCClusterNetworkEnvironmentEntity, + SCClusterByokEntity, + ClusterStatusEntity, + CreateAPIKeyModel, + AccessListUsersSuccessResponse, + ConfluentListMetadata, + UserRecord, + MetadataEntity, + AccessListServiceAccountsSuccessResponse, + ServiceAccountRecord, + AccessListInvitationsSuccessResponse, + InvitationRecord, + AccessInviteUserAccountModel, + AccessInvitedUserDetails, + AccessListEnvironmentsSuccessResponse, + EnvironmentRecord, + AccessListClusterSuccessResponse, + ClusterRecord, + ClusterSpecEntity, + ClusterEnvironmentEntity, + ClusterNetworkEntity, + ClusterByokEntity, + AccessListRoleBindingsSuccessResponse, + RoleBindingRecord, + AccessCreateRoleBindingRequestModel, + AccessRoleBindingNameListSuccessResponse, + ErrorResponse, + ConnectorResource, + ConnectorResourceProperties, + ConnectorInfoBase, + KnownConnectorType, + ConnectorType, + KnownConnectorClass, + ConnectorClass, + KnownConnectorStatus, + ConnectorStatus, + ConnectorServiceTypeInfoBase, + ConnectorServiceTypeInfoBaseUnion, + KnownConnectorServiceType, + ConnectorServiceType, + AzureBlobStorageSinkConnectorServiceInfo, + AzureBlobStorageSourceConnectorServiceInfo, + AzureCosmosDBSinkConnectorServiceInfo, + AzureCosmosDBSourceConnectorServiceInfo, + AzureSynapseAnalyticsSinkConnectorServiceInfo, + PartnerInfoBase, + PartnerInfoBaseUnion, + KnownPartnerConnectorType, + PartnerConnectorType, + KafkaAzureBlobStorageSinkConnectorInfo, + KnownAuthType, + AuthType, + KnownDataFormatType, + DataFormatType, + KafkaAzureBlobStorageSourceConnectorInfo, + KafkaAzureCosmosDBSinkConnectorInfo, + KafkaAzureCosmosDBSourceConnectorInfo, + KafkaAzureSynapseAnalyticsSinkConnectorInfo, + TopicRecord, + TopicProperties, + TopicMetadataEntity, + TopicsRelatedLink, + TopicsInputConfig, + ConfluentAgreementResource, + ConfluentAgreementProperties, + ValidationResponse, + KnownVersions, +} from "./models/index.js"; +export { ConfluentClientOptionalParams } from "./api/index.js"; +export { + AccessListRoleBindingNameListOptionalParams, + AccessCreateRoleBindingOptionalParams, + AccessListRoleBindingsOptionalParams, + AccessListClustersOptionalParams, + AccessListEnvironmentsOptionalParams, + AccessInviteUserOptionalParams, + AccessListInvitationsOptionalParams, + AccessListServiceAccountsOptionalParams, + AccessListUsersOptionalParams, + AccessDeleteRoleBindingOptionalParams, +} from "./api/access/index.js"; +export { + ClusterDeleteOptionalParams, + ClusterCreateOrUpdateOptionalParams, +} from "./api/cluster/index.js"; +export { + ConnectorListOptionalParams, + ConnectorDeleteOptionalParams, + ConnectorCreateOrUpdateOptionalParams, + ConnectorGetOptionalParams, +} from "./api/connector/index.js"; +export { + EnvironmentDeleteOptionalParams, + EnvironmentCreateOrUpdateOptionalParams, +} from "./api/environment/index.js"; +export { + MarketplaceAgreementsCreateOptionalParams, + MarketplaceAgreementsListOptionalParams, +} from "./api/marketplaceAgreements/index.js"; +export { + OrganizationCreateApiKeyOptionalParams, + OrganizationListClustersOptionalParams, + OrganizationGetClusterByIdOptionalParams, + OrganizationGetSchemaRegistryClusterByIdOptionalParams, + OrganizationListSchemaRegistryClustersOptionalParams, + OrganizationListEnvironmentsOptionalParams, + OrganizationGetEnvironmentByIdOptionalParams, + OrganizationListRegionsOptionalParams, + OrganizationListBySubscriptionOptionalParams, + OrganizationListByResourceGroupOptionalParams, + OrganizationDeleteOptionalParams, + OrganizationUpdateOptionalParams, + OrganizationCreateOptionalParams, + OrganizationGetOptionalParams, + OrganizationDeleteClusterAPIKeyOptionalParams, + OrganizationGetClusterAPIKeyOptionalParams, +} from "./api/organization/index.js"; +export { OrganizationOperationsListOptionalParams } from "./api/organizationOperations/index.js"; +export { + TopicsListOptionalParams, + TopicsDeleteOptionalParams, + TopicsCreateOptionalParams, + TopicsGetOptionalParams, +} from "./api/topics/index.js"; +export { + ValidationsValidateOrganizationV2OptionalParams, + ValidationsValidateOrganizationOptionalParams, +} from "./api/validations/index.js"; +export { + AccessOperations, + ClusterOperations, + ConnectorOperations, + EnvironmentOperations, + MarketplaceAgreementsOperations, + OrganizationOperations, + OrganizationOperationsOperations, + TopicsOperations, + ValidationsOperations, +} from "./classic/index.js"; +export { PageSettings, ContinuablePage, PagedAsyncIterableIterator }; diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/logger.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/logger.ts new file mode 100644 index 0000000000..954e29788c --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/logger.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { createClientLogger } from "@azure/logger"; +export const logger = createClientLogger("arm-confluent"); diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/models/index.ts new file mode 100644 index 0000000000..2a1e68aded --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/models/index.ts @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + OperationResult, + OperationDisplay, + ResourceProviderDefaultErrorResponse, + ErrorResponseBody, + APIKeyRecord, + APIKeyProperties, + SCMetadataEntity, + APIKeySpecEntity, + APIKeyResourceEntity, + APIKeyOwnerEntity, + OrganizationResource, + OrganizationResourceProperties, + KnownProvisionState, + ProvisionState, + OfferDetail, + KnownSaaSOfferStatus, + SaaSOfferStatus, + UserDetail, + LinkOrganization, + TrackedResource, + Resource, + SystemData, + KnownCreatedByType, + CreatedByType, + ErrorDetail, + ErrorAdditionalInfo, + OrganizationResourceUpdate, + ListAccessRequestModel, + ListRegionsSuccessResponse, + RegionRecord, + RegionProperties, + RegionSpecEntity, + SCEnvironmentRecord, + EnvironmentProperties, + StreamGovernanceConfig, + KnownPackage, + Package, + ProxyResource, + SchemaRegistryClusterRecord, + SchemaRegistryClusterProperties, + SchemaRegistryClusterSpecEntity, + SchemaRegistryClusterEnvironmentRegionEntity, + SchemaRegistryClusterStatusEntity, + SCClusterRecord, + ClusterProperties, + SCClusterSpecEntity, + ClusterConfigEntity, + SCClusterNetworkEnvironmentEntity, + SCClusterByokEntity, + ClusterStatusEntity, + CreateAPIKeyModel, + AccessListUsersSuccessResponse, + ConfluentListMetadata, + UserRecord, + MetadataEntity, + AccessListServiceAccountsSuccessResponse, + ServiceAccountRecord, + AccessListInvitationsSuccessResponse, + InvitationRecord, + AccessInviteUserAccountModel, + AccessInvitedUserDetails, + AccessListEnvironmentsSuccessResponse, + EnvironmentRecord, + AccessListClusterSuccessResponse, + ClusterRecord, + ClusterSpecEntity, + ClusterEnvironmentEntity, + ClusterNetworkEntity, + ClusterByokEntity, + AccessListRoleBindingsSuccessResponse, + RoleBindingRecord, + AccessCreateRoleBindingRequestModel, + AccessRoleBindingNameListSuccessResponse, + ErrorResponse, + ConnectorResource, + ConnectorResourceProperties, + ConnectorInfoBase, + KnownConnectorType, + ConnectorType, + KnownConnectorClass, + ConnectorClass, + KnownConnectorStatus, + ConnectorStatus, + ConnectorServiceTypeInfoBase, + ConnectorServiceTypeInfoBaseUnion, + KnownConnectorServiceType, + ConnectorServiceType, + AzureBlobStorageSinkConnectorServiceInfo, + AzureBlobStorageSourceConnectorServiceInfo, + AzureCosmosDBSinkConnectorServiceInfo, + AzureCosmosDBSourceConnectorServiceInfo, + AzureSynapseAnalyticsSinkConnectorServiceInfo, + PartnerInfoBase, + PartnerInfoBaseUnion, + KnownPartnerConnectorType, + PartnerConnectorType, + KafkaAzureBlobStorageSinkConnectorInfo, + KnownAuthType, + AuthType, + KnownDataFormatType, + DataFormatType, + KafkaAzureBlobStorageSourceConnectorInfo, + KafkaAzureCosmosDBSinkConnectorInfo, + KafkaAzureCosmosDBSourceConnectorInfo, + KafkaAzureSynapseAnalyticsSinkConnectorInfo, + TopicRecord, + TopicProperties, + TopicMetadataEntity, + TopicsRelatedLink, + TopicsInputConfig, + ConfluentAgreementResource, + ConfluentAgreementProperties, + ValidationResponse, + KnownVersions, +} from "./models.js"; diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/models/models.ts new file mode 100644 index 0000000000..2fa76c3f29 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/models/models.ts @@ -0,0 +1,3406 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** Result of GET request to list Confluent operations. */ +export interface _OperationListResult { + /** List of Confluent operations supported by the Microsoft.Confluent provider. */ + value: OperationResult[]; + /** URL to get the next set of operation list results if there are any. */ + nextLink?: string; +} + +export function _operationListResultDeserializer( + item: any, +): _OperationListResult { + return { + value: operationResultArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function operationResultArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return operationResultDeserializer(item); + }); +} + +/** An Confluent REST API operation. */ +export interface OperationResult { + /** Operation name: {provider}/{resource}/{operation} */ + name?: string; + /** The object that represents the operation. */ + display?: OperationDisplay; + /** Indicates whether the operation is a data action */ + isDataAction?: boolean; +} + +export function operationResultDeserializer(item: any): OperationResult { + return { + name: item["name"], + display: !item["display"] + ? item["display"] + : operationDisplayDeserializer(item["display"]), + isDataAction: item["isDataAction"], + }; +} + +/** The object that represents the operation. */ +export interface OperationDisplay { + /** Service provider: Microsoft.Confluent */ + provider?: string; + /** Type on which the operation is performed, e.g., 'clusters'. */ + resource?: string; + /** Operation type, e.g., read, write, delete, etc. */ + operation?: string; + /** Description of the operation, e.g., 'Write confluent'. */ + description?: string; +} + +export function operationDisplayDeserializer(item: any): OperationDisplay { + return { + provider: item["provider"], + resource: item["resource"], + operation: item["operation"], + description: item["description"], + }; +} + +/** Default error response for resource provider */ +export interface ResourceProviderDefaultErrorResponse { + /** Response body of Error */ + readonly error?: ErrorResponseBody; +} + +export function resourceProviderDefaultErrorResponseDeserializer( + item: any, +): ResourceProviderDefaultErrorResponse { + return { + error: !item["error"] + ? item["error"] + : errorResponseBodyDeserializer(item["error"]), + }; +} + +/** Response body of Error */ +export interface ErrorResponseBody { + /** Error code */ + readonly code?: string; + /** Error message */ + readonly message?: string; + /** Error target */ + readonly target?: string; + /** Error detail */ + readonly details?: ErrorResponseBody[]; +} + +export function errorResponseBodyDeserializer(item: any): ErrorResponseBody { + return { + code: item["code"], + message: item["message"], + target: item["target"], + details: !item["details"] + ? item["details"] + : errorResponseBodyArrayDeserializer(item["details"]), + }; +} + +export function errorResponseBodyArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return errorResponseBodyDeserializer(item); + }); +} + +/** Details API key */ +export interface APIKeyRecord { + /** Type of api key */ + kind?: string; + /** Id of the api key */ + id?: string; + /** API Key Properties */ + properties?: APIKeyProperties; +} + +export function apiKeyRecordDeserializer(item: any): APIKeyRecord { + return { + kind: item["kind"], + id: item["id"], + properties: !item["properties"] + ? item["properties"] + : apiKeyPropertiesDeserializer(item["properties"]), + }; +} + +/** API Key Properties */ +export interface APIKeyProperties { + /** Metadata of the record */ + metadata?: SCMetadataEntity; + /** Specification of the API Key */ + spec?: APIKeySpecEntity; +} + +export function apiKeyPropertiesDeserializer(item: any): APIKeyProperties { + return { + metadata: !item["metadata"] + ? item["metadata"] + : scMetadataEntityDeserializer(item["metadata"]), + spec: !item["spec"] + ? item["spec"] + : apiKeySpecEntityDeserializer(item["spec"]), + }; +} + +/** Metadata of the data record */ +export interface SCMetadataEntity { + /** Self lookup url */ + self?: string; + /** Resource name of the record */ + resourceName?: string; + /** Created Date Time */ + createdTimestamp?: string; + /** Updated Date time */ + updatedTimestamp?: string; + /** Deleted Date time */ + deletedTimestamp?: string; +} + +export function scMetadataEntitySerializer(item: SCMetadataEntity): any { + return { + self: item["self"], + resourceName: item["resourceName"], + createdTimestamp: item["createdTimestamp"], + updatedTimestamp: item["updatedTimestamp"], + deletedTimestamp: item["deletedTimestamp"], + }; +} + +export function scMetadataEntityDeserializer(item: any): SCMetadataEntity { + return { + self: item["self"], + resourceName: item["resourceName"], + createdTimestamp: item["createdTimestamp"], + updatedTimestamp: item["updatedTimestamp"], + deletedTimestamp: item["deletedTimestamp"], + }; +} + +/** Spec of the API Key record */ +export interface APIKeySpecEntity { + /** The description of the API Key */ + description?: string; + /** The name of the API Key */ + name?: string; + /** API Key Secret */ + secret?: string; + /** Specification of the cluster */ + resource?: APIKeyResourceEntity; + /** Specification of the cluster */ + owner?: APIKeyOwnerEntity; +} + +export function apiKeySpecEntityDeserializer(item: any): APIKeySpecEntity { + return { + description: item["description"], + name: item["name"], + secret: item["secret"], + resource: !item["resource"] + ? item["resource"] + : apiKeyResourceEntityDeserializer(item["resource"]), + owner: !item["owner"] + ? item["owner"] + : apiKeyOwnerEntityDeserializer(item["owner"]), + }; +} + +/** API Key Resource details which can be kafka cluster or schema registry cluster */ +export interface APIKeyResourceEntity { + /** Id of the resource */ + id?: string; + /** The environment of the api key */ + environment?: string; + /** API URL for accessing or modifying the api key resource object */ + related?: string; + /** CRN reference to the referred resource */ + resourceName?: string; + /** Type of the owner which can be service or user account */ + kind?: string; +} + +export function apiKeyResourceEntityDeserializer( + item: any, +): APIKeyResourceEntity { + return { + id: item["id"], + environment: item["environment"], + related: item["related"], + resourceName: item["resourceName"], + kind: item["kind"], + }; +} + +/** API Key Owner details which can be a user or service account */ +export interface APIKeyOwnerEntity { + /** API Key owner id */ + id?: string; + /** API URL for accessing or modifying the referred object */ + related?: string; + /** CRN reference to the referred resource */ + resourceName?: string; + /** Type of the owner service or user account */ + kind?: string; +} + +export function apiKeyOwnerEntityDeserializer(item: any): APIKeyOwnerEntity { + return { + id: item["id"], + related: item["related"], + resourceName: item["resourceName"], + kind: item["kind"], + }; +} + +/** Organization resource. */ +export interface OrganizationResource extends TrackedResource { + /** Organization resource properties */ + properties: OrganizationResourceProperties; +} + +export function organizationResourceSerializer( + item: OrganizationResource, +): any { + return { + tags: item["tags"], + location: item["location"], + properties: organizationResourcePropertiesSerializer(item["properties"]), + }; +} + +export function organizationResourceDeserializer( + item: any, +): OrganizationResource { + return { + tags: item["tags"], + location: item["location"], + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: organizationResourcePropertiesDeserializer(item["properties"]), + }; +} + +/** Organization resource property */ +export interface OrganizationResourceProperties { + /** The creation time of the resource. */ + readonly createdTime?: Date; + /** Provision states for confluent RP */ + readonly provisioningState?: ProvisionState; + /** Id of the Confluent organization. */ + readonly organizationId?: string; + /** SSO url for the Confluent organization. */ + readonly ssoUrl?: string; + /** Confluent offer detail */ + offerDetail: OfferDetail; + /** Subscriber detail */ + userDetail: UserDetail; + /** Link an existing Confluent organization */ + linkOrganization?: LinkOrganization; +} + +export function organizationResourcePropertiesSerializer( + item: OrganizationResourceProperties, +): any { + return { + offerDetail: offerDetailSerializer(item["offerDetail"]), + userDetail: userDetailSerializer(item["userDetail"]), + linkOrganization: !item["linkOrganization"] + ? item["linkOrganization"] + : linkOrganizationSerializer(item["linkOrganization"]), + }; +} + +export function organizationResourcePropertiesDeserializer( + item: any, +): OrganizationResourceProperties { + return { + createdTime: !item["createdTime"] + ? item["createdTime"] + : new Date(item["createdTime"]), + provisioningState: item["provisioningState"], + organizationId: item["organizationId"], + ssoUrl: item["ssoUrl"], + offerDetail: offerDetailDeserializer(item["offerDetail"]), + userDetail: userDetailDeserializer(item["userDetail"]), + linkOrganization: !item["linkOrganization"] + ? item["linkOrganization"] + : linkOrganizationDeserializer(item["linkOrganization"]), + }; +} + +/** Provision states for confluent RP */ +export enum KnownProvisionState { + Accepted = "Accepted", + Creating = "Creating", + Updating = "Updating", + Deleting = "Deleting", + Succeeded = "Succeeded", + Failed = "Failed", + Canceled = "Canceled", + Deleted = "Deleted", + NotSpecified = "NotSpecified", +} + +/** + * Provision states for confluent RP \ + * {@link KnownProvisionState} can be used interchangeably with ProvisionState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Accepted** \ + * **Creating** \ + * **Updating** \ + * **Deleting** \ + * **Succeeded** \ + * **Failed** \ + * **Canceled** \ + * **Deleted** \ + * **NotSpecified** + */ +export type ProvisionState = string; + +/** Confluent Offer detail */ +export interface OfferDetail { + /** Publisher Id */ + publisherId: string; + /** Offer Id */ + id: string; + /** Offer Plan Id */ + planId: string; + /** Offer Plan Name */ + planName: string; + /** Offer Plan Term unit */ + termUnit: string; + /** Offer Plan Term Id */ + termId?: string; + /** Private Offer Id */ + privateOfferId?: string; + /** Array of Private Offer Ids */ + privateOfferIds?: string[]; + /** SaaS Offer Status */ + status?: SaaSOfferStatus; +} + +export function offerDetailSerializer(item: OfferDetail): any { + return { + publisherId: item["publisherId"], + id: item["id"], + planId: item["planId"], + planName: item["planName"], + termUnit: item["termUnit"], + termId: item["termId"], + privateOfferId: item["privateOfferId"], + privateOfferIds: !item["privateOfferIds"] + ? item["privateOfferIds"] + : item["privateOfferIds"].map((p: any) => { + return p; + }), + status: item["status"], + }; +} + +export function offerDetailDeserializer(item: any): OfferDetail { + return { + publisherId: item["publisherId"], + id: item["id"], + planId: item["planId"], + planName: item["planName"], + termUnit: item["termUnit"], + termId: item["termId"], + privateOfferId: item["privateOfferId"], + privateOfferIds: !item["privateOfferIds"] + ? item["privateOfferIds"] + : item["privateOfferIds"].map((p: any) => { + return p; + }), + status: item["status"], + }; +} + +/** SaaS Offer Status for confluent RP */ +export enum KnownSaaSOfferStatus { + Started = "Started", + PendingFulfillmentStart = "PendingFulfillmentStart", + InProgress = "InProgress", + Subscribed = "Subscribed", + Suspended = "Suspended", + Reinstated = "Reinstated", + Succeeded = "Succeeded", + Failed = "Failed", + Unsubscribed = "Unsubscribed", + Updating = "Updating", +} + +/** + * SaaS Offer Status for confluent RP \ + * {@link KnownSaaSOfferStatus} can be used interchangeably with SaaSOfferStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Started** \ + * **PendingFulfillmentStart** \ + * **InProgress** \ + * **Subscribed** \ + * **Suspended** \ + * **Reinstated** \ + * **Succeeded** \ + * **Failed** \ + * **Unsubscribed** \ + * **Updating** + */ +export type SaaSOfferStatus = string; + +/** Subscriber detail */ +export interface UserDetail { + /** First name */ + firstName?: string; + /** Last name */ + lastName?: string; + /** Email address */ + emailAddress: string; + /** User principal name */ + userPrincipalName?: string; + /** AAD email address */ + aadEmail?: string; +} + +export function userDetailSerializer(item: UserDetail): any { + return { + firstName: item["firstName"], + lastName: item["lastName"], + emailAddress: item["emailAddress"], + userPrincipalName: item["userPrincipalName"], + aadEmail: item["aadEmail"], + }; +} + +export function userDetailDeserializer(item: any): UserDetail { + return { + firstName: item["firstName"], + lastName: item["lastName"], + emailAddress: item["emailAddress"], + userPrincipalName: item["userPrincipalName"], + aadEmail: item["aadEmail"], + }; +} + +/** Link an existing Confluent organization */ +export interface LinkOrganization { + /** User auth token */ + token: string; +} + +export function linkOrganizationSerializer(item: LinkOrganization): any { + return { token: item["token"] }; +} + +export function linkOrganizationDeserializer(item: any): LinkOrganization { + return { + token: item["token"], + }; +} + +/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ +export interface TrackedResource extends Resource { + /** Resource tags. */ + tags?: Record; + /** The geo-location where the resource lives */ + location: string; +} + +export function trackedResourceSerializer(item: TrackedResource): any { + return { tags: item["tags"], location: item["location"] }; +} + +export function trackedResourceDeserializer(item: any): TrackedResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + tags: item["tags"], + location: item["location"], + }; +} + +/** Common fields that are returned in the response for all Azure Resource Manager resources */ +export interface Resource { + /** Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} */ + readonly id?: string; + /** The name of the resource */ + readonly name?: string; + /** The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" */ + readonly type?: string; + /** Azure Resource Manager metadata containing createdBy and modifiedBy information. */ + readonly systemData?: SystemData; +} + +export function resourceSerializer(item: Resource): any { + return item; +} + +export function resourceDeserializer(item: any): Resource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + }; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + lastModifiedAt?: Date; +} + +export function systemDataDeserializer(item: any): SystemData { + return { + createdBy: item["createdBy"], + createdByType: item["createdByType"], + createdAt: !item["createdAt"] + ? item["createdAt"] + : new Date(item["createdAt"]), + lastModifiedBy: item["lastModifiedBy"], + lastModifiedByType: item["lastModifiedByType"], + lastModifiedAt: !item["lastModifiedAt"] + ? item["lastModifiedAt"] + : new Date(item["lastModifiedAt"]), + }; +} + +/** The kind of entity that created the resource. */ +export enum KnownCreatedByType { + /** The entity was created by a user. */ + User = "User", + /** The entity was created by an application. */ + Application = "Application", + /** The entity was created by a managed identity. */ + ManagedIdentity = "ManagedIdentity", + /** The entity was created by a key. */ + Key = "Key", +} + +/** + * The kind of entity that created the resource. \ + * {@link KnowncreatedByType} can be used interchangeably with createdByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User**: The entity was created by a user. \ + * **Application**: The entity was created by an application. \ + * **ManagedIdentity**: The entity was created by a managed identity. \ + * **Key**: The entity was created by a key. + */ +export type CreatedByType = string; + +/** The error detail. */ +export interface ErrorDetail { + /** The error code. */ + readonly code?: string; + /** The error message. */ + readonly message?: string; + /** The error target. */ + readonly target?: string; + /** The error details. */ + readonly details?: ErrorDetail[]; + /** The error additional info. */ + readonly additionalInfo?: ErrorAdditionalInfo[]; +} + +export function errorDetailDeserializer(item: any): ErrorDetail { + return { + code: item["code"], + message: item["message"], + target: item["target"], + details: !item["details"] + ? item["details"] + : errorDetailArrayDeserializer(item["details"]), + additionalInfo: !item["additionalInfo"] + ? item["additionalInfo"] + : errorAdditionalInfoArrayDeserializer(item["additionalInfo"]), + }; +} + +export function errorDetailArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return errorDetailDeserializer(item); + }); +} + +export function errorAdditionalInfoArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return errorAdditionalInfoDeserializer(item); + }); +} + +/** The resource management error additional info. */ +export interface ErrorAdditionalInfo { + /** The additional info type. */ + readonly type?: string; + /** The additional info. */ + readonly info?: any; +} + +export function errorAdditionalInfoDeserializer( + item: any, +): ErrorAdditionalInfo { + return { + type: item["type"], + info: item["info"], + }; +} + +/** Organization Resource update */ +export interface OrganizationResourceUpdate { + /** ARM resource tags */ + tags?: Record; +} + +export function organizationResourceUpdateSerializer( + item: OrganizationResourceUpdate, +): any { + return { tags: item["tags"] }; +} + +/** The response of a OrganizationResource list operation. */ +export interface _OrganizationResourceListResult { + /** The OrganizationResource items on this page */ + value: OrganizationResource[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _organizationResourceListResultDeserializer( + item: any, +): _OrganizationResourceListResult { + return { + value: organizationResourceArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function organizationResourceArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return organizationResourceSerializer(item); + }); +} + +export function organizationResourceArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return organizationResourceDeserializer(item); + }); +} + +/** List Access Request Model */ +export interface ListAccessRequestModel { + /** Search filters for the request */ + searchFilters?: Record; +} + +export function listAccessRequestModelSerializer( + item: ListAccessRequestModel, +): any { + return { searchFilters: item["searchFilters"] }; +} + +/** Result of POST request to list regions supported by confluent */ +export interface ListRegionsSuccessResponse { + /** List of regions supported by confluent */ + data?: RegionRecord[]; +} + +export function listRegionsSuccessResponseDeserializer( + item: any, +): ListRegionsSuccessResponse { + return { + data: !item["data"] + ? item["data"] + : regionRecordArrayDeserializer(item["data"]), + }; +} + +export function regionRecordArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return regionRecordDeserializer(item); + }); +} + +/** Details of region record */ +export interface RegionRecord { + /** Kind of the cluster */ + kind?: string; + /** Id of the cluster */ + id?: string; + /** Region Properties */ + properties?: RegionProperties; +} + +export function regionRecordDeserializer(item: any): RegionRecord { + return { + kind: item["kind"], + id: item["id"], + properties: !item["properties"] + ? item["properties"] + : regionPropertiesDeserializer(item["properties"]), + }; +} + +/** Region Properties */ +export interface RegionProperties { + /** Metadata of the record */ + metadata?: SCMetadataEntity; + /** Specification of the region */ + spec?: RegionSpecEntity; +} + +export function regionPropertiesDeserializer(item: any): RegionProperties { + return { + metadata: !item["metadata"] + ? item["metadata"] + : scMetadataEntityDeserializer(item["metadata"]), + spec: !item["spec"] + ? item["spec"] + : regionSpecEntityDeserializer(item["spec"]), + }; +} + +/** Region spec details */ +export interface RegionSpecEntity { + /** Display Name of the region */ + name?: string; + /** Cloud provider name */ + cloud?: string; + /** Region name */ + regionName?: string; + packages?: string[]; +} + +export function regionSpecEntityDeserializer(item: any): RegionSpecEntity { + return { + name: item["name"], + cloud: item["cloud"], + regionName: item["regionName"], + packages: !item["packages"] + ? item["packages"] + : item["packages"].map((p: any) => { + return p; + }), + }; +} + +/** Details about environment name, metadata and environment id of an environment */ +export interface SCEnvironmentRecord extends ProxyResource { + /** Type of environment */ + kind?: string; + /** Environment properties */ + properties?: EnvironmentProperties; +} + +export function scEnvironmentRecordSerializer(item: SCEnvironmentRecord): any { + return { + kind: item["kind"], + properties: !item["properties"] + ? item["properties"] + : environmentPropertiesSerializer(item["properties"]), + }; +} + +export function scEnvironmentRecordDeserializer( + item: any, +): SCEnvironmentRecord { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + kind: item["kind"], + properties: !item["properties"] + ? item["properties"] + : environmentPropertiesDeserializer(item["properties"]), + }; +} + +/** Environment resource property */ +export interface EnvironmentProperties { + /** Stream governance configuration */ + streamGovernanceConfig?: StreamGovernanceConfig; + /** Metadata of the record */ + metadata?: SCMetadataEntity; +} + +export function environmentPropertiesSerializer( + item: EnvironmentProperties, +): any { + return { + streamGovernanceConfig: !item["streamGovernanceConfig"] + ? item["streamGovernanceConfig"] + : streamGovernanceConfigSerializer(item["streamGovernanceConfig"]), + metadata: !item["metadata"] + ? item["metadata"] + : scMetadataEntitySerializer(item["metadata"]), + }; +} + +export function environmentPropertiesDeserializer( + item: any, +): EnvironmentProperties { + return { + streamGovernanceConfig: !item["streamGovernanceConfig"] + ? item["streamGovernanceConfig"] + : streamGovernanceConfigDeserializer(item["streamGovernanceConfig"]), + metadata: !item["metadata"] + ? item["metadata"] + : scMetadataEntityDeserializer(item["metadata"]), + }; +} + +/** Stream governance configuration */ +export interface StreamGovernanceConfig { + /** Stream governance configuration */ + package?: Package; +} + +export function streamGovernanceConfigSerializer( + item: StreamGovernanceConfig, +): any { + return { package: item["package"] }; +} + +export function streamGovernanceConfigDeserializer( + item: any, +): StreamGovernanceConfig { + return { + package: item["package"], + }; +} + +/** Stream Governance Package. Supported values are ESSENTIALS and ADVANCED */ +export enum KnownPackage { + Essentials = "ESSENTIALS", + Advanced = "ADVANCED", +} + +/** + * Stream Governance Package. Supported values are ESSENTIALS and ADVANCED \ + * {@link KnownPackage} can be used interchangeably with Package, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **ESSENTIALS** \ + * **ADVANCED** + */ +export type Package = string; + +/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ +export interface ProxyResource extends Resource {} + +export function proxyResourceSerializer(item: ProxyResource): any { + return item; +} + +export function proxyResourceDeserializer(item: any): ProxyResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + }; +} + +/** Result of GET request to list Confluent operations. */ +export interface _GetEnvironmentsResponse { + /** The SCEnvironmentRecord items on this page */ + value: SCEnvironmentRecord[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _getEnvironmentsResponseDeserializer( + item: any, +): _GetEnvironmentsResponse { + return { + value: scEnvironmentRecordArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function scEnvironmentRecordArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return scEnvironmentRecordSerializer(item); + }); +} + +export function scEnvironmentRecordArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return scEnvironmentRecordDeserializer(item); + }); +} + +/** Result of GET request to list schema registry clusters in the environment of a confluent organization */ +export interface _ListSchemaRegistryClustersResponse { + /** The SchemaRegistryClusterRecord items on this page */ + value: SchemaRegistryClusterRecord[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _listSchemaRegistryClustersResponseDeserializer( + item: any, +): _ListSchemaRegistryClustersResponse { + return { + value: schemaRegistryClusterRecordArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function schemaRegistryClusterRecordArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return schemaRegistryClusterRecordDeserializer(item); + }); +} + +/** Details of schema registry cluster record */ +export interface SchemaRegistryClusterRecord { + /** Kind of the cluster */ + kind?: string; + /** Id of the cluster */ + id?: string; + /** Schema Registry Cluster Properties */ + properties?: SchemaRegistryClusterProperties; +} + +export function schemaRegistryClusterRecordDeserializer( + item: any, +): SchemaRegistryClusterRecord { + return { + kind: item["kind"], + id: item["id"], + properties: !item["properties"] + ? item["properties"] + : schemaRegistryClusterPropertiesDeserializer(item["properties"]), + }; +} + +/** Schema Registry Cluster Properties */ +export interface SchemaRegistryClusterProperties { + /** Metadata of the record */ + metadata?: SCMetadataEntity; + /** Specification of the schema registry cluster */ + spec?: SchemaRegistryClusterSpecEntity; + /** Specification of the cluster status */ + status?: SchemaRegistryClusterStatusEntity; +} + +export function schemaRegistryClusterPropertiesDeserializer( + item: any, +): SchemaRegistryClusterProperties { + return { + metadata: !item["metadata"] + ? item["metadata"] + : scMetadataEntityDeserializer(item["metadata"]), + spec: !item["spec"] + ? item["spec"] + : schemaRegistryClusterSpecEntityDeserializer(item["spec"]), + status: !item["status"] + ? item["status"] + : schemaRegistryClusterStatusEntityDeserializer(item["status"]), + }; +} + +/** Details of schema registry cluster spec */ +export interface SchemaRegistryClusterSpecEntity { + /** Name of the schema registry cluster */ + name?: string; + /** Http endpoint of the cluster */ + httpEndpoint?: string; + /** Type of the cluster package Advanced, essentials */ + package?: string; + /** Region details of the schema registry cluster */ + region?: SchemaRegistryClusterEnvironmentRegionEntity; + /** Environment details of the schema registry cluster */ + environment?: SchemaRegistryClusterEnvironmentRegionEntity; + /** The cloud service provider */ + cloud?: string; +} + +export function schemaRegistryClusterSpecEntityDeserializer( + item: any, +): SchemaRegistryClusterSpecEntity { + return { + name: item["name"], + httpEndpoint: item["httpEndpoint"], + package: item["package"], + region: !item["region"] + ? item["region"] + : schemaRegistryClusterEnvironmentRegionEntityDeserializer( + item["region"], + ), + environment: !item["environment"] + ? item["environment"] + : schemaRegistryClusterEnvironmentRegionEntityDeserializer( + item["environment"], + ), + cloud: item["cloud"], + }; +} + +/** The environment associated with this object */ +export interface SchemaRegistryClusterEnvironmentRegionEntity { + /** ID of the referred resource */ + id?: string; + /** API URL for accessing or modifying the referred object */ + related?: string; + /** CRN reference to the referred resource */ + resourceName?: string; +} + +export function schemaRegistryClusterEnvironmentRegionEntityDeserializer( + item: any, +): SchemaRegistryClusterEnvironmentRegionEntity { + return { + id: item["id"], + related: item["related"], + resourceName: item["resourceName"], + }; +} + +/** Status of the schema registry cluster record */ +export interface SchemaRegistryClusterStatusEntity { + /** The lifecycle phase of the cluster */ + phase?: string; +} + +export function schemaRegistryClusterStatusEntityDeserializer( + item: any, +): SchemaRegistryClusterStatusEntity { + return { + phase: item["phase"], + }; +} + +/** Details of cluster record */ +export interface SCClusterRecord extends ProxyResource { + /** Type of cluster */ + kind?: string; + /** Cluster Properties */ + properties?: ClusterProperties; +} + +export function scClusterRecordSerializer(item: SCClusterRecord): any { + return { + kind: item["kind"], + properties: !item["properties"] + ? item["properties"] + : clusterPropertiesSerializer(item["properties"]), + }; +} + +export function scClusterRecordDeserializer(item: any): SCClusterRecord { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + kind: item["kind"], + properties: !item["properties"] + ? item["properties"] + : clusterPropertiesDeserializer(item["properties"]), + }; +} + +/** Service Connector Cluster Properties */ +export interface ClusterProperties { + /** Metadata of the record */ + metadata?: SCMetadataEntity; + /** Specification of the cluster */ + spec?: SCClusterSpecEntity; + /** Specification of the cluster status */ + status?: ClusterStatusEntity; +} + +export function clusterPropertiesSerializer(item: ClusterProperties): any { + return { + metadata: !item["metadata"] + ? item["metadata"] + : scMetadataEntitySerializer(item["metadata"]), + spec: !item["spec"] + ? item["spec"] + : scClusterSpecEntitySerializer(item["spec"]), + status: !item["status"] + ? item["status"] + : clusterStatusEntitySerializer(item["status"]), + }; +} + +export function clusterPropertiesDeserializer(item: any): ClusterProperties { + return { + metadata: !item["metadata"] + ? item["metadata"] + : scMetadataEntityDeserializer(item["metadata"]), + spec: !item["spec"] + ? item["spec"] + : scClusterSpecEntityDeserializer(item["spec"]), + status: !item["status"] + ? item["status"] + : clusterStatusEntityDeserializer(item["status"]), + }; +} + +/** Spec of the cluster record */ +export interface SCClusterSpecEntity { + /** The name of the cluster */ + name?: string; + /** The availability zone configuration of the cluster */ + availability?: string; + /** The cloud service provider */ + cloud?: string; + /** type of zone availability */ + zone?: string; + /** Stream governance configuration */ + package?: Package; + /** The cloud service provider region */ + region?: string; + /** The bootstrap endpoint used by Kafka clients to connect to the cluster */ + kafkaBootstrapEndpoint?: string; + /** The cluster HTTP request URL. */ + httpEndpoint?: string; + /** The Kafka API cluster endpoint */ + apiEndpoint?: string; + /** Specification of the cluster configuration */ + config?: ClusterConfigEntity; + /** Specification of the cluster environment */ + environment?: SCClusterNetworkEnvironmentEntity; + /** Specification of the cluster network */ + network?: SCClusterNetworkEnvironmentEntity; + /** Specification of the cluster byok */ + byok?: SCClusterByokEntity; +} + +export function scClusterSpecEntitySerializer(item: SCClusterSpecEntity): any { + return { + name: item["name"], + availability: item["availability"], + cloud: item["cloud"], + zone: item["zone"], + package: item["package"], + region: item["region"], + kafkaBootstrapEndpoint: item["kafkaBootstrapEndpoint"], + httpEndpoint: item["httpEndpoint"], + apiEndpoint: item["apiEndpoint"], + config: !item["config"] + ? item["config"] + : clusterConfigEntitySerializer(item["config"]), + environment: !item["environment"] + ? item["environment"] + : scClusterNetworkEnvironmentEntitySerializer(item["environment"]), + network: !item["network"] + ? item["network"] + : scClusterNetworkEnvironmentEntitySerializer(item["network"]), + byok: !item["byok"] + ? item["byok"] + : scClusterByokEntitySerializer(item["byok"]), + }; +} + +export function scClusterSpecEntityDeserializer( + item: any, +): SCClusterSpecEntity { + return { + name: item["name"], + availability: item["availability"], + cloud: item["cloud"], + zone: item["zone"], + package: item["package"], + region: item["region"], + kafkaBootstrapEndpoint: item["kafkaBootstrapEndpoint"], + httpEndpoint: item["httpEndpoint"], + apiEndpoint: item["apiEndpoint"], + config: !item["config"] + ? item["config"] + : clusterConfigEntityDeserializer(item["config"]), + environment: !item["environment"] + ? item["environment"] + : scClusterNetworkEnvironmentEntityDeserializer(item["environment"]), + network: !item["network"] + ? item["network"] + : scClusterNetworkEnvironmentEntityDeserializer(item["network"]), + byok: !item["byok"] + ? item["byok"] + : scClusterByokEntityDeserializer(item["byok"]), + }; +} + +/** The configuration of the Kafka cluster */ +export interface ClusterConfigEntity { + /** The lifecycle phase of the cluster */ + kind?: string; +} + +export function clusterConfigEntitySerializer(item: ClusterConfigEntity): any { + return { kind: item["kind"] }; +} + +export function clusterConfigEntityDeserializer( + item: any, +): ClusterConfigEntity { + return { + kind: item["kind"], + }; +} + +/** The environment or the network to which cluster belongs */ +export interface SCClusterNetworkEnvironmentEntity { + /** ID of the referred resource */ + id?: string; + /** Environment of the referred resource */ + environment?: string; + /** API URL for accessing or modifying the referred object */ + related?: string; + /** CRN reference to the referred resource */ + resourceName?: string; +} + +export function scClusterNetworkEnvironmentEntitySerializer( + item: SCClusterNetworkEnvironmentEntity, +): any { + return { + id: item["id"], + environment: item["environment"], + related: item["related"], + resourceName: item["resourceName"], + }; +} + +export function scClusterNetworkEnvironmentEntityDeserializer( + item: any, +): SCClusterNetworkEnvironmentEntity { + return { + id: item["id"], + environment: item["environment"], + related: item["related"], + resourceName: item["resourceName"], + }; +} + +/** The network associated with this object */ +export interface SCClusterByokEntity { + /** ID of the referred resource */ + id?: string; + /** API URL for accessing or modifying the referred object */ + related?: string; + /** CRN reference to the referred resource */ + resourceName?: string; +} + +export function scClusterByokEntitySerializer(item: SCClusterByokEntity): any { + return { + id: item["id"], + related: item["related"], + resourceName: item["resourceName"], + }; +} + +export function scClusterByokEntityDeserializer( + item: any, +): SCClusterByokEntity { + return { + id: item["id"], + related: item["related"], + resourceName: item["resourceName"], + }; +} + +/** Status of the cluster record */ +export interface ClusterStatusEntity { + /** The lifecycle phase of the cluster */ + phase?: string; + /** The number of Confluent Kafka Units */ + cku?: number; +} + +export function clusterStatusEntitySerializer(item: ClusterStatusEntity): any { + return { phase: item["phase"], cku: item["cku"] }; +} + +export function clusterStatusEntityDeserializer( + item: any, +): ClusterStatusEntity { + return { + phase: item["phase"], + cku: item["cku"], + }; +} + +/** Result of GET request to list clusters in the environment of a confluent organization */ +export interface _ListClustersSuccessResponse { + /** The SCClusterRecord items on this page */ + value: SCClusterRecord[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _listClustersSuccessResponseDeserializer( + item: any, +): _ListClustersSuccessResponse { + return { + value: scClusterRecordArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function scClusterRecordArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return scClusterRecordSerializer(item); + }); +} + +export function scClusterRecordArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return scClusterRecordDeserializer(item); + }); +} + +/** Create API Key model */ +export interface CreateAPIKeyModel { + /** Name of the API Key */ + name?: string; + /** Description of the API Key */ + description?: string; +} + +export function createAPIKeyModelSerializer(item: CreateAPIKeyModel): any { + return { name: item["name"], description: item["description"] }; +} + +/** List users success response */ +export interface AccessListUsersSuccessResponse { + /** Type of response */ + kind?: string; + /** Metadata of the list */ + metadata?: ConfluentListMetadata; + /** Data of the users list */ + data?: UserRecord[]; +} + +export function accessListUsersSuccessResponseDeserializer( + item: any, +): AccessListUsersSuccessResponse { + return { + kind: item["kind"], + metadata: !item["metadata"] + ? item["metadata"] + : confluentListMetadataDeserializer(item["metadata"]), + data: !item["data"] + ? item["data"] + : userRecordArrayDeserializer(item["data"]), + }; +} + +/** Metadata of the list */ +export interface ConfluentListMetadata { + /** First page of the list */ + first?: string; + /** Last page of the list */ + last?: string; + /** Previous page of the list */ + prev?: string; + /** Next page of the list */ + next?: string; + /** Total size of the list */ + totalSize?: number; +} + +export function confluentListMetadataDeserializer( + item: any, +): ConfluentListMetadata { + return { + first: item["first"], + last: item["last"], + prev: item["prev"], + next: item["next"], + totalSize: item["total_size"], + }; +} + +export function userRecordArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return userRecordDeserializer(item); + }); +} + +/** Record of the user */ +export interface UserRecord { + /** Type of account */ + kind?: string; + /** Id of the user */ + id?: string; + /** Metadata of the record */ + metadata?: MetadataEntity; + /** Email of the user */ + email?: string; + /** Name of the user */ + fullName?: string; + /** Auth type of the user */ + authType?: string; +} + +export function userRecordDeserializer(item: any): UserRecord { + return { + kind: item["kind"], + id: item["id"], + metadata: !item["metadata"] + ? item["metadata"] + : metadataEntityDeserializer(item["metadata"]), + email: item["email"], + fullName: item["full_name"], + authType: item["auth_type"], + }; +} + +/** Metadata of the data record */ +export interface MetadataEntity { + /** Self lookup url */ + self?: string; + /** Resource name of the record */ + resourceName?: string; + /** Created Date Time */ + createdAt?: string; + /** Updated Date time */ + updatedAt?: string; + /** Deleted Date time */ + deletedAt?: string; +} + +export function metadataEntityDeserializer(item: any): MetadataEntity { + return { + self: item["self"], + resourceName: item["resource_name"], + createdAt: item["created_at"], + updatedAt: item["updated_at"], + deletedAt: item["deleted_at"], + }; +} + +/** List service accounts success response */ +export interface AccessListServiceAccountsSuccessResponse { + /** Type of response */ + kind?: string; + /** Metadata of the list */ + metadata?: ConfluentListMetadata; + /** Data of the service accounts list */ + data?: ServiceAccountRecord[]; +} + +export function accessListServiceAccountsSuccessResponseDeserializer( + item: any, +): AccessListServiceAccountsSuccessResponse { + return { + kind: item["kind"], + metadata: !item["metadata"] + ? item["metadata"] + : confluentListMetadataDeserializer(item["metadata"]), + data: !item["data"] + ? item["data"] + : serviceAccountRecordArrayDeserializer(item["data"]), + }; +} + +export function serviceAccountRecordArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return serviceAccountRecordDeserializer(item); + }); +} + +/** Record of the service account */ +export interface ServiceAccountRecord { + /** Type of account */ + kind?: string; + /** Id of the service account */ + id?: string; + /** Metadata of the record */ + metadata?: MetadataEntity; + /** Name of the service account */ + displayName?: string; + /** Description of the service account */ + description?: string; +} + +export function serviceAccountRecordDeserializer( + item: any, +): ServiceAccountRecord { + return { + kind: item["kind"], + id: item["id"], + metadata: !item["metadata"] + ? item["metadata"] + : metadataEntityDeserializer(item["metadata"]), + displayName: item["display_name"], + description: item["description"], + }; +} + +/** List invitations success response */ +export interface AccessListInvitationsSuccessResponse { + /** Type of response */ + kind?: string; + /** Metadata of the list */ + metadata?: ConfluentListMetadata; + /** Data of the invitations list */ + data?: InvitationRecord[]; +} + +export function accessListInvitationsSuccessResponseDeserializer( + item: any, +): AccessListInvitationsSuccessResponse { + return { + kind: item["kind"], + metadata: !item["metadata"] + ? item["metadata"] + : confluentListMetadataDeserializer(item["metadata"]), + data: !item["data"] + ? item["data"] + : invitationRecordArrayDeserializer(item["data"]), + }; +} + +export function invitationRecordArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return invitationRecordDeserializer(item); + }); +} + +/** Record of the invitation */ +export interface InvitationRecord { + /** Type of account */ + kind?: string; + /** Id of the invitation */ + id?: string; + /** Metadata of the record */ + metadata?: MetadataEntity; + /** Email of the user */ + email?: string; + /** Auth type of the user */ + authType?: string; + /** Status of the invitation */ + status?: string; + /** Accepted date time of the invitation */ + acceptedAt?: string; + /** Expiration date time of the invitation */ + expiresAt?: string; +} + +export function invitationRecordDeserializer(item: any): InvitationRecord { + return { + kind: item["kind"], + id: item["id"], + metadata: !item["metadata"] + ? item["metadata"] + : metadataEntityDeserializer(item["metadata"]), + email: item["email"], + authType: item["auth_type"], + status: item["status"], + acceptedAt: item["accepted_at"], + expiresAt: item["expires_at"], + }; +} + +/** Invite User Account model */ +export interface AccessInviteUserAccountModel { + /** Id of the organization */ + organizationId?: string; + /** Email of the logged in user */ + email?: string; + /** Upn of the logged in user */ + upn?: string; + /** Details of the user who is being invited */ + invitedUserDetails?: AccessInvitedUserDetails; +} + +export function accessInviteUserAccountModelSerializer( + item: AccessInviteUserAccountModel, +): any { + return { + organizationId: item["organizationId"], + email: item["email"], + upn: item["upn"], + invitedUserDetails: !item["invitedUserDetails"] + ? item["invitedUserDetails"] + : accessInvitedUserDetailsSerializer(item["invitedUserDetails"]), + }; +} + +/** Details of the user being invited */ +export interface AccessInvitedUserDetails { + /** UPN/Email of the user who is being invited */ + invitedEmail?: string; + /** Auth type of the user */ + authType?: string; +} + +export function accessInvitedUserDetailsSerializer( + item: AccessInvitedUserDetails, +): any { + return { invitedEmail: item["invitedEmail"], auth_type: item["authType"] }; +} + +/** Details of the environments returned on successful response */ +export interface AccessListEnvironmentsSuccessResponse { + /** Type of response */ + kind?: string; + /** Metadata of the environment list */ + metadata?: ConfluentListMetadata; + /** Environment list data */ + data?: EnvironmentRecord[]; +} + +export function accessListEnvironmentsSuccessResponseDeserializer( + item: any, +): AccessListEnvironmentsSuccessResponse { + return { + kind: item["kind"], + metadata: !item["metadata"] + ? item["metadata"] + : confluentListMetadataDeserializer(item["metadata"]), + data: !item["data"] + ? item["data"] + : environmentRecordArrayDeserializer(item["data"]), + }; +} + +export function environmentRecordArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return environmentRecordDeserializer(item); + }); +} + +/** Details about environment name, metadata and environment id of an environment */ +export interface EnvironmentRecord { + /** Type of environment */ + kind?: string; + /** Id of the environment */ + id?: string; + /** Metadata of the record */ + metadata?: MetadataEntity; + /** Display name of the user */ + displayName?: string; +} + +export function environmentRecordDeserializer(item: any): EnvironmentRecord { + return { + kind: item["kind"], + id: item["id"], + metadata: !item["metadata"] + ? item["metadata"] + : metadataEntityDeserializer(item["metadata"]), + displayName: item["display_name"], + }; +} + +/** Details of the clusters returned on successful response */ +export interface AccessListClusterSuccessResponse { + /** Type of response */ + kind?: string; + /** Metadata of the list */ + metadata?: ConfluentListMetadata; + /** List of clusters */ + data?: ClusterRecord[]; +} + +export function accessListClusterSuccessResponseDeserializer( + item: any, +): AccessListClusterSuccessResponse { + return { + kind: item["kind"], + metadata: !item["metadata"] + ? item["metadata"] + : confluentListMetadataDeserializer(item["metadata"]), + data: !item["data"] + ? item["data"] + : clusterRecordArrayDeserializer(item["data"]), + }; +} + +export function clusterRecordArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return clusterRecordDeserializer(item); + }); +} + +/** Details of cluster record */ +export interface ClusterRecord { + /** Type of cluster */ + kind?: string; + /** Id of the cluster */ + id?: string; + /** Metadata of the record */ + metadata?: MetadataEntity; + /** Display name of the cluster */ + displayName?: string; + /** Specification of the cluster */ + spec?: ClusterSpecEntity; + /** Specification of the cluster */ + status?: ClusterStatusEntity; +} + +export function clusterRecordDeserializer(item: any): ClusterRecord { + return { + kind: item["kind"], + id: item["id"], + metadata: !item["metadata"] + ? item["metadata"] + : metadataEntityDeserializer(item["metadata"]), + displayName: item["display_name"], + spec: !item["spec"] + ? item["spec"] + : clusterSpecEntityDeserializer(item["spec"]), + status: !item["status"] + ? item["status"] + : clusterStatusEntityDeserializer(item["status"]), + }; +} + +/** Spec of the cluster record */ +export interface ClusterSpecEntity { + /** The name of the cluster */ + displayName?: string; + /** The availability zone configuration of the cluster */ + availability?: string; + /** The cloud service provider */ + cloud?: string; + /** type of zone availability */ + zone?: string; + /** The cloud service provider region */ + region?: string; + /** The bootstrap endpoint used by Kafka clients to connect to the cluster */ + kafkaBootstrapEndpoint?: string; + /** The cluster HTTP request URL. */ + httpEndpoint?: string; + /** The Kafka API cluster endpoint */ + apiEndpoint?: string; + /** Specification of the cluster */ + config?: ClusterConfigEntity; + /** Specification of the cluster */ + environment?: ClusterEnvironmentEntity; + /** Specification of the cluster */ + network?: ClusterNetworkEntity; + /** Specification of the cluster */ + byok?: ClusterByokEntity; +} + +export function clusterSpecEntityDeserializer(item: any): ClusterSpecEntity { + return { + displayName: item["display_name"], + availability: item["availability"], + cloud: item["cloud"], + zone: item["zone"], + region: item["region"], + kafkaBootstrapEndpoint: item["kafka_bootstrap_endpoint"], + httpEndpoint: item["http_endpoint"], + apiEndpoint: item["api_endpoint"], + config: !item["config"] + ? item["config"] + : clusterConfigEntityDeserializer(item["config"]), + environment: !item["environment"] + ? item["environment"] + : clusterEnvironmentEntityDeserializer(item["environment"]), + network: !item["network"] + ? item["network"] + : clusterNetworkEntityDeserializer(item["network"]), + byok: !item["byok"] + ? item["byok"] + : clusterByokEntityDeserializer(item["byok"]), + }; +} + +/** The environment to which cluster belongs */ +export interface ClusterEnvironmentEntity { + /** ID of the referred resource */ + id?: string; + /** Environment of the referred resource */ + environment?: string; + /** API URL for accessing or modifying the referred object */ + related?: string; + /** CRN reference to the referred resource */ + resourceName?: string; +} + +export function clusterEnvironmentEntityDeserializer( + item: any, +): ClusterEnvironmentEntity { + return { + id: item["id"], + environment: item["environment"], + related: item["related"], + resourceName: item["resource_name"], + }; +} + +/** The network associated with this object */ +export interface ClusterNetworkEntity { + /** ID of the referred resource */ + id?: string; + /** Environment of the referred resource */ + environment?: string; + /** API URL for accessing or modifying the referred object */ + related?: string; + /** CRN reference to the referred resource */ + resourceName?: string; +} + +export function clusterNetworkEntityDeserializer( + item: any, +): ClusterNetworkEntity { + return { + id: item["id"], + environment: item["environment"], + related: item["related"], + resourceName: item["resource_name"], + }; +} + +/** The network associated with this object */ +export interface ClusterByokEntity { + /** ID of the referred resource */ + id?: string; + /** API URL for accessing or modifying the referred object */ + related?: string; + /** CRN reference to the referred resource */ + resourceName?: string; +} + +export function clusterByokEntityDeserializer(item: any): ClusterByokEntity { + return { + id: item["id"], + related: item["related"], + resourceName: item["resource_name"], + }; +} + +/** Details of the role bindings returned on successful response */ +export interface AccessListRoleBindingsSuccessResponse { + /** Type of response */ + kind?: string; + /** Metadata of the list */ + metadata?: ConfluentListMetadata; + /** List of role binding */ + data?: RoleBindingRecord[]; +} + +export function accessListRoleBindingsSuccessResponseDeserializer( + item: any, +): AccessListRoleBindingsSuccessResponse { + return { + kind: item["kind"], + metadata: !item["metadata"] + ? item["metadata"] + : confluentListMetadataDeserializer(item["metadata"]), + data: !item["data"] + ? item["data"] + : roleBindingRecordArrayDeserializer(item["data"]), + }; +} + +export function roleBindingRecordArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return roleBindingRecordDeserializer(item); + }); +} + +/** Details on principal, role name and crn pattern of a role binding */ +export interface RoleBindingRecord { + /** The type of the resource. */ + kind?: string; + /** Id of the role binding */ + id?: string; + /** Metadata of the record */ + metadata?: MetadataEntity; + /** The principal User or Group to bind the role to */ + principal?: string; + /** The name of the role to bind to the principal */ + roleName?: string; + /** A CRN that specifies the scope and resource patterns necessary for the role to bind */ + crnPattern?: string; +} + +export function roleBindingRecordDeserializer(item: any): RoleBindingRecord { + return { + kind: item["kind"], + id: item["id"], + metadata: !item["metadata"] + ? item["metadata"] + : metadataEntityDeserializer(item["metadata"]), + principal: item["principal"], + roleName: item["role_name"], + crnPattern: item["crn_pattern"], + }; +} + +/** Create role binding request model */ +export interface AccessCreateRoleBindingRequestModel { + /** The principal User or Group to bind the role to */ + principal?: string; + /** The name of the role to bind to the principal */ + roleName?: string; + /** A CRN that specifies the scope and resource patterns necessary for the role to bind */ + crnPattern?: string; +} + +export function accessCreateRoleBindingRequestModelSerializer( + item: AccessCreateRoleBindingRequestModel, +): any { + return { + principal: item["principal"], + role_name: item["roleName"], + crn_pattern: item["crnPattern"], + }; +} + +/** Details of the role binding names returned on successful response */ +export interface AccessRoleBindingNameListSuccessResponse { + /** Type of response */ + kind?: string; + /** Metadata of the list */ + metadata?: ConfluentListMetadata; + /** List of role binding names */ + data?: string[]; +} + +export function accessRoleBindingNameListSuccessResponseDeserializer( + item: any, +): AccessRoleBindingNameListSuccessResponse { + return { + kind: item["kind"], + metadata: !item["metadata"] + ? item["metadata"] + : confluentListMetadataDeserializer(item["metadata"]), + data: !item["data"] + ? item["data"] + : item["data"].map((p: any) => { + return p; + }), + }; +} + +/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. */ +export interface ErrorResponse { + /** The error object. */ + error?: ErrorDetail; +} + +export function errorResponseDeserializer(item: any): ErrorResponse { + return { + error: !item["error"] + ? item["error"] + : errorDetailDeserializer(item["error"]), + }; +} + +/** Details of connector record */ +export interface ConnectorResource extends ProxyResource { + /** The properties of the Connector */ + properties: ConnectorResourceProperties; +} + +export function connectorResourceSerializer(item: ConnectorResource): any { + return { + properties: connectorResourcePropertiesSerializer(item["properties"]), + }; +} + +export function connectorResourceDeserializer(item: any): ConnectorResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: connectorResourcePropertiesDeserializer(item["properties"]), + }; +} + +/** The resource properties of the Connector */ +export interface ConnectorResourceProperties { + /** Connector Info Base */ + connectorBasicInfo?: ConnectorInfoBase; + /** Connector Service type info base properties. */ + connectorServiceTypeInfo?: ConnectorServiceTypeInfoBaseUnion; + /** The connection information consumed by applications. */ + partnerConnectorInfo?: PartnerInfoBaseUnion; +} + +export function connectorResourcePropertiesSerializer( + item: ConnectorResourceProperties, +): any { + return { + connectorBasicInfo: !item["connectorBasicInfo"] + ? item["connectorBasicInfo"] + : connectorInfoBaseSerializer(item["connectorBasicInfo"]), + connectorServiceTypeInfo: !item["connectorServiceTypeInfo"] + ? item["connectorServiceTypeInfo"] + : connectorServiceTypeInfoBaseUnionSerializer( + item["connectorServiceTypeInfo"], + ), + partnerConnectorInfo: !item["partnerConnectorInfo"] + ? item["partnerConnectorInfo"] + : partnerInfoBaseUnionSerializer(item["partnerConnectorInfo"]), + }; +} + +export function connectorResourcePropertiesDeserializer( + item: any, +): ConnectorResourceProperties { + return { + connectorBasicInfo: !item["connectorBasicInfo"] + ? item["connectorBasicInfo"] + : connectorInfoBaseDeserializer(item["connectorBasicInfo"]), + connectorServiceTypeInfo: !item["connectorServiceTypeInfo"] + ? item["connectorServiceTypeInfo"] + : connectorServiceTypeInfoBaseUnionDeserializer( + item["connectorServiceTypeInfo"], + ), + partnerConnectorInfo: !item["partnerConnectorInfo"] + ? item["partnerConnectorInfo"] + : partnerInfoBaseUnionDeserializer(item["partnerConnectorInfo"]), + }; +} + +/** Connector Info Base properties */ +export interface ConnectorInfoBase { + /** Connector Type */ + connectorType?: ConnectorType; + /** Connector Class */ + connectorClass?: ConnectorClass; + /** Connector Name */ + connectorName?: string; + /** Connector Id */ + connectorId?: string; + /** Connector Status */ + connectorState?: ConnectorStatus; +} + +export function connectorInfoBaseSerializer(item: ConnectorInfoBase): any { + return { + connectorType: item["connectorType"], + connectorClass: item["connectorClass"], + connectorName: item["connectorName"], + connectorId: item["connectorId"], + connectorState: item["connectorState"], + }; +} + +export function connectorInfoBaseDeserializer(item: any): ConnectorInfoBase { + return { + connectorType: item["connectorType"], + connectorClass: item["connectorClass"], + connectorName: item["connectorName"], + connectorId: item["connectorId"], + connectorState: item["connectorState"], + }; +} + +/** Connector Type */ +export enum KnownConnectorType { + Sink = "SINK", + Source = "SOURCE", +} + +/** + * Connector Type \ + * {@link KnownConnectorType} can be used interchangeably with ConnectorType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **SINK** \ + * **SOURCE** + */ +export type ConnectorType = string; + +/** Connector Class */ +export enum KnownConnectorClass { + Azureblobsource = "AZUREBLOBSOURCE", + Azureblobsink = "AZUREBLOBSINK", +} + +/** + * Connector Class \ + * {@link KnownConnectorClass} can be used interchangeably with ConnectorClass, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **AZUREBLOBSOURCE** \ + * **AZUREBLOBSINK** + */ +export type ConnectorClass = string; + +/** Connector Status */ +export enum KnownConnectorStatus { + Provisioning = "PROVISIONING", + Running = "RUNNING", + Paused = "PAUSED", + Failed = "FAILED", +} + +/** + * Connector Status \ + * {@link KnownConnectorStatus} can be used interchangeably with ConnectorStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **PROVISIONING** \ + * **RUNNING** \ + * **PAUSED** \ + * **FAILED** + */ +export type ConnectorStatus = string; + +/** The connector service type info */ +export interface ConnectorServiceTypeInfoBase { + /** The connector service type. */ + /** The discriminator possible values: AzureBlobStorageSinkConnector, AzureBlobStorageSourceConnector, AzureCosmosDBSinkConnector, AzureCosmosDBSourceConnector, AzureSynapseAnalyticsSinkConnector */ + connectorServiceType: ConnectorServiceType; +} + +export function connectorServiceTypeInfoBaseSerializer( + item: ConnectorServiceTypeInfoBase, +): any { + return { connectorServiceType: item["connectorServiceType"] }; +} + +export function connectorServiceTypeInfoBaseDeserializer( + item: any, +): ConnectorServiceTypeInfoBase { + return { + connectorServiceType: item["connectorServiceType"], + }; +} + +/** Alias for ConnectorServiceTypeInfoBaseUnion */ +export type ConnectorServiceTypeInfoBaseUnion = + | AzureBlobStorageSinkConnectorServiceInfo + | AzureBlobStorageSourceConnectorServiceInfo + | AzureCosmosDBSinkConnectorServiceInfo + | AzureCosmosDBSourceConnectorServiceInfo + | AzureSynapseAnalyticsSinkConnectorServiceInfo + | ConnectorServiceTypeInfoBase; + +export function connectorServiceTypeInfoBaseUnionSerializer( + item: ConnectorServiceTypeInfoBaseUnion, +): any { + switch (item.connectorServiceType) { + case "AzureBlobStorageSinkConnector": + return azureBlobStorageSinkConnectorServiceInfoSerializer( + item as AzureBlobStorageSinkConnectorServiceInfo, + ); + + case "AzureBlobStorageSourceConnector": + return azureBlobStorageSourceConnectorServiceInfoSerializer( + item as AzureBlobStorageSourceConnectorServiceInfo, + ); + + case "AzureCosmosDBSinkConnector": + return azureCosmosDBSinkConnectorServiceInfoSerializer( + item as AzureCosmosDBSinkConnectorServiceInfo, + ); + + case "AzureCosmosDBSourceConnector": + return azureCosmosDBSourceConnectorServiceInfoSerializer( + item as AzureCosmosDBSourceConnectorServiceInfo, + ); + + case "AzureSynapseAnalyticsSinkConnector": + return azureSynapseAnalyticsSinkConnectorServiceInfoSerializer( + item as AzureSynapseAnalyticsSinkConnectorServiceInfo, + ); + + default: + return connectorServiceTypeInfoBaseSerializer(item); + } +} + +export function connectorServiceTypeInfoBaseUnionDeserializer( + item: any, +): ConnectorServiceTypeInfoBaseUnion { + switch (item.connectorServiceType) { + case "AzureBlobStorageSinkConnector": + return azureBlobStorageSinkConnectorServiceInfoDeserializer( + item as AzureBlobStorageSinkConnectorServiceInfo, + ); + + case "AzureBlobStorageSourceConnector": + return azureBlobStorageSourceConnectorServiceInfoDeserializer( + item as AzureBlobStorageSourceConnectorServiceInfo, + ); + + case "AzureCosmosDBSinkConnector": + return azureCosmosDBSinkConnectorServiceInfoDeserializer( + item as AzureCosmosDBSinkConnectorServiceInfo, + ); + + case "AzureCosmosDBSourceConnector": + return azureCosmosDBSourceConnectorServiceInfoDeserializer( + item as AzureCosmosDBSourceConnectorServiceInfo, + ); + + case "AzureSynapseAnalyticsSinkConnector": + return azureSynapseAnalyticsSinkConnectorServiceInfoDeserializer( + item as AzureSynapseAnalyticsSinkConnectorServiceInfo, + ); + + default: + return connectorServiceTypeInfoBaseDeserializer(item); + } +} + +/** The connector service type. */ +export enum KnownConnectorServiceType { + AzureBlobStorageSinkConnector = "AzureBlobStorageSinkConnector", + AzureBlobStorageSourceConnector = "AzureBlobStorageSourceConnector", + AzureCosmosDBSinkConnector = "AzureCosmosDBSinkConnector", + AzureCosmosDBSourceConnector = "AzureCosmosDBSourceConnector", + AzureSynapseAnalyticsSinkConnector = "AzureSynapseAnalyticsSinkConnector", +} + +/** + * The connector service type. \ + * {@link KnownConnectorServiceType} can be used interchangeably with ConnectorServiceType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **AzureBlobStorageSinkConnector** \ + * **AzureBlobStorageSourceConnector** \ + * **AzureCosmosDBSinkConnector** \ + * **AzureCosmosDBSourceConnector** \ + * **AzureSynapseAnalyticsSinkConnector** + */ +export type ConnectorServiceType = string; + +/** The authentication info when auth_type is azureBlobStorageSinkConnector */ +export interface AzureBlobStorageSinkConnectorServiceInfo + extends ConnectorServiceTypeInfoBase { + /** Azure Blob Storage Account Name */ + storageAccountName?: string; + /** Azure Blob Storage Account Key */ + storageAccountKey?: string; + /** Azure Blob Storage Account Container Name */ + storageContainerName?: string; + /** The connector service type. */ + connectorServiceType: "AzureBlobStorageSinkConnector"; +} + +export function azureBlobStorageSinkConnectorServiceInfoSerializer( + item: AzureBlobStorageSinkConnectorServiceInfo, +): any { + return { + connectorServiceType: item["connectorServiceType"], + storageAccountName: item["storageAccountName"], + storageAccountKey: item["storageAccountKey"], + storageContainerName: item["storageContainerName"], + }; +} + +export function azureBlobStorageSinkConnectorServiceInfoDeserializer( + item: any, +): AzureBlobStorageSinkConnectorServiceInfo { + return { + connectorServiceType: item["connectorServiceType"], + storageAccountName: item["storageAccountName"], + storageAccountKey: item["storageAccountKey"], + storageContainerName: item["storageContainerName"], + }; +} + +/** The connector service type is AzureBlobStorageSourceConnector */ +export interface AzureBlobStorageSourceConnectorServiceInfo + extends ConnectorServiceTypeInfoBase { + /** Azure Blob Storage Account Name */ + storageAccountName?: string; + /** Azure Blob Storage Account Key */ + storageAccountKey?: string; + /** Azure Blob Storage Account Container Name */ + storageContainerName?: string; + /** The connector service type. */ + connectorServiceType: "AzureBlobStorageSourceConnector"; +} + +export function azureBlobStorageSourceConnectorServiceInfoSerializer( + item: AzureBlobStorageSourceConnectorServiceInfo, +): any { + return { + connectorServiceType: item["connectorServiceType"], + storageAccountName: item["storageAccountName"], + storageAccountKey: item["storageAccountKey"], + storageContainerName: item["storageContainerName"], + }; +} + +export function azureBlobStorageSourceConnectorServiceInfoDeserializer( + item: any, +): AzureBlobStorageSourceConnectorServiceInfo { + return { + connectorServiceType: item["connectorServiceType"], + storageAccountName: item["storageAccountName"], + storageAccountKey: item["storageAccountKey"], + storageContainerName: item["storageContainerName"], + }; +} + +/** The authentication info when auth_type is AzureCosmosDBSinkConnector */ +export interface AzureCosmosDBSinkConnectorServiceInfo + extends ConnectorServiceTypeInfoBase { + /** Azure Cosmos Database Name */ + cosmosDatabaseName?: string; + /** Azure Cosmos Database Master Key */ + cosmosMasterKey?: string; + /** Azure Cosmos Database Connection Endpoint */ + cosmosConnectionEndpoint?: string; + /** Azure Cosmos Database Containers Topic Mapping */ + cosmosContainersTopicMapping?: string; + /** Azure Cosmos Database Id Strategy */ + cosmosIdStrategy?: string; + /** The connector service type. */ + connectorServiceType: "AzureCosmosDBSinkConnector"; +} + +export function azureCosmosDBSinkConnectorServiceInfoSerializer( + item: AzureCosmosDBSinkConnectorServiceInfo, +): any { + return { + connectorServiceType: item["connectorServiceType"], + cosmosDatabaseName: item["cosmosDatabaseName"], + cosmosMasterKey: item["cosmosMasterKey"], + cosmosConnectionEndpoint: item["cosmosConnectionEndpoint"], + cosmosContainersTopicMapping: item["cosmosContainersTopicMapping"], + cosmosIdStrategy: item["cosmosIdStrategy"], + }; +} + +export function azureCosmosDBSinkConnectorServiceInfoDeserializer( + item: any, +): AzureCosmosDBSinkConnectorServiceInfo { + return { + connectorServiceType: item["connectorServiceType"], + cosmosDatabaseName: item["cosmosDatabaseName"], + cosmosMasterKey: item["cosmosMasterKey"], + cosmosConnectionEndpoint: item["cosmosConnectionEndpoint"], + cosmosContainersTopicMapping: item["cosmosContainersTopicMapping"], + cosmosIdStrategy: item["cosmosIdStrategy"], + }; +} + +/** The authentication info when auth_type is AzureCosmosDBSourceConnector */ +export interface AzureCosmosDBSourceConnectorServiceInfo + extends ConnectorServiceTypeInfoBase { + /** Azure Cosmos Database Name */ + cosmosDatabaseName?: string; + /** Azure Cosmos Database Master Key */ + cosmosMasterKey?: string; + /** Azure Cosmos Database Connection Endpoint */ + cosmosConnectionEndpoint?: string; + /** Azure Cosmos Database Containers Topic Mapping */ + cosmosContainersTopicMapping?: string; + /** Azure Cosmos Database Message Key Enabled */ + cosmosMessageKeyEnabled?: boolean; + /** Azure Cosmos Database Message Key Field */ + cosmosMessageKeyField?: string; + /** The connector service type. */ + connectorServiceType: "AzureCosmosDBSourceConnector"; +} + +export function azureCosmosDBSourceConnectorServiceInfoSerializer( + item: AzureCosmosDBSourceConnectorServiceInfo, +): any { + return { + connectorServiceType: item["connectorServiceType"], + cosmosDatabaseName: item["cosmosDatabaseName"], + cosmosMasterKey: item["cosmosMasterKey"], + cosmosConnectionEndpoint: item["cosmosConnectionEndpoint"], + cosmosContainersTopicMapping: item["cosmosContainersTopicMapping"], + cosmosMessageKeyEnabled: item["cosmosMessageKeyEnabled"], + cosmosMessageKeyField: item["cosmosMessageKeyField"], + }; +} + +export function azureCosmosDBSourceConnectorServiceInfoDeserializer( + item: any, +): AzureCosmosDBSourceConnectorServiceInfo { + return { + connectorServiceType: item["connectorServiceType"], + cosmosDatabaseName: item["cosmosDatabaseName"], + cosmosMasterKey: item["cosmosMasterKey"], + cosmosConnectionEndpoint: item["cosmosConnectionEndpoint"], + cosmosContainersTopicMapping: item["cosmosContainersTopicMapping"], + cosmosMessageKeyEnabled: item["cosmosMessageKeyEnabled"], + cosmosMessageKeyField: item["cosmosMessageKeyField"], + }; +} + +/** The authentication info when auth_type is AzureSynapseAnalyticsSinkConnector */ +export interface AzureSynapseAnalyticsSinkConnectorServiceInfo + extends ConnectorServiceTypeInfoBase { + /** Azure Synapse Analytics SQL Server Name */ + synapseSqlServerName?: string; + /** Azure Synapse SQL login details */ + synapseSqlUser?: string; + /** Azure Synapse SQL login details */ + synapseSqlPassword?: string; + /** Azure Synapse Dedicated SQL Pool Database Name */ + synapseSqlDatabaseName?: string; + /** The connector service type. */ + connectorServiceType: "AzureSynapseAnalyticsSinkConnector"; +} + +export function azureSynapseAnalyticsSinkConnectorServiceInfoSerializer( + item: AzureSynapseAnalyticsSinkConnectorServiceInfo, +): any { + return { + connectorServiceType: item["connectorServiceType"], + synapseSqlServerName: item["synapseSqlServerName"], + synapseSqlUser: item["synapseSqlUser"], + synapseSqlPassword: item["synapseSqlPassword"], + synapseSqlDatabaseName: item["synapseSqlDatabaseName"], + }; +} + +export function azureSynapseAnalyticsSinkConnectorServiceInfoDeserializer( + item: any, +): AzureSynapseAnalyticsSinkConnectorServiceInfo { + return { + connectorServiceType: item["connectorServiceType"], + synapseSqlServerName: item["synapseSqlServerName"], + synapseSqlUser: item["synapseSqlUser"], + synapseSqlPassword: item["synapseSqlPassword"], + synapseSqlDatabaseName: item["synapseSqlDatabaseName"], + }; +} + +/** The partner info base */ +export interface PartnerInfoBase { + /** The partner connector type. */ + /** The discriminator possible values: KafkaAzureBlobStorageSink, KafkaAzureBlobStorageSource, KafkaAzureCosmosDBSink, KafkaAzureCosmosDBSource, KafkaAzureSynapseAnalyticsSink */ + partnerConnectorType: PartnerConnectorType; +} + +export function partnerInfoBaseSerializer(item: PartnerInfoBase): any { + return { partnerConnectorType: item["partnerConnectorType"] }; +} + +export function partnerInfoBaseDeserializer(item: any): PartnerInfoBase { + return { + partnerConnectorType: item["partnerConnectorType"], + }; +} + +/** Alias for PartnerInfoBaseUnion */ +export type PartnerInfoBaseUnion = + | KafkaAzureBlobStorageSinkConnectorInfo + | KafkaAzureBlobStorageSourceConnectorInfo + | KafkaAzureCosmosDBSinkConnectorInfo + | KafkaAzureCosmosDBSourceConnectorInfo + | KafkaAzureSynapseAnalyticsSinkConnectorInfo + | PartnerInfoBase; + +export function partnerInfoBaseUnionSerializer( + item: PartnerInfoBaseUnion, +): any { + switch (item.partnerConnectorType) { + case "KafkaAzureBlobStorageSink": + return kafkaAzureBlobStorageSinkConnectorInfoSerializer( + item as KafkaAzureBlobStorageSinkConnectorInfo, + ); + + case "KafkaAzureBlobStorageSource": + return kafkaAzureBlobStorageSourceConnectorInfoSerializer( + item as KafkaAzureBlobStorageSourceConnectorInfo, + ); + + case "KafkaAzureCosmosDBSink": + return kafkaAzureCosmosDBSinkConnectorInfoSerializer( + item as KafkaAzureCosmosDBSinkConnectorInfo, + ); + + case "KafkaAzureCosmosDBSource": + return kafkaAzureCosmosDBSourceConnectorInfoSerializer( + item as KafkaAzureCosmosDBSourceConnectorInfo, + ); + + case "KafkaAzureSynapseAnalyticsSink": + return kafkaAzureSynapseAnalyticsSinkConnectorInfoSerializer( + item as KafkaAzureSynapseAnalyticsSinkConnectorInfo, + ); + + default: + return partnerInfoBaseSerializer(item); + } +} + +export function partnerInfoBaseUnionDeserializer( + item: any, +): PartnerInfoBaseUnion { + switch (item.partnerConnectorType) { + case "KafkaAzureBlobStorageSink": + return kafkaAzureBlobStorageSinkConnectorInfoDeserializer( + item as KafkaAzureBlobStorageSinkConnectorInfo, + ); + + case "KafkaAzureBlobStorageSource": + return kafkaAzureBlobStorageSourceConnectorInfoDeserializer( + item as KafkaAzureBlobStorageSourceConnectorInfo, + ); + + case "KafkaAzureCosmosDBSink": + return kafkaAzureCosmosDBSinkConnectorInfoDeserializer( + item as KafkaAzureCosmosDBSinkConnectorInfo, + ); + + case "KafkaAzureCosmosDBSource": + return kafkaAzureCosmosDBSourceConnectorInfoDeserializer( + item as KafkaAzureCosmosDBSourceConnectorInfo, + ); + + case "KafkaAzureSynapseAnalyticsSink": + return kafkaAzureSynapseAnalyticsSinkConnectorInfoDeserializer( + item as KafkaAzureSynapseAnalyticsSinkConnectorInfo, + ); + + default: + return partnerInfoBaseDeserializer(item); + } +} + +/** Partner Connector type. */ +export enum KnownPartnerConnectorType { + KafkaAzureBlobStorageSource = "KafkaAzureBlobStorageSource", + KafkaAzureBlobStorageSink = "KafkaAzureBlobStorageSink", + KafkaAzureCosmosDBSource = "KafkaAzureCosmosDBSource", + KafkaAzureCosmosDBSink = "KafkaAzureCosmosDBSink", + KafkaAzureSynapseAnalyticsSink = "KafkaAzureSynapseAnalyticsSink", +} + +/** + * Partner Connector type. \ + * {@link KnownPartnerConnectorType} can be used interchangeably with PartnerConnectorType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **KafkaAzureBlobStorageSource** \ + * **KafkaAzureBlobStorageSink** \ + * **KafkaAzureCosmosDBSource** \ + * **KafkaAzureCosmosDBSink** \ + * **KafkaAzureSynapseAnalyticsSink** + */ +export type PartnerConnectorType = string; + +/** The partner connector type is KafkaAzureBlobStorageSink */ +export interface KafkaAzureBlobStorageSinkConnectorInfo + extends PartnerInfoBase { + /** Kafka Auth Type */ + authType?: AuthType; + /** Kafka Input Data Format Type */ + inputFormat?: DataFormatType; + /** Kafka Output Data Format Type */ + outputFormat?: DataFormatType; + /** Kafka API Key */ + apiKey?: string; + /** Kafka API Key Secret */ + apiSecret?: string; + /** Kafka Service Account Id */ + serviceAccountId?: string; + /** Kafka topics list */ + topics?: string[]; + /** Kafka topics directory */ + topicsDir?: string; + /** Flush size */ + flushSize?: string; + /** Maximum Tasks */ + maxTasks?: string; + /** Time Interval */ + timeInterval?: string; + /** The partner connector type. */ + partnerConnectorType: "KafkaAzureBlobStorageSink"; +} + +export function kafkaAzureBlobStorageSinkConnectorInfoSerializer( + item: KafkaAzureBlobStorageSinkConnectorInfo, +): any { + return { + partnerConnectorType: item["partnerConnectorType"], + authType: item["authType"], + inputFormat: item["inputFormat"], + outputFormat: item["outputFormat"], + apiKey: item["apiKey"], + apiSecret: item["apiSecret"], + serviceAccountId: item["serviceAccountId"], + topics: !item["topics"] + ? item["topics"] + : item["topics"].map((p: any) => { + return p; + }), + topicsDir: item["topicsDir"], + flushSize: item["flushSize"], + maxTasks: item["maxTasks"], + timeInterval: item["timeInterval"], + }; +} + +export function kafkaAzureBlobStorageSinkConnectorInfoDeserializer( + item: any, +): KafkaAzureBlobStorageSinkConnectorInfo { + return { + partnerConnectorType: item["partnerConnectorType"], + authType: item["authType"], + inputFormat: item["inputFormat"], + outputFormat: item["outputFormat"], + apiKey: item["apiKey"], + apiSecret: item["apiSecret"], + serviceAccountId: item["serviceAccountId"], + topics: !item["topics"] + ? item["topics"] + : item["topics"].map((p: any) => { + return p; + }), + topicsDir: item["topicsDir"], + flushSize: item["flushSize"], + maxTasks: item["maxTasks"], + timeInterval: item["timeInterval"], + }; +} + +/** Kafka Connector Auth Type */ +export enum KnownAuthType { + ServiceAccount = "SERVICE_ACCOUNT", + KafkaAPIKEY = "KAFKA_API_KEY", +} + +/** + * Kafka Connector Auth Type \ + * {@link KnownAuthType} can be used interchangeably with AuthType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **SERVICE_ACCOUNT** \ + * **KAFKA_API_KEY** + */ +export type AuthType = string; + +/** Data Format Type */ +export enum KnownDataFormatType { + Avro = "AVRO", + Json = "JSON", + String = "STRING", + Bytes = "BYTES", + Protobuf = "PROTOBUF", +} + +/** + * Data Format Type \ + * {@link KnownDataFormatType} can be used interchangeably with DataFormatType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **AVRO** \ + * **JSON** \ + * **STRING** \ + * **BYTES** \ + * **PROTOBUF** + */ +export type DataFormatType = string; + +/** The partner connector type is KafkaAzureBlobStorageSource */ +export interface KafkaAzureBlobStorageSourceConnectorInfo + extends PartnerInfoBase { + /** Kafka Auth Type */ + authType?: AuthType; + /** Kafka Input Data Format Type */ + inputFormat?: DataFormatType; + /** Kafka Output Data Format Type */ + outputFormat?: DataFormatType; + /** Kafka API Key */ + apiKey?: string; + /** Kafka API Secret */ + apiSecret?: string; + /** Kafka Service Account Id */ + serviceAccountId?: string; + /** Kafka topics Regex pattern */ + topicRegex?: string; + /** Kafka topics directory */ + topicsDir?: string; + /** Maximum Tasks */ + maxTasks?: string; + /** The partner connector type. */ + partnerConnectorType: "KafkaAzureBlobStorageSource"; +} + +export function kafkaAzureBlobStorageSourceConnectorInfoSerializer( + item: KafkaAzureBlobStorageSourceConnectorInfo, +): any { + return { + partnerConnectorType: item["partnerConnectorType"], + authType: item["authType"], + inputFormat: item["inputFormat"], + outputFormat: item["outputFormat"], + apiKey: item["apiKey"], + apiSecret: item["apiSecret"], + serviceAccountId: item["serviceAccountId"], + topicRegex: item["topicRegex"], + topicsDir: item["topicsDir"], + maxTasks: item["maxTasks"], + }; +} + +export function kafkaAzureBlobStorageSourceConnectorInfoDeserializer( + item: any, +): KafkaAzureBlobStorageSourceConnectorInfo { + return { + partnerConnectorType: item["partnerConnectorType"], + authType: item["authType"], + inputFormat: item["inputFormat"], + outputFormat: item["outputFormat"], + apiKey: item["apiKey"], + apiSecret: item["apiSecret"], + serviceAccountId: item["serviceAccountId"], + topicRegex: item["topicRegex"], + topicsDir: item["topicsDir"], + maxTasks: item["maxTasks"], + }; +} + +/** The partner connector type is KafkaAzureCosmosDBSink */ +export interface KafkaAzureCosmosDBSinkConnectorInfo extends PartnerInfoBase { + /** Kafka Auth Type */ + authType?: AuthType; + /** Kafka Input Data Format Type */ + inputFormat?: DataFormatType; + /** Kafka Output Data Format Type */ + outputFormat?: DataFormatType; + /** Kafka API Key */ + apiKey?: string; + /** Kafka API Key Secret */ + apiSecret?: string; + /** Kafka Service Account Id */ + serviceAccountId?: string; + /** Kafka topics list */ + topics?: string[]; + /** Kafka topics directory */ + topicsDir?: string; + /** Flush size */ + flushSize?: string; + /** Maximum Tasks */ + maxTasks?: string; + /** Time Interval */ + timeInterval?: string; + /** The partner connector type. */ + partnerConnectorType: "KafkaAzureCosmosDBSink"; +} + +export function kafkaAzureCosmosDBSinkConnectorInfoSerializer( + item: KafkaAzureCosmosDBSinkConnectorInfo, +): any { + return { + partnerConnectorType: item["partnerConnectorType"], + authType: item["authType"], + inputFormat: item["inputFormat"], + outputFormat: item["outputFormat"], + apiKey: item["apiKey"], + apiSecret: item["apiSecret"], + serviceAccountId: item["serviceAccountId"], + topics: !item["topics"] + ? item["topics"] + : item["topics"].map((p: any) => { + return p; + }), + topicsDir: item["topicsDir"], + flushSize: item["flushSize"], + maxTasks: item["maxTasks"], + timeInterval: item["timeInterval"], + }; +} + +export function kafkaAzureCosmosDBSinkConnectorInfoDeserializer( + item: any, +): KafkaAzureCosmosDBSinkConnectorInfo { + return { + partnerConnectorType: item["partnerConnectorType"], + authType: item["authType"], + inputFormat: item["inputFormat"], + outputFormat: item["outputFormat"], + apiKey: item["apiKey"], + apiSecret: item["apiSecret"], + serviceAccountId: item["serviceAccountId"], + topics: !item["topics"] + ? item["topics"] + : item["topics"].map((p: any) => { + return p; + }), + topicsDir: item["topicsDir"], + flushSize: item["flushSize"], + maxTasks: item["maxTasks"], + timeInterval: item["timeInterval"], + }; +} + +/** The partner connector type is KafkaAzureCosmosDBSource */ +export interface KafkaAzureCosmosDBSourceConnectorInfo extends PartnerInfoBase { + /** Kafka Auth Type */ + authType?: AuthType; + /** Kafka Input Data Format Type */ + inputFormat?: DataFormatType; + /** Kafka Output Data Format Type */ + outputFormat?: DataFormatType; + /** Kafka API Key */ + apiKey?: string; + /** Kafka API Secret */ + apiSecret?: string; + /** Kafka Service Account Id */ + serviceAccountId?: string; + /** Kafka topics Regex pattern */ + topicRegex?: string; + /** Kafka topics directory */ + topicsDir?: string; + /** Maximum Tasks */ + maxTasks?: string; + /** The partner connector type. */ + partnerConnectorType: "KafkaAzureCosmosDBSource"; +} + +export function kafkaAzureCosmosDBSourceConnectorInfoSerializer( + item: KafkaAzureCosmosDBSourceConnectorInfo, +): any { + return { + partnerConnectorType: item["partnerConnectorType"], + authType: item["authType"], + inputFormat: item["inputFormat"], + outputFormat: item["outputFormat"], + apiKey: item["apiKey"], + apiSecret: item["apiSecret"], + serviceAccountId: item["serviceAccountId"], + topicRegex: item["topicRegex"], + topicsDir: item["topicsDir"], + maxTasks: item["maxTasks"], + }; +} + +export function kafkaAzureCosmosDBSourceConnectorInfoDeserializer( + item: any, +): KafkaAzureCosmosDBSourceConnectorInfo { + return { + partnerConnectorType: item["partnerConnectorType"], + authType: item["authType"], + inputFormat: item["inputFormat"], + outputFormat: item["outputFormat"], + apiKey: item["apiKey"], + apiSecret: item["apiSecret"], + serviceAccountId: item["serviceAccountId"], + topicRegex: item["topicRegex"], + topicsDir: item["topicsDir"], + maxTasks: item["maxTasks"], + }; +} + +/** The partner connector type is KafkaAzureSynapseAnalyticsSink */ +export interface KafkaAzureSynapseAnalyticsSinkConnectorInfo + extends PartnerInfoBase { + /** Kafka Auth Type */ + authType?: AuthType; + /** Kafka Input Data Format Type */ + inputFormat?: DataFormatType; + /** Kafka Output Data Format Type */ + outputFormat?: DataFormatType; + /** Kafka API Key */ + apiKey?: string; + /** Kafka API Key Secret */ + apiSecret?: string; + /** Kafka Service Account Id */ + serviceAccountId?: string; + /** Kafka topics list */ + topics?: string[]; + /** Kafka topics directory */ + topicsDir?: string; + /** Flush size */ + flushSize?: string; + /** Maximum Tasks */ + maxTasks?: string; + /** Time Interval */ + timeInterval?: string; + /** The partner connector type. */ + partnerConnectorType: "KafkaAzureSynapseAnalyticsSink"; +} + +export function kafkaAzureSynapseAnalyticsSinkConnectorInfoSerializer( + item: KafkaAzureSynapseAnalyticsSinkConnectorInfo, +): any { + return { + partnerConnectorType: item["partnerConnectorType"], + authType: item["authType"], + inputFormat: item["inputFormat"], + outputFormat: item["outputFormat"], + apiKey: item["apiKey"], + apiSecret: item["apiSecret"], + serviceAccountId: item["serviceAccountId"], + topics: !item["topics"] + ? item["topics"] + : item["topics"].map((p: any) => { + return p; + }), + topicsDir: item["topicsDir"], + flushSize: item["flushSize"], + maxTasks: item["maxTasks"], + timeInterval: item["timeInterval"], + }; +} + +export function kafkaAzureSynapseAnalyticsSinkConnectorInfoDeserializer( + item: any, +): KafkaAzureSynapseAnalyticsSinkConnectorInfo { + return { + partnerConnectorType: item["partnerConnectorType"], + authType: item["authType"], + inputFormat: item["inputFormat"], + outputFormat: item["outputFormat"], + apiKey: item["apiKey"], + apiSecret: item["apiSecret"], + serviceAccountId: item["serviceAccountId"], + topics: !item["topics"] + ? item["topics"] + : item["topics"].map((p: any) => { + return p; + }), + topicsDir: item["topicsDir"], + flushSize: item["flushSize"], + maxTasks: item["maxTasks"], + timeInterval: item["timeInterval"], + }; +} + +/** Result of GET request to list connectors in the cluster of a confluent organization */ +export interface _ListConnectorsSuccessResponse { + /** The ConnectorResource items on this page */ + value: ConnectorResource[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _listConnectorsSuccessResponseDeserializer( + item: any, +): _ListConnectorsSuccessResponse { + return { + value: connectorResourceArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function connectorResourceArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return connectorResourceSerializer(item); + }); +} + +export function connectorResourceArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return connectorResourceDeserializer(item); + }); +} + +/** Details of topic record */ +export interface TopicRecord extends ProxyResource { + /** Topic Properties */ + properties?: TopicProperties; +} + +export function topicRecordSerializer(item: TopicRecord): any { + return { + properties: !item["properties"] + ? item["properties"] + : topicPropertiesSerializer(item["properties"]), + }; +} + +export function topicRecordDeserializer(item: any): TopicRecord { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : topicPropertiesDeserializer(item["properties"]), + }; +} + +/** Topic Properties */ +export interface TopicProperties { + /** Type of topic */ + kind?: string; + /** Topic Id returned by Confluent */ + topicId?: string; + /** Metadata of the record */ + metadata?: TopicMetadataEntity; + /** Partition Specification of the topic */ + partitions?: TopicsRelatedLink; + /** Config Specification of the topic */ + configs?: TopicsRelatedLink; + /** Input Config Specification of the topic */ + inputConfigs?: TopicsInputConfig[]; + /** Partition Reassignment Specification of the topic */ + partitionsReassignments?: TopicsRelatedLink; + /** Partition count of the topic */ + partitionsCount?: string; + /** Replication factor of the topic */ + replicationFactor?: string; +} + +export function topicPropertiesSerializer(item: TopicProperties): any { + return { + kind: item["kind"], + topicId: item["topicId"], + metadata: !item["metadata"] + ? item["metadata"] + : topicMetadataEntitySerializer(item["metadata"]), + partitions: !item["partitions"] + ? item["partitions"] + : topicsRelatedLinkSerializer(item["partitions"]), + configs: !item["configs"] + ? item["configs"] + : topicsRelatedLinkSerializer(item["configs"]), + inputConfigs: !item["inputConfigs"] + ? item["inputConfigs"] + : topicsInputConfigArraySerializer(item["inputConfigs"]), + partitionsReassignments: !item["partitionsReassignments"] + ? item["partitionsReassignments"] + : topicsRelatedLinkSerializer(item["partitionsReassignments"]), + partitionsCount: item["partitionsCount"], + replicationFactor: item["replicationFactor"], + }; +} + +export function topicPropertiesDeserializer(item: any): TopicProperties { + return { + kind: item["kind"], + topicId: item["topicId"], + metadata: !item["metadata"] + ? item["metadata"] + : topicMetadataEntityDeserializer(item["metadata"]), + partitions: !item["partitions"] + ? item["partitions"] + : topicsRelatedLinkDeserializer(item["partitions"]), + configs: !item["configs"] + ? item["configs"] + : topicsRelatedLinkDeserializer(item["configs"]), + inputConfigs: !item["inputConfigs"] + ? item["inputConfigs"] + : topicsInputConfigArrayDeserializer(item["inputConfigs"]), + partitionsReassignments: !item["partitionsReassignments"] + ? item["partitionsReassignments"] + : topicsRelatedLinkDeserializer(item["partitionsReassignments"]), + partitionsCount: item["partitionsCount"], + replicationFactor: item["replicationFactor"], + }; +} + +/** Metadata of the data record */ +export interface TopicMetadataEntity { + /** Self lookup url */ + self?: string; + /** Resource name of the record */ + resourceName?: string; +} + +export function topicMetadataEntitySerializer(item: TopicMetadataEntity): any { + return { self: item["self"], resourceName: item["resourceName"] }; +} + +export function topicMetadataEntityDeserializer( + item: any, +): TopicMetadataEntity { + return { + self: item["self"], + resourceName: item["resourceName"], + }; +} + +/** Partition Config spec of the topic record */ +export interface TopicsRelatedLink { + /** Relationship of the topic */ + related?: string; +} + +export function topicsRelatedLinkSerializer(item: TopicsRelatedLink): any { + return { related: item["related"] }; +} + +export function topicsRelatedLinkDeserializer(item: any): TopicsRelatedLink { + return { + related: item["related"], + }; +} + +export function topicsInputConfigArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return topicsInputConfigSerializer(item); + }); +} + +export function topicsInputConfigArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return topicsInputConfigDeserializer(item); + }); +} + +/** Topics input config */ +export interface TopicsInputConfig { + /** Name of the topic input config */ + name?: string; + /** Value of the topic input config */ + value?: string; +} + +export function topicsInputConfigSerializer(item: TopicsInputConfig): any { + return { name: item["name"], value: item["value"] }; +} + +export function topicsInputConfigDeserializer(item: any): TopicsInputConfig { + return { + name: item["name"], + value: item["value"], + }; +} + +/** Result of GET request to list topics in the cluster of a confluent organization */ +export interface _ListTopicsSuccessResponse { + /** The TopicRecord items on this page */ + value: TopicRecord[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _listTopicsSuccessResponseDeserializer( + item: any, +): _ListTopicsSuccessResponse { + return { + value: topicRecordArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function topicRecordArraySerializer(result: Array): any[] { + return result.map((item) => { + return topicRecordSerializer(item); + }); +} + +export function topicRecordArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return topicRecordDeserializer(item); + }); +} + +/** Response of a list operation. */ +export interface _ConfluentAgreementResourceListResponse { + /** The ConfluentAgreementResource items on this page */ + value: ConfluentAgreementResource[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _confluentAgreementResourceListResponseDeserializer( + item: any, +): _ConfluentAgreementResourceListResponse { + return { + value: confluentAgreementResourceArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function confluentAgreementResourceArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return confluentAgreementResourceSerializer(item); + }); +} + +export function confluentAgreementResourceArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return confluentAgreementResourceDeserializer(item); + }); +} + +/** Agreement Terms definition */ +export interface ConfluentAgreementResource { + /** The ARM id of the resource. */ + readonly id?: string; + /** The name of the agreement. */ + readonly name?: string; + /** The type of the agreement. */ + readonly type?: string; + /** Metadata pertaining to creation and last modification of the resource */ + readonly systemData?: SystemData; + /** Represents the properties of the resource. */ + properties?: ConfluentAgreementProperties; +} + +export function confluentAgreementResourceSerializer( + item: ConfluentAgreementResource, +): any { + return { + properties: !item["properties"] + ? item["properties"] + : confluentAgreementPropertiesSerializer(item["properties"]), + }; +} + +export function confluentAgreementResourceDeserializer( + item: any, +): ConfluentAgreementResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : confluentAgreementPropertiesDeserializer(item["properties"]), + }; +} + +/** Terms properties for Marketplace and Confluent. */ +export interface ConfluentAgreementProperties { + /** Publisher identifier string. */ + publisher?: string; + /** Product identifier string. */ + product?: string; + /** Plan identifier string. */ + plan?: string; + /** Link to HTML with Microsoft and Publisher terms. */ + licenseTextLink?: string; + /** Link to the privacy policy of the publisher. */ + privacyPolicyLink?: string; + /** Date and time in UTC of when the terms were accepted. This is empty if Accepted is false. */ + retrieveDatetime?: Date; + /** Terms signature. */ + signature?: string; + /** If any version of the terms have been accepted, otherwise false. */ + accepted?: boolean; +} + +export function confluentAgreementPropertiesSerializer( + item: ConfluentAgreementProperties, +): any { + return { + publisher: item["publisher"], + product: item["product"], + plan: item["plan"], + licenseTextLink: item["licenseTextLink"], + privacyPolicyLink: item["privacyPolicyLink"], + retrieveDatetime: !item["retrieveDatetime"] + ? item["retrieveDatetime"] + : item["retrieveDatetime"].toISOString(), + signature: item["signature"], + accepted: item["accepted"], + }; +} + +export function confluentAgreementPropertiesDeserializer( + item: any, +): ConfluentAgreementProperties { + return { + publisher: item["publisher"], + product: item["product"], + plan: item["plan"], + licenseTextLink: item["licenseTextLink"], + privacyPolicyLink: item["privacyPolicyLink"], + retrieveDatetime: !item["retrieveDatetime"] + ? item["retrieveDatetime"] + : new Date(item["retrieveDatetime"]), + signature: item["signature"], + accepted: item["accepted"], + }; +} + +/** Validation response from the provider */ +export interface ValidationResponse { + /** Info from the response */ + info?: Record; +} + +export function validationResponseDeserializer(item: any): ValidationResponse { + return { + info: item["info"], + }; +} + +/** The available API versions. */ +export enum KnownVersions { + /** The 2024-07-01 API version. */ + V20240701 = "2024-07-01", +} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/restorePollerHelpers.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/restorePollerHelpers.ts new file mode 100644 index 0000000000..568a62e2b5 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/restorePollerHelpers.ts @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ConfluentClient } from "./confluentClient.js"; +import { _$deleteDeserialize } from "./api/topics/operations.js"; +import { _$deleteDeserialize as _$deleteDeserializeConnector } from "./api/connector/operations.js"; +import { _$deleteDeserialize as _$deleteDeserializeCluster } from "./api/cluster/operations.js"; +import { _$deleteDeserialize as _$deleteDeserializeEnvironment } from "./api/environment/operations.js"; +import { + _$deleteDeserialize as _$deleteDeserializeOrganization, + _createDeserialize, +} from "./api/organization/operations.js"; +import { getLongRunningPoller } from "./static-helpers/pollingHelpers.js"; +import { + OperationOptions, + PathUncheckedResponse, +} from "@azure-rest/core-client"; +import { AbortSignalLike } from "@azure/abort-controller"; +import { + PollerLike, + OperationState, + deserializeState, + ResourceLocationConfig, +} from "@azure/core-lro"; + +export interface RestorePollerOptions< + TResult, + TResponse extends PathUncheckedResponse = PathUncheckedResponse, +> extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** + * The signal which can be used to abort requests. + */ + abortSignal?: AbortSignalLike; + /** Deserialization function for raw response body */ + processResponseBody?: (result: TResponse) => Promise; +} + +/** + * Creates a poller from the serialized state of another poller. This can be + * useful when you want to create pollers on a different host or a poller + * needs to be constructed after the original one is not in scope. + */ +export function restorePoller( + client: ConfluentClient, + serializedState: string, + sourceOperation: ( + ...args: any[] + ) => PollerLike, TResult>, + options?: RestorePollerOptions, +): PollerLike, TResult> { + const pollerConfig = deserializeState(serializedState).config; + const { initialRequestUrl, requestMethod, metadata } = pollerConfig; + if (!initialRequestUrl || !requestMethod) { + throw new Error( + `Invalid serialized state: ${serializedState} for sourceOperation ${sourceOperation?.name}`, + ); + } + const resourceLocationConfig = metadata?.["resourceLocationConfig"] as + | ResourceLocationConfig + | undefined; + const { deserializer, expectedStatuses = [] } = + getDeserializationHelper(initialRequestUrl, requestMethod) ?? {}; + const deserializeHelper = options?.processResponseBody ?? deserializer; + if (!deserializeHelper) { + throw new Error( + `Please ensure the operation is in this client! We can't find its deserializeHelper for ${sourceOperation?.name}.`, + ); + } + return getLongRunningPoller( + (client as any)["_client"] ?? client, + deserializeHelper as (result: TResponse) => Promise, + expectedStatuses, + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + resourceLocationConfig, + restoreFrom: serializedState, + initialRequestUrl, + }, + ); +} + +interface DeserializationHelper { + deserializer: Function; + expectedStatuses: string[]; +} + +const deserializeMap: Record = { + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/environments/{environmentId}/clusters/{clusterId}/topics/{topicName}": + { + deserializer: _$deleteDeserialize, + expectedStatuses: ["202", "204", "200"], + }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/environments/{environmentId}/clusters/{clusterId}/connectors/{connectorName}": + { + deserializer: _$deleteDeserializeConnector, + expectedStatuses: ["202", "204", "200"], + }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/environments/{environmentId}/clusters/{clusterId}": + { + deserializer: _$deleteDeserializeCluster, + expectedStatuses: ["202", "204", "200"], + }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}/environments/{environmentId}": + { + deserializer: _$deleteDeserializeEnvironment, + expectedStatuses: ["202", "204", "200"], + }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}": + { + deserializer: _$deleteDeserializeOrganization, + expectedStatuses: ["200", "202", "204"], + }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}": + { + deserializer: _createDeserialize, + expectedStatuses: ["200", "201", "202"], + }, +}; + +function getDeserializationHelper( + urlStr: string, + method: string, +): DeserializationHelper | undefined { + const path = new URL(urlStr).pathname; + const pathParts = path.split("/"); + + // Traverse list to match the longest candidate + // matchedLen: the length of candidate path + // matchedValue: the matched status code array + let matchedLen = -1, + matchedValue: DeserializationHelper | undefined; + + // Iterate the responseMap to find a match + for (const [key, value] of Object.entries(deserializeMap)) { + // Extracting the path from the map key which is in format + // GET /path/foo + if (!key.startsWith(method)) { + continue; + } + const candidatePath = getPathFromMapKey(key); + // Get each part of the url path + const candidateParts = candidatePath.split("/"); + + // track if we have found a match to return the values found. + let found = true; + for ( + let i = candidateParts.length - 1, j = pathParts.length - 1; + i >= 1 && j >= 1; + i--, j-- + ) { + if ( + candidateParts[i]?.startsWith("{") && + candidateParts[i]?.indexOf("}") !== -1 + ) { + const start = candidateParts[i]!.indexOf("}") + 1, + end = candidateParts[i]?.length; + // If the current part of the candidate is a "template" part + // Try to use the suffix of pattern to match the path + // {guid} ==> $ + // {guid}:export ==> :export$ + const isMatched = new RegExp( + `${candidateParts[i]?.slice(start, end)}`, + ).test(pathParts[j] || ""); + + if (!isMatched) { + found = false; + break; + } + continue; + } + + // If the candidate part is not a template and + // the parts don't match mark the candidate as not found + // to move on with the next candidate path. + if (candidateParts[i] !== pathParts[j]) { + found = false; + break; + } + } + + // We finished evaluating the current candidate parts + // Update the matched value if and only if we found the longer pattern + if (found && candidatePath.length > matchedLen) { + matchedLen = candidatePath.length; + matchedValue = value; + } + } + + return matchedValue; +} + +function getPathFromMapKey(mapKey: string): string { + const pathStart = mapKey.indexOf("/"); + return mapKey.slice(pathStart); +} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/static-helpers/pagingHelpers.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/static-helpers/pagingHelpers.ts new file mode 100644 index 0000000000..97a81e74e3 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/static-helpers/pagingHelpers.ts @@ -0,0 +1,274 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + Client, + createRestError, + PathUncheckedResponse, +} from "@azure-rest/core-client"; +import { RestError } from "@azure/core-rest-pipeline"; + +/** + * Options for the byPage method + */ +export interface PageSettings { + /** + * A reference to a specific page to start iterating from. + */ + continuationToken?: string; +} + +/** + * An interface that describes a page of results. + */ +export type ContinuablePage = TPage & { + /** + * The token that keeps track of where to continue the iterator + */ + continuationToken?: string; +}; + +/** + * An interface that allows async iterable iteration both to completion and by page. + */ +export interface PagedAsyncIterableIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * The next method, part of the iteration protocol + */ + next(): Promise>; + /** + * The connection to the async iterator, part of the iteration protocol + */ + [Symbol.asyncIterator](): PagedAsyncIterableIterator< + TElement, + TPage, + TPageSettings + >; + /** + * Return an AsyncIterableIterator that works a page at a time + */ + byPage: ( + settings?: TPageSettings, + ) => AsyncIterableIterator>; +} + +/** + * An interface that describes how to communicate with the service. + */ +export interface PagedResult< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * Link to the first page of results. + */ + firstPageLink?: string; + /** + * A method that returns a page of results. + */ + getPage: ( + pageLink?: string, + ) => Promise<{ page: TPage; nextPageLink?: string } | undefined>; + /** + * a function to implement the `byPage` method on the paged async iterator. + */ + byPage?: ( + settings?: TPageSettings, + ) => AsyncIterableIterator>; + + /** + * A function to extract elements from a page. + */ + toElements?: (page: TPage) => TElement[]; +} + +/** + * Options for the paging helper + */ +export interface BuildPagedAsyncIteratorOptions { + itemName?: string; + nextLinkName?: string; +} + +/** + * Helper to paginate results in a generic way and return a PagedAsyncIterableIterator + */ +export function buildPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, + TResponse extends PathUncheckedResponse = PathUncheckedResponse, +>( + client: Client, + getInitialResponse: () => PromiseLike, + processResponseBody: (result: TResponse) => PromiseLike, + expectedStatuses: string[], + options: BuildPagedAsyncIteratorOptions = {}, +): PagedAsyncIterableIterator { + const itemName = options.itemName ?? "value"; + const nextLinkName = options.nextLinkName ?? "nextLink"; + const pagedResult: PagedResult = { + getPage: async (pageLink?: string) => { + const result = + pageLink === undefined + ? await getInitialResponse() + : await client.pathUnchecked(pageLink).get(); + checkPagingRequest(result, expectedStatuses); + const results = await processResponseBody(result as TResponse); + const nextLink = getNextLink(results, nextLinkName); + const values = getElements(results, itemName) as TPage; + return { + page: values, + nextPageLink: nextLink, + }; + }, + byPage: (settings?: TPageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + }); + }, + }; + return getPagedAsyncIterator(pagedResult); +} + +/** + * returns an async iterator that iterates over results. It also has a `byPage` + * method that returns pages of items at once. + * + * @param pagedResult - an object that specifies how to get pages. + * @returns a paged async iterator that iterates over results. + */ + +function getPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +>( + pagedResult: PagedResult, +): PagedAsyncIterableIterator { + const iter = getItemAsyncIterator( + pagedResult, + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: + pagedResult?.byPage ?? + ((settings?: TPageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + }); + }), + }; +} + +async function* getItemAsyncIterator< + TElement, + TPage, + TPageSettings extends PageSettings, +>( + pagedResult: PagedResult, +): AsyncIterableIterator { + const pages = getPageAsyncIterator(pagedResult); + for await (const page of pages) { + yield* page as unknown as TElement[]; + } +} + +async function* getPageAsyncIterator< + TElement, + TPage, + TPageSettings extends PageSettings, +>( + pagedResult: PagedResult, + options: { + pageLink?: string; + } = {}, +): AsyncIterableIterator> { + const { pageLink } = options; + let response = await pagedResult.getPage( + pageLink ?? pagedResult.firstPageLink, + ); + if (!response) { + return; + } + let result = response.page as ContinuablePage; + result.continuationToken = response.nextPageLink; + yield result; + while (response.nextPageLink) { + response = await pagedResult.getPage(response.nextPageLink); + if (!response) { + return; + } + result = response.page as ContinuablePage; + result.continuationToken = response.nextPageLink; + yield result; + } +} + +/** + * Gets for the value of nextLink in the body + */ +function getNextLink(body: unknown, nextLinkName?: string): string | undefined { + if (!nextLinkName) { + return undefined; + } + + const nextLink = (body as Record)[nextLinkName]; + + if ( + typeof nextLink !== "string" && + typeof nextLink !== "undefined" && + nextLink !== null + ) { + throw new RestError( + `Body Property ${nextLinkName} should be a string or undefined or null but got ${typeof nextLink}`, + ); + } + + if (nextLink === null) { + return undefined; + } + + return nextLink; +} + +/** + * Gets the elements of the current request in the body. + */ +function getElements(body: unknown, itemName: string): T[] { + const value = (body as Record)[itemName] as T[]; + if (!Array.isArray(value)) { + throw new RestError( + `Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`, + ); + } + + return value ?? []; +} + +/** + * Checks if a request failed + */ +function checkPagingRequest( + response: PathUncheckedResponse, + expectedStatuses: string[], +): void { + if (!expectedStatuses.includes(response.status)) { + throw createRestError( + `Pagination failed with unexpected statusCode ${response.status}`, + response, + ); + } +} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/static-helpers/pollingHelpers.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/static-helpers/pollingHelpers.ts new file mode 100644 index 0000000000..2edbf783be --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/static-helpers/pollingHelpers.ts @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + PollerLike, + OperationState, + ResourceLocationConfig, + RunningOperation, + createHttpPoller, + OperationResponse, +} from "@azure/core-lro"; + +import { + Client, + PathUncheckedResponse, + createRestError, +} from "@azure-rest/core-client"; +import { AbortSignalLike } from "@azure/abort-controller"; + +export interface GetLongRunningPollerOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** + * The signal which can be used to abort requests. + */ + abortSignal?: AbortSignalLike; + /** + * The potential location of the result of the LRO if specified by the LRO extension in the swagger. + */ + resourceLocationConfig?: ResourceLocationConfig; + /** + * The original url of the LRO + * Should not be null when restoreFrom is set + */ + initialRequestUrl?: string; + /** + * A serialized poller which can be used to resume an existing paused Long-Running-Operation. + */ + restoreFrom?: string; + /** + * The function to get the initial response + */ + getInitialResponse?: () => PromiseLike; +} +export function getLongRunningPoller< + TResponse extends PathUncheckedResponse, + TResult = void, +>( + client: Client, + processResponseBody: (result: TResponse) => Promise, + expectedStatuses: string[], + options: GetLongRunningPollerOptions, +): PollerLike, TResult> { + const { restoreFrom, getInitialResponse } = options; + if (!restoreFrom && !getInitialResponse) { + throw new Error( + "Either restoreFrom or getInitialResponse must be specified", + ); + } + let initialResponse: TResponse | undefined = undefined; + const pollAbortController = new AbortController(); + const poller: RunningOperation = { + sendInitialRequest: async () => { + if (!getInitialResponse) { + throw new Error( + "getInitialResponse is required when initializing a new poller", + ); + } + initialResponse = await getInitialResponse(); + return getLroResponse(initialResponse, expectedStatuses); + }, + sendPollRequest: async ( + path: string, + pollOptions?: { + abortSignal?: AbortSignalLike; + }, + ) => { + // The poll request would both listen to the user provided abort signal and the poller's own abort signal + function abortListener(): void { + pollAbortController.abort(); + } + const abortSignal = pollAbortController.signal; + if (options.abortSignal?.aborted) { + pollAbortController.abort(); + } else if (pollOptions?.abortSignal?.aborted) { + pollAbortController.abort(); + } else if (!abortSignal.aborted) { + options.abortSignal?.addEventListener("abort", abortListener, { + once: true, + }); + pollOptions?.abortSignal?.addEventListener("abort", abortListener, { + once: true, + }); + } + let response; + try { + response = await client.pathUnchecked(path).get({ abortSignal }); + } finally { + options.abortSignal?.removeEventListener("abort", abortListener); + pollOptions?.abortSignal?.removeEventListener("abort", abortListener); + } + + return getLroResponse(response as TResponse, expectedStatuses); + }, + }; + return createHttpPoller(poller, { + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: options?.resourceLocationConfig, + restoreFrom: options?.restoreFrom, + processResult: (result: unknown) => { + return processResponseBody(result as TResponse); + }, + }); +} +/** + * Converts a Rest Client response to a response that the LRO implementation understands + * @param response - a rest client http response + * @param deserializeFn - deserialize function to convert Rest response to modular output + * @returns - An LRO response that the LRO implementation understands + */ +function getLroResponse( + response: TResponse, + expectedStatuses: string[], +): OperationResponse { + if (!expectedStatuses.includes(response.status)) { + throw createRestError(response); + } + + return { + flatResponse: response, + rawResponse: { + ...response, + statusCode: Number.parseInt(response.status), + body: response.body, + }, + }; +} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/static-helpers/urlTemplate.ts b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/static-helpers/urlTemplate.ts new file mode 100644 index 0000000000..a19e628d34 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/src/static-helpers/urlTemplate.ts @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +//--------------------- +// interfaces +//--------------------- +interface ValueOptions { + isFirst: boolean; // is first value in the expression + op?: string; // operator + varValue?: any; // variable value + varName?: string; // variable name + modifier?: string; // modifier e.g * + reserved?: boolean; // if true we'll keep reserved words with not encoding +} + +export interface UrlTemplateOptions { + // if set to true, reserved characters will not be encoded + allowReserved?: boolean; +} + +// --------------------- +// helpers +// --------------------- +function encodeComponent(val: string, reserved?: boolean, op?: string) { + return (reserved ?? op === "+") || op === "#" + ? encodeReservedComponent(val) + : encodeRFC3986URIComponent(val); +} + +function encodeReservedComponent(str: string) { + return str + .split(/(%[0-9A-Fa-f]{2})/g) + .map((part) => (!/%[0-9A-Fa-f]/.test(part) ? encodeURI(part) : part)) + .join(""); +} + +function encodeRFC3986URIComponent(str: string) { + return encodeURIComponent(str).replace( + /[!'()*]/g, + (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`, + ); +} + +function isDefined(val: any) { + return val !== undefined && val !== null; +} + +function getNamedAndIfEmpty(op?: string): [boolean, string] { + return [ + !!op && [";", "?", "&"].includes(op), + !!op && ["?", "&"].includes(op) ? "=" : "", + ]; +} + +function getFirstOrSep(op?: string, isFirst = false) { + if (isFirst) { + return !op || op === "+" ? "" : op; + } else if (!op || op === "+" || op === "#") { + return ","; + } else if (op === "?") { + return "&"; + } else { + return op; + } +} + +function getExpandedValue(option: ValueOptions) { + let isFirst = option.isFirst; + const { op, varName, varValue: value, reserved } = option; + const vals: string[] = []; + const [named, ifEmpty] = getNamedAndIfEmpty(op); + + if (Array.isArray(value)) { + for (const val of value.filter(isDefined)) { + // prepare the following parts: separator, varName, value + vals.push(`${getFirstOrSep(op, isFirst)}`); + if (named && varName) { + vals.push(`${encodeURIComponent(varName)}`); + val === "" ? vals.push(ifEmpty) : vals.push("="); + } + vals.push(encodeComponent(val, reserved, op)); + isFirst = false; + } + } else if (typeof value === "object") { + for (const key of Object.keys(value)) { + const val = value[key]; + if (!isDefined(val)) { + continue; + } + // prepare the following parts: separator, key, value + vals.push(`${getFirstOrSep(op, isFirst)}`); + if (key) { + vals.push(`${encodeURIComponent(key)}`); + named && val === "" ? vals.push(ifEmpty) : vals.push("="); + } + vals.push(encodeComponent(val, reserved, op)); + isFirst = false; + } + } + return vals.join(""); +} + +function getNonExpandedValue(option: ValueOptions) { + const { op, varName, varValue: value, isFirst, reserved } = option; + const vals: string[] = []; + const first = getFirstOrSep(op, isFirst); + const [named, ifEmpty] = getNamedAndIfEmpty(op); + if (named && varName) { + vals.push(encodeComponent(varName, reserved, op)); + if (value === "") { + if (!ifEmpty) { + vals.push(ifEmpty); + } + return !vals.join("") ? undefined : `${first}${vals.join("")}`; + } + vals.push("="); + } + + const items = []; + if (Array.isArray(value)) { + for (const val of value.filter(isDefined)) { + items.push(encodeComponent(val, reserved, op)); + } + } else if (typeof value === "object") { + for (const key of Object.keys(value)) { + if (!isDefined(value[key])) { + continue; + } + items.push(encodeRFC3986URIComponent(key)); + items.push(encodeComponent(value[key], reserved, op)); + } + } + vals.push(items.join(",")); + return !vals.join(",") ? undefined : `${first}${vals.join("")}`; +} + +function getVarValue(option: ValueOptions): string | undefined { + const { op, varName, modifier, isFirst, reserved, varValue: value } = option; + + if (!isDefined(value)) { + return undefined; + } else if (["string", "number", "boolean"].includes(typeof value)) { + let val = value.toString(); + const [named, ifEmpty] = getNamedAndIfEmpty(op); + const vals: string[] = [getFirstOrSep(op, isFirst)]; + if (named && varName) { + // No need to encode varName considering it is already encoded + vals.push(varName); + val === "" ? vals.push(ifEmpty) : vals.push("="); + } + if (modifier && modifier !== "*") { + val = val.substring(0, parseInt(modifier, 10)); + } + vals.push(encodeComponent(val, reserved, op)); + return vals.join(""); + } else if (modifier === "*") { + return getExpandedValue(option); + } else { + return getNonExpandedValue(option); + } +} + +// --------------------------------------------------------------------------------------------------- +// This is an implementation of RFC 6570 URI Template: https://datatracker.ietf.org/doc/html/rfc6570. +// --------------------------------------------------------------------------------------------------- +export function expandUrlTemplate( + template: string, + context: Record, + option?: UrlTemplateOptions, +): string { + return template.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g, (_, expr, text) => { + if (!expr) { + return encodeReservedComponent(text); + } + let op; + if (["+", "#", ".", "/", ";", "?", "&"].includes(expr[0])) { + (op = expr[0]), (expr = expr.slice(1)); + } + const varList = expr.split(/,/g); + const result = []; + for (const varSpec of varList) { + const varMatch = /([^:\*]*)(?::(\d+)|(\*))?/.exec(varSpec); + if (!varMatch || !varMatch[1]) { + continue; + } + const varValue = getVarValue({ + isFirst: result.length === 0, + op, + varValue: context[varMatch[1]], + varName: varMatch[1], + modifier: varMatch[2] || varMatch[3], + reserved: option?.allowReserved, + }); + if (varValue) { + result.push(varValue); + } + } + return result.join(""); + }); +} diff --git a/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/tsconfig.json b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/tsconfig.json new file mode 100644 index 0000000000..031889db45 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/generated/typespec-ts/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "target": "ES2017", + "module": "NodeNext", + "lib": [], + "declaration": true, + "declarationMap": true, + "inlineSources": true, + "sourceMap": true, + "importHelpers": true, + "strict": true, + "alwaysStrict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "forceConsistentCasingInFileNames": true, + "moduleResolution": "NodeNext", + "allowSyntheticDefaultImports": true, + "esModuleInterop": true + }, + "include": ["src/**/*.ts"] +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/ConnectorResource.tsp b/packages/typespec-test/test/Confluent.Management/spec/ConnectorResource.tsp new file mode 100644 index 0000000000..60db12d4d5 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/ConnectorResource.tsp @@ -0,0 +1,126 @@ +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; +import "@typespec/openapi"; +import "@typespec/rest"; +import "./models.tsp"; +import "./SCClusterRecord.tsp"; + +using TypeSpec.Rest; +using Azure.ResourceManager; +using TypeSpec.Http; +using TypeSpec.OpenAPI; + +namespace Microsoft.Confluent; +/** + * Details of connector record + */ +@parentResource(SCClusterRecord) +model ConnectorResource + is Azure.ResourceManager.ProxyResource { + ...ResourceNameParameter< + Resource = ConnectorResource, + KeyName = "connectorName", + SegmentName = "connectors", + NamePattern = "" + >; +} + +#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +interface ConnectorResourcesOps + extends Azure.ResourceManager.Legacy.LegacyOperations< + { + ...ApiVersionParameter, + ...SubscriptionIdParameter, + ...ResourceGroupParameter, + ...Azure.ResourceManager.Legacy.Provider, + + /** + * Organization resource name + */ + @path + @segment("organizations") + organizationName: string, + + /** + * Confluent environment id + */ + @path + @segment("environments") + environmentId: string, + + /** + * Confluent kafka or schema registry cluster id + */ + @path + @segment("clusters") + clusterId: string, + }, + { + /** + * Confluent connector name + */ + @path + @segment("connectors") + connectorName: string, + }, + ResourceProviderDefaultErrorResponse + > {} + +@armResourceOperations +interface ConnectorResources { + /** + * Get confluent connector by Name + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + get is ArmResourceRead< + ConnectorResource, + Error = ResourceProviderDefaultErrorResponse + >; + + /** + * Create confluent connector by Name + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + createOrUpdate is ConnectorResourcesOps.CreateOrUpdateSync< + ConnectorResource, + OptionalRequestBody = true + >; + + /** + * Delete confluent connector by name + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + delete is ArmResourceDeleteWithoutOkAsync< + ConnectorResource, + Error = ErrorResponse + >; + + /** + * Lists all the connectors in a cluster + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + list is ArmResourceListByParent< + ConnectorResource, + Parameters = { + /** + * Pagination size + */ + @query("pageSize") + pageSize?: int32; + + /** + * An opaque pagination token to fetch the next set of records + */ + @query("pageToken") + pageToken?: string; + }, + Response = ArmResponse, + Error = ResourceProviderDefaultErrorResponse + >; +} + +@@doc(ConnectorResource.name, "Confluent connector name"); +@@doc(ConnectorResource.properties, "The properties of the Connector"); +@@doc(ConnectorResources.createOrUpdate::parameters.resource, + "Confluent Connector resource model" +); diff --git a/packages/typespec-test/test/Confluent.Management/spec/OrganizationResource.tsp b/packages/typespec-test/test/Confluent.Management/spec/OrganizationResource.tsp new file mode 100644 index 0000000000..65b51155d8 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/OrganizationResource.tsp @@ -0,0 +1,367 @@ +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; +import "@typespec/openapi"; +import "@typespec/rest"; +import "./models.tsp"; + +using TypeSpec.Rest; +using Azure.ResourceManager; +using TypeSpec.Http; +using TypeSpec.OpenAPI; + +namespace Microsoft.Confluent; +/** + * Organization resource. + */ +model OrganizationResource + is Azure.ResourceManager.TrackedResource< + OrganizationResourceProperties, + false + > { + ...ResourceNameParameter< + Resource = OrganizationResource, + KeyName = "organizationName", + SegmentName = "organizations", + NamePattern = "" + >; +} + +#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +interface OrganizationResourceAPIKeyOps + extends Azure.ResourceManager.Legacy.LegacyOperations< + { + ...ApiVersionParameter, + ...SubscriptionIdParameter, + ...ResourceGroupParameter, + ...Azure.ResourceManager.Legacy.Provider, + + /** + * Organization resource name + */ + @path @segment("organizations") organizationName: string, + }, + { + /** + * Confluent API Key id + */ + @path @segment("apiKeys") apiKeyId: string, + }, + ResourceProviderDefaultErrorResponse + > {} + +#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +interface OrganizationResourceAPIKeyActions { + /** + * Get API key details of a kafka or schema registry cluster + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @get + @operationId("Organization_GetClusterAPIKey") + getClusterAPIKey is OrganizationResourceAPIKeyOps.Read< + OrganizationResource, + {}, + ArmResponse + >; + + /** + * Deletes API key of a kafka or schema registry cluster + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @delete + @operationId("Organization_DeleteClusterAPIKey") + deleteClusterAPIKey is OrganizationResourceAPIKeyOps.DeleteSync< + OrganizationResource, + {}, + OkResponse | NoContentResponse + >; +} + +#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +interface OrganizationResourceRoleBindingIdOps + extends Azure.ResourceManager.Legacy.LegacyOperations< + { + ...ApiVersionParameter, + ...SubscriptionIdParameter, + ...ResourceGroupParameter, + ...Azure.ResourceManager.Legacy.Provider, + + /** + * Organization resource name + */ + @path + @segment("organizations") + organizationName: string, + }, + { + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @path + access: "access", + + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @path + default: "default", + + /** + * Confluent Role binding id + */ + @path + @segment("deleteRoleBinding") + roleBindingId: string, + }, + ResourceProviderDefaultErrorResponse + > {} + +#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +interface OrganizationResourceRoleBindingIdOperationGroup + extends Azure.ResourceManager.Legacy.LegacyOperations< + { + ...ApiVersionParameter, + ...SubscriptionIdParameter, + ...ResourceGroupParameter, + ...Azure.ResourceManager.Legacy.Provider, + + /** + * Organization resource name + */ + @path @segment("organizations") organizationName: string, + }, + {}, + ResourceProviderDefaultErrorResponse + > {} + +#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +interface OrganizationResourceRoleBindingIdActions { + /** + * Organization role bindings + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @delete + deleteRoleBinding is OrganizationResourceRoleBindingIdOps.DeleteSync< + OrganizationResource, + {}, + OkResponse | NoContentResponse + >; +} + +@armResourceOperations +interface OrganizationResources { + /** + * Get the properties of a specific Organization resource. + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + get is ArmResourceRead< + OrganizationResource, + Error = ResourceProviderDefaultErrorResponse + >; + + /** + * Create Organization resource + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + create is OrganizationResourceRoleBindingIdOperationGroup.CreateOrUpdateAsync< + OrganizationResource, + OptionalRequestBody = true + >; + + /** + * Update Organization resource + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @patch(#{ implicitOptionality: false }) + update is OrganizationResourceRoleBindingIdOperationGroup.CustomPatchSync< + OrganizationResource, + PatchModel = OrganizationResourceUpdate, + OptionalRequestBody = true + >; + + /** + * Delete Organization resource + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + delete is ArmResourceDeleteWithoutOkAsync< + OrganizationResource, + Response = ArmDeletedResponse | ArmDeleteAcceptedLroResponse | ArmDeletedNoContentResponse, + Error = ResourceProviderDefaultErrorResponse + >; + + /** + * List all Organizations under the specified resource group. + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + listByResourceGroup is ArmResourceListByParent< + OrganizationResource, + Error = ResourceProviderDefaultErrorResponse + >; + + /** + * List all organizations under the specified subscription. + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + listBySubscription is ArmListBySubscription< + OrganizationResource, + Error = ResourceProviderDefaultErrorResponse + >; + + /** + * cloud provider regions available for creating Schema Registry clusters. + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + listRegions is ArmResourceActionSync< + OrganizationResource, + ListAccessRequestModel, + ArmResponse, + Error = ResourceProviderDefaultErrorResponse + >; + + /** + * Organization users details + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @action("access/default/listUsers") + listUsers is ArmResourceActionSync< + OrganizationResource, + ListAccessRequestModel, + ArmResponse, + Error = ResourceProviderDefaultErrorResponse + >; + + /** + * Organization service accounts details + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @action("access/default/listServiceAccounts") + listServiceAccounts is ArmResourceActionSync< + OrganizationResource, + ListAccessRequestModel, + ArmResponse, + Error = ResourceProviderDefaultErrorResponse + >; + + /** + * Organization accounts invitation details + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @action("access/default/listInvitations") + listInvitations is ArmResourceActionSync< + OrganizationResource, + ListAccessRequestModel, + ArmResponse, + Error = ResourceProviderDefaultErrorResponse + >; + + /** + * Invite user to the organization + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @action("access/default/createInvitation") + inviteUser is ArmResourceActionSync< + OrganizationResource, + AccessInviteUserAccountModel, + ArmResponse, + Error = ResourceProviderDefaultErrorResponse + >; + + /** + * Environment list of an organization + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @action("access/default/listEnvironments") + listEnvironments is ArmResourceActionSync< + OrganizationResource, + ListAccessRequestModel, + ArmResponse, + Error = ResourceProviderDefaultErrorResponse + >; + + /** + * Cluster details + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @action("access/default/listClusters") + listClusters is ArmResourceActionSync< + OrganizationResource, + ListAccessRequestModel, + ArmResponse, + Error = ResourceProviderDefaultErrorResponse + >; + + /** + * Organization role bindings + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @action("access/default/listRoleBindings") + listRoleBindings is ArmResourceActionSync< + OrganizationResource, + ListAccessRequestModel, + ArmResponse, + Error = ResourceProviderDefaultErrorResponse + >; + + /** + * Organization role bindings + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @action("access/default/createRoleBinding") + createRoleBinding is ArmResourceActionSync< + OrganizationResource, + AccessCreateRoleBindingRequestModel, + ArmResponse, + Error = ResourceProviderDefaultErrorResponse + >; + + /** + * Organization role bindings + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @action("access/default/listRoleBindingNameList") + listRoleBindingNameList is ArmResourceActionSync< + OrganizationResource, + ListAccessRequestModel, + ArmResponse, + Error = ResourceProviderDefaultErrorResponse + >; +} + +@@doc(OrganizationResource.name, "Organization resource name"); +@@doc(OrganizationResource.properties, "Organization resource properties"); +@@doc(OrganizationResources.create::parameters.resource, + "Organization resource model" +); +@@doc(OrganizationResources.update::parameters.properties, + "Updated Organization resource" +); +@@doc(OrganizationResources.listRegions::parameters.body, + "List Access Request Model" +); +@@doc(OrganizationResources.listUsers::parameters.body, + "List Access Request Model" +); +@@doc(OrganizationResources.listServiceAccounts::parameters.body, + "List Access Request Model" +); +@@doc(OrganizationResources.listInvitations::parameters.body, + "List Access Request Model" +); +@@doc(OrganizationResources.inviteUser::parameters.body, + "Invite user account model" +); +@@doc(OrganizationResources.listEnvironments::parameters.body, + "List Access Request Model" +); +@@doc(OrganizationResources.listClusters::parameters.body, + "List Access Request Model" +); +@@doc(OrganizationResources.listRoleBindings::parameters.body, + "List Access Request Model" +); +@@doc(OrganizationResources.createRoleBinding::parameters.body, + "Create role binding Request Model" +); +@@doc(OrganizationResources.listRoleBindingNameList::parameters.body, + "List Access Request Model" +); diff --git a/packages/typespec-test/test/Confluent.Management/spec/SCClusterRecord.tsp b/packages/typespec-test/test/Confluent.Management/spec/SCClusterRecord.tsp new file mode 100644 index 0000000000..347b7e8c7a --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/SCClusterRecord.tsp @@ -0,0 +1,153 @@ +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; +import "@typespec/openapi"; +import "@typespec/rest"; +import "./models.tsp"; +import "./SCEnvironmentRecord.tsp"; + +using TypeSpec.Rest; +using Azure.ResourceManager; +using TypeSpec.Http; +using TypeSpec.OpenAPI; + +namespace Microsoft.Confluent; +/** + * Details of cluster record + */ +#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +#suppress "@azure-tools/typespec-azure-core/no-private-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +#suppress "@azure-tools/typespec-azure-core/no-private-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +@Azure.ResourceManager.Private.armResourceInternal(ClusterProperties) +@TypeSpec.Http.Private.includeInapplicableMetadataInPayload(false) +@parentResource(SCEnvironmentRecord) +model SCClusterRecord extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = SCClusterRecord, + KeyName = "clusterId", + SegmentName = "clusters", + NamePattern = "" + >; + + /** + * Type of cluster + */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + kind?: string; + + #suppress "@azure-tools/typespec-azure-core/no-private-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @doc("The resource-specific properties for this resource.") + properties?: ClusterProperties; +} + +#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +interface SCClusterRecordsOps + extends Azure.ResourceManager.Legacy.LegacyOperations< + { + ...ApiVersionParameter, + ...SubscriptionIdParameter, + ...ResourceGroupParameter, + ...Azure.ResourceManager.Legacy.Provider, + + /** + * Organization resource name + */ + @path + @segment("organizations") + organizationName: string, + + /** + * Confluent environment id + */ + @path + @segment("environments") + environmentId: string, + }, + { + /** + * Confluent kafka or schema registry cluster id + */ + @path + @segment("clusters") + clusterId: string, + }, + ResourceProviderDefaultErrorResponse + > {} + +#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +@armResourceOperations +interface SCClusterRecords { + /** + * Get cluster by Id + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + getClusterById is ArmResourceRead< + SCClusterRecord, + Error = ResourceProviderDefaultErrorResponse + >; + + /** + * Create confluent clusters + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + createOrUpdate is SCClusterRecordsOps.CreateOrUpdateSync< + SCClusterRecord, + OptionalRequestBody = true + >; + + /** + * Delete confluent cluster by id + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + delete is ArmResourceDeleteWithoutOkAsync< + SCClusterRecord, + Error = ErrorResponse + >; + + /** + * Lists of all the clusters in a environment + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + listClusters is ArmResourceListByParent< + SCClusterRecord, + Parameters = { + /** + * Pagination size + */ + @query("pageSize") + pageSize?: int32; + + /** + * An opaque pagination token to fetch the next set of records + */ + @query("pageToken") + pageToken?: string; + }, + Response = ArmResponse, + Error = ResourceProviderDefaultErrorResponse + >; + + /** + * Creates API key for a schema registry Cluster ID or Kafka Cluster ID under a environment + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @operationId("Organization_CreateAPIKey") + createAPIKey is ArmResourceActionSync< + SCClusterRecord, + CreateAPIKeyModel, + ArmResponse, + Error = ResourceProviderDefaultErrorResponse + >; +} + +@@doc(SCClusterRecord.name, "Confluent kafka or schema registry cluster id"); +@@doc(SCClusterRecord.properties, "Cluster Properties"); +@@doc(SCClusterRecords.createOrUpdate::parameters.resource, + "Confluent Cluster resource model" +); +@@doc(SCClusterRecords.createAPIKey::parameters.body, + "Request payload for get creating API Key for schema registry Cluster ID or Kafka Cluster ID under a environment" +); diff --git a/packages/typespec-test/test/Confluent.Management/spec/SCEnvironmentRecord.tsp b/packages/typespec-test/test/Confluent.Management/spec/SCEnvironmentRecord.tsp new file mode 100644 index 0000000000..3ea5152c86 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/SCEnvironmentRecord.tsp @@ -0,0 +1,197 @@ +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; +import "@typespec/openapi"; +import "@typespec/rest"; +import "./models.tsp"; +import "./OrganizationResource.tsp"; + +using TypeSpec.Rest; +using Azure.ResourceManager; +using TypeSpec.Http; +using TypeSpec.OpenAPI; + +namespace Microsoft.Confluent; +/** + * Details about environment name, metadata and environment id of an environment + */ +#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +#suppress "@azure-tools/typespec-azure-core/no-private-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +#suppress "@azure-tools/typespec-azure-core/no-private-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +@Azure.ResourceManager.Private.armResourceInternal(EnvironmentProperties) +@TypeSpec.Http.Private.includeInapplicableMetadataInPayload(false) +@parentResource(OrganizationResource) +model SCEnvironmentRecord extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = SCEnvironmentRecord, + KeyName = "environmentId", + SegmentName = "environments", + NamePattern = "" + >; + + /** + * Type of environment + */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + kind?: string; + + #suppress "@azure-tools/typespec-azure-core/no-private-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @doc("The resource-specific properties for this resource.") + properties?: EnvironmentProperties; +} + +#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +interface SCEnvironmentRecordsOps + extends Azure.ResourceManager.Legacy.LegacyOperations< + { + ...ApiVersionParameter, + ...SubscriptionIdParameter, + ...ResourceGroupParameter, + ...Azure.ResourceManager.Legacy.Provider, + + /** + * Organization resource name + */ + @path + @segment("organizations") + organizationName: string, + }, + { + /** + * Confluent environment id + */ + @path + @segment("environments") + environmentId: string, + }, + ResourceProviderDefaultErrorResponse + > {} + +#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +@armResourceOperations +interface SCEnvironmentRecords { + /** + * Get Environment details by environment Id + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + getEnvironmentById is ArmResourceRead< + SCEnvironmentRecord, + Error = ResourceProviderDefaultErrorResponse + >; + + /** + * Create confluent environment + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + createOrUpdate is SCEnvironmentRecordsOps.CreateOrUpdateSync< + SCEnvironmentRecord, + OptionalRequestBody = true + >; + + /** + * Delete confluent environment by id + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + delete is ArmResourceDeleteWithoutOkAsync; + + /** + * Lists of all the environments in a organization + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + listEnvironments is ArmResourceListByParent< + SCEnvironmentRecord, + Parameters = { + /** + * Pagination size + */ + @query("pageSize") + pageSize?: int32; + + /** + * An opaque pagination token to fetch the next set of records + */ + @query("pageToken") + pageToken?: string; + }, + Response = ArmResponse, + Error = ResourceProviderDefaultErrorResponse + >; + + /** + * Get schema registry clusters + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @get + @action("schemaRegistryClusters") + listSchemaRegistryClusters is ArmResourceActionSync< + SCEnvironmentRecord, + void, + ArmResponse, + Parameters = { + /** + * Pagination size + */ + @query("pageSize") + pageSize?: int32; + + /** + * An opaque pagination token to fetch the next set of records + */ + @query("pageToken") + pageToken?: string; + }, + Error = ResourceProviderDefaultErrorResponse + >; +} + +#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +interface SCEnvironmentRecordClusterOps + extends Azure.ResourceManager.Legacy.LegacyOperations< + { + ...ApiVersionParameter, + ...SubscriptionIdParameter, + ...ResourceGroupParameter, + ...Azure.ResourceManager.Legacy.Provider, + + /** + * Organization resource name + */ + @path @segment("organizations") organizationName: string, + + /** + * Confluent environment id + */ + @path @segment("environments") environmentId: string, + }, + { + /** + * Confluent connector name + */ + @path @segment("schemaRegistryClusters") clusterId: string, + }, + ResourceProviderDefaultErrorResponse + > {} + +#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +interface SCEnvironmentRecordCluster { + /** + * Get schema registry cluster by Id + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @get + getSchemaRegistryClusterById is SCEnvironmentRecordClusterOps.Read< + SCEnvironmentRecord, + {}, + ArmResponse + >; +} + +@@doc(SCEnvironmentRecord.name, "Confluent environment id"); +@@doc(SCEnvironmentRecord.properties, "Environment properties"); +@@doc(SCEnvironmentRecords.createOrUpdate::parameters.resource, + "Confluent Environment resource model" +); diff --git a/packages/typespec-test/test/Confluent.Management/spec/TopicRecord.tsp b/packages/typespec-test/test/Confluent.Management/spec/TopicRecord.tsp new file mode 100644 index 0000000000..4d9cdcdf46 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/TopicRecord.tsp @@ -0,0 +1,122 @@ +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; +import "@typespec/openapi"; +import "@typespec/rest"; +import "./models.tsp"; +import "./SCClusterRecord.tsp"; + +using TypeSpec.Rest; +using Azure.ResourceManager; +using TypeSpec.Http; +using TypeSpec.OpenAPI; + +namespace Microsoft.Confluent; +/** + * Details of topic record + */ +@parentResource(SCClusterRecord) +model TopicRecord is Azure.ResourceManager.ProxyResource { + ...ResourceNameParameter< + Resource = TopicRecord, + KeyName = "topicName", + SegmentName = "topics", + NamePattern = "" + >; +} + +#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +interface TopicRecordsOps + extends Azure.ResourceManager.Legacy.LegacyOperations< + { + ...ApiVersionParameter, + ...SubscriptionIdParameter, + ...ResourceGroupParameter, + ...Azure.ResourceManager.Legacy.Provider, + + /** + * Organization resource name + */ + @path + @segment("organizations") + organizationName: string, + + /** + * Confluent environment id + */ + @path + @segment("environments") + environmentId: string, + + /** + * Confluent kafka or schema registry cluster id + */ + @path + @segment("clusters") + clusterId: string, + }, + { + /** + * Confluent kafka or schema registry topic name + */ + @path + @segment("topics") + topicName: string, + }, + ResourceProviderDefaultErrorResponse + > {} + +@armResourceOperations +interface TopicRecords { + /** + * Get confluent topic by Name + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + get is ArmResourceRead< + TopicRecord, + Error = ResourceProviderDefaultErrorResponse + >; + + /** + * Create confluent topics by Name + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + create is TopicRecordsOps.CreateOrUpdateSync< + TopicRecord, + OptionalRequestBody = true + >; + + /** + * Delete confluent topic by name + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + delete is ArmResourceDeleteWithoutOkAsync; + + /** + * Lists of all the topics in a clusters + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + list is ArmResourceListByParent< + TopicRecord, + Parameters = { + /** + * Pagination size + */ + @query("pageSize") + pageSize?: int32; + + /** + * An opaque pagination token to fetch the next set of records + */ + @query("pageToken") + pageToken?: string; + }, + Response = ArmResponse, + Error = ResourceProviderDefaultErrorResponse + >; +} + +@@doc(TopicRecord.name, "Confluent kafka or schema registry topic name"); +@@doc(TopicRecord.properties, "Topic Properties"); +@@doc(TopicRecords.create::parameters.resource, + "Confluent Topics resource model" +); diff --git a/packages/typespec-test/test/Confluent.Management/spec/back-compatible.tsp b/packages/typespec-test/test/Confluent.Management/spec/back-compatible.tsp new file mode 100644 index 0000000000..839a87b408 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/back-compatible.tsp @@ -0,0 +1,125 @@ +import "@azure-tools/typespec-client-generator-core"; + +using Azure.ClientGenerator.Core; +using Microsoft.Confluent; + +// @@clientLocation decorators for @operationId operations +// Operations interface +@@clientLocation(Operations.list, "OrganizationOperations"); + +// OrganizationResourceAPIKeyActions interface +@@clientLocation(OrganizationResourceAPIKeyActions.getClusterAPIKey, + "Organization" +); +@@clientName(OrganizationResourceAPIKeyActions.getClusterAPIKey, + "GetClusterAPIKey" +); +@@clientLocation(OrganizationResourceAPIKeyActions.deleteClusterAPIKey, + "Organization" +); +@@clientName(OrganizationResourceAPIKeyActions.deleteClusterAPIKey, + "DeleteClusterAPIKey" +); +// OrganizationResourceRoleBindingIdActions interface +@@clientLocation(OrganizationResourceRoleBindingIdActions.deleteRoleBinding, + "Access" +); + +// OrganizationResources interface +@@clientLocation(OrganizationResources.get, "Organization"); +@@clientLocation(OrganizationResources.create, "Organization"); +@@clientLocation(OrganizationResources.update, "Organization"); +@@clientLocation(OrganizationResources.delete, "Organization"); +@@clientLocation(OrganizationResources.listByResourceGroup, "Organization"); +@@clientLocation(OrganizationResources.listBySubscription, "Organization"); +@@clientLocation(OrganizationResources.listRegions, "Organization"); +@@clientLocation(OrganizationResources.listUsers, "Access"); +@@clientLocation(OrganizationResources.listServiceAccounts, "Access"); +@@clientLocation(OrganizationResources.listInvitations, "Access"); +@@clientLocation(OrganizationResources.inviteUser, "Access"); +@@clientLocation(OrganizationResources.listEnvironments, "Access"); +@@clientLocation(OrganizationResources.listClusters, "Access"); +@@clientLocation(OrganizationResources.listRoleBindings, "Access"); +@@clientLocation(OrganizationResources.createRoleBinding, "Access"); +@@clientLocation(OrganizationResources.listRoleBindingNameList, "Access"); + +// ConnectorResources interface +@@clientLocation(ConnectorResources.get, "Connector"); +@@clientLocation(ConnectorResources.createOrUpdate, "Connector"); +@@clientLocation(ConnectorResources.delete, "Connector"); +@@clientLocation(ConnectorResources.list, "Connector"); + +// MarketplaceAgreementsOperationGroup interface +@@clientLocation(MarketplaceAgreementsOperationGroup.list, + "MarketplaceAgreements" +); +@@clientLocation(MarketplaceAgreementsOperationGroup.create, + "MarketplaceAgreements" +); + +// ValidationsOperationGroup interface +@@clientLocation(ValidationsOperationGroup.validateOrganization, "Validations"); +@@clientLocation(ValidationsOperationGroup.validateOrganizationV2, + "Validations" +); + +// SCClusterRecords interface +@@clientLocation(SCClusterRecords.getClusterById, "Organization"); +@@clientLocation(SCClusterRecords.createOrUpdate, "Cluster"); +@@clientLocation(SCClusterRecords.delete, "Cluster"); +@@clientLocation(SCClusterRecords.listClusters, "Organization"); +@@clientLocation(SCClusterRecords.createAPIKey, "Organization"); +@@clientName(SCClusterRecords.createAPIKey, "CreateApiKey"); + +// SCEnvironmentRecords interface +@@clientLocation(SCEnvironmentRecords.getEnvironmentById, "Organization"); +@@clientLocation(SCEnvironmentRecords.createOrUpdate, "Environment"); +@@clientLocation(SCEnvironmentRecords.delete, "Environment"); +@@clientLocation(SCEnvironmentRecords.listEnvironments, "Organization"); +@@clientLocation(SCEnvironmentRecords.listSchemaRegistryClusters, + "Organization" +); + +// SCEnvironmentRecordCluster interface +@@clientLocation(SCEnvironmentRecordCluster.getSchemaRegistryClusterById, + "Organization" +); + +// TopicRecords interface +@@clientLocation(TopicRecords.get, "Topics"); +@@clientLocation(TopicRecords.create, "Topics"); +@@clientLocation(TopicRecords.delete, "Topics"); +@@clientLocation(TopicRecords.list, "Topics"); + +#suppress "deprecated" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +@@flattenProperty(ConfluentAgreementResource.properties); + +#suppress "deprecated" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +@@flattenProperty(SchemaRegistryClusterRecord.properties); + +#suppress "deprecated" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +@@flattenProperty(RegionRecord.properties); + +#suppress "deprecated" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +@@flattenProperty(APIKeyRecord.properties); + +@@clientName(OrganizationResources.create::parameters.resource, "body"); +@@clientName(OrganizationResources.update::parameters.properties, "body"); +#suppress "deprecated" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +@@flattenProperty(OrganizationResource.properties); + +@@clientName(SCEnvironmentRecords.createOrUpdate::parameters.resource, "body"); +#suppress "deprecated" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +@@flattenProperty(SCEnvironmentRecord.properties); + +@@clientName(SCClusterRecords.createOrUpdate::parameters.resource, "body"); +#suppress "deprecated" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +@@flattenProperty(SCClusterRecord.properties); + +@@clientName(ConnectorResources.createOrUpdate::parameters.resource, "body"); +#suppress "deprecated" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +@@flattenProperty(ConnectorResource.properties); + +@@clientName(TopicRecords.create::parameters.resource, "body"); +#suppress "deprecated" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +@@flattenProperty(TopicRecord.properties); diff --git a/packages/typespec-test/test/Confluent.Management/spec/client.tsp b/packages/typespec-test/test/Confluent.Management/spec/client.tsp new file mode 100644 index 0000000000..88849414c0 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/client.tsp @@ -0,0 +1,42 @@ +import "@azure-tools/typespec-client-generator-core"; +import "./main.tsp"; +using Azure.ClientGenerator.Core; + +@@clientName(Microsoft.Confluent, "ConfluentManagementClient", "javascript"); +// Added Java Configuration to pass specs CI check. +// Need to revisit before SDK release. +@@clientName(Microsoft.Confluent.APIKeyResourceEntity, + "ApiKeyResourceEntity", + "java" +); +@@clientName(Microsoft.Confluent.APIKeyOwnerEntity, + "ApiKeyOwnerEntity", + "java" +); +@@clientName(Microsoft.Confluent.CreateAPIKeyModel, + "CreateApiKeyModel", + "java" +); +@@clientName(Microsoft.Confluent.APIKeySpecEntity, "ApiKeySpecEntity", "java"); +@@clientName(Microsoft.Confluent.APIKeyProperties, "ApiKeyProperties", "java"); +@@clientName(Microsoft.Confluent.APIKeyRecord, "ApiKeyRecord", "java"); +@@clientName(Microsoft.Confluent.OrganizationResourceAPIKeyActions.getClusterAPIKey, + "getClusterApiKey", + "java" +); +@@clientName(Microsoft.Confluent.OrganizationResourceAPIKeyActions.deleteClusterAPIKey, + "deleteClusterApiKey", + "java" +); +@@clientName(Microsoft.Confluent.SCClusterRecords.createAPIKey, + "createApiKey", + "java" +); +@@clientLocation(Microsoft.Confluent.OrganizationResourceAPIKeyActions.getClusterAPIKey, + "OrganizationResourceApiKeyActions", + "java" +); +@@clientLocation(Microsoft.Confluent.OrganizationResourceAPIKeyActions.deleteClusterAPIKey, + "OrganizationResourceApiKeyActions", + "java" +); diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Access_ClusterList.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Access_ClusterList.json new file mode 100644 index 0000000000..041d26c2f1 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Access_ClusterList.json @@ -0,0 +1,77 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "body": { + "searchFilters": { + "pageSize": "10", + "pageToken": "asc4fts4ft" + } + }, + "environment": "env-00000", + "organizationName": "myOrganization", + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": { + "body": { + "data": [ + { + "id": "dlz-f3a90de", + "kind": "Cluster", + "metadata": { + "created_at": "2006-01-02T15:04:05-07:00", + "deleted_at": "2006-01-02T15:04:05-07:00", + "resource_name": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/environment=env-abc123/cloud-cluster=lkc-12345", + "self": "https://api.confluent.cloud/cmk/v2/clusters/lkc-12345", + "updated_at": "2006-01-02T15:04:05-07:00" + }, + "spec": { + "api_endpoint": "https://pkac-00000.us-west-2.aws.confluent.cloud", + "availability": "SINGLE_ZONE", + "byok": { + "id": "cck-00000", + "related": "https://api.confluent.cloud/byok/v1/keys/cck-00000", + "resource_name": "https://api.confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/key=cck-00000" + }, + "cloud": "GCP", + "config": { + "kind": "Basic" + }, + "display_name": "ProdKafkaCluster", + "environment": { + "environment": "string", + "id": "env-00000", + "related": "https://api.confluent.cloud/v2/environments/env-00000", + "resource_name": "https://api.confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/environment=env-00000" + }, + "http_endpoint": "https://lkc-00000-00000.us-central1.gcp.glb.confluent.cloud", + "kafka_bootstrap_endpoint": "lkc-00000-00000.us-central1.gcp.glb.confluent.cloud:9092", + "network": { + "environment": "string", + "id": "n-00000", + "related": "https://api.confluent.cloud/networking/v1/networks/n-00000", + "resource_name": "https://api.confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/environment=env-abc123/network=n-00000" + }, + "region": "us-east4" + }, + "status": { + "cku": 2, + "phase": "PROVISIONED" + } + } + ], + "kind": "ClusterList", + "metadata": { + "first": "https://api.confluent.cloud/cmk/v2/clusters", + "last": "https://api.confluent.cloud/cmk/v2/clusters?page_token=bcAOehAY8F16YD84Z1wT", + "next": "https://api.confluent.cloud/cmk/v2/clusters?page_token=UvmDWOB1iwfAIBPj6EYb", + "prev": "https://api.confluent.cloud/cmk/v2/clusters?page_token=YIXRY97wWYmwzrax4dld", + "total_size": 123 + } + } + } + }, + "operationId": "Access_ListClusters", + "title": "Access_ClusterList" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Access_CreateRoleBinding.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Access_CreateRoleBinding.json new file mode 100644 index 0000000000..290038b3b3 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Access_CreateRoleBinding.json @@ -0,0 +1,33 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "body": { + "crn_pattern": "crn://confluent.cloud/organization=1111aaaa-11aa-11aa-11aa-111111aaaaaa/environment=env-aaa1111/cloud-cluster=lkc-1111aaa", + "principal": "User:u-111aaa", + "role_name": "CloudClusterAdmin" + }, + "organizationName": "myOrganization", + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": { + "body": { + "crn_pattern": "crn://confluent.cloud/organization=1111aaaa-11aa-11aa-11aa-111111aaaaaa/environment=env-aaa1111/cloud-cluster=lkc-1111aaa", + "id": "dlz-f3a90de", + "kind": "RoleBinding", + "metadata": { + "created_at": "2006-01-02T15:04:05-07:00", + "deleted_at": "2006-01-02T15:04:05-07:00", + "resource_name": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/role-binding=rb-12345", + "self": "https://api.confluent.cloud/iam/v2/role-bindings/rb-12345", + "updated_at": "2006-01-02T15:04:05-07:00" + }, + "principal": "User:u-111aaa", + "role_name": "CloudClusterAdmin" + } + } + }, + "operationId": "Access_CreateRoleBinding", + "title": "Access_CreateRoleBinding" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Access_DeleteRoleBinding.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Access_DeleteRoleBinding.json new file mode 100644 index 0000000000..a2afe0324c --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Access_DeleteRoleBinding.json @@ -0,0 +1,15 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "organizationName": "myOrganization", + "resourceGroupName": "myResourceGroup", + "roleBindingId": "dlz-f3a90de", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": {}, + "204": {} + }, + "operationId": "Access_DeleteRoleBinding", + "title": "Access_DeleteRoleBinding" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Access_EnvironmentList.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Access_EnvironmentList.json new file mode 100644 index 0000000000..0ebc2a1298 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Access_EnvironmentList.json @@ -0,0 +1,44 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "body": { + "searchFilters": { + "pageSize": "10", + "pageToken": "asc4fts4ft" + } + }, + "organizationName": "myOrganization", + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": { + "body": { + "data": [ + { + "display_name": "prod-finance01", + "id": "dlz-f3a90de", + "kind": "Environment", + "metadata": { + "created_at": "2006-01-02T15:04:05-07:00", + "deleted_at": "2006-01-02T15:04:05-07:00", + "resource_name": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/environment=e-12345", + "self": "https://api.confluent.cloud/org/v2/environments/e-12345", + "updated_at": "2006-01-02T15:04:05-07:00" + } + } + ], + "kind": "EnvironmentList", + "metadata": { + "first": "https://api.confluent.cloud/org/v2/environments", + "last": "https://api.confluent.cloud/org/v2/environments?page_token=bcAOehAY8F16YD84Z1wT", + "next": "https://api.confluent.cloud/org/v2/environments?page_token=UvmDWOB1iwfAIBPj6EYb", + "prev": "https://api.confluent.cloud/org/v2/environments?page_token=YIXRY97wWYmwzrax4dld", + "total_size": 123 + } + } + } + }, + "operationId": "Access_ListEnvironments", + "title": "Access_EnvironmentList" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Access_InvitationsList.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Access_InvitationsList.json new file mode 100644 index 0000000000..f4f88498bf --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Access_InvitationsList.json @@ -0,0 +1,49 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "body": { + "searchFilters": { + "pageSize": "10", + "pageToken": "asc4fts4ft", + "status": "INVITE_STATUS_SENT" + } + }, + "organizationName": "myOrganization", + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": { + "body": { + "data": [ + { + "accepted_at": "2022-07-06T17:21:33Z", + "auth_type": "AUTH_TYPE_SSO", + "email": "johndoe@confluent.io", + "expires_at": "2022-07-07T17:22:39Z", + "id": "dlz-f3a90de", + "kind": "Invitation", + "metadata": { + "created_at": "2006-01-02T15:04:05-07:00", + "deleted_at": "2006-01-02T15:04:05-07:00", + "resource_name": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/invitation=i-12345", + "self": "https://api.confluent.cloud/iam/v2/invitations/i-12345", + "updated_at": "2006-01-02T15:04:05-07:00" + }, + "status": "INVITE_STATUS_SENT" + } + ], + "kind": "InvitationList", + "metadata": { + "first": "https://api.confluent.cloud/iam/v2/invitations", + "last": "https://api.confluent.cloud/iam/v2/invitations?page_token=bcAOehAY8F16YD84Z1wT", + "next": "https://api.confluent.cloud/iam/v2/invitations?page_token=UvmDWOB1iwfAIBPj6EYb", + "prev": "https://api.confluent.cloud/iam/v2/invitations?page_token=YIXRY97wWYmwzrax4dld", + "total_size": 123 + } + } + } + }, + "operationId": "Access_ListInvitations", + "title": "Access_InvitationsList" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Access_InviteUser.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Access_InviteUser.json new file mode 100644 index 0000000000..40059a5a4a --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Access_InviteUser.json @@ -0,0 +1,36 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "body": { + "invitedUserDetails": { + "auth_type": "AUTH_TYPE_SSO", + "invitedEmail": "user2@onmicrosoft.com" + } + }, + "organizationName": "myOrganization", + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": { + "body": { + "accepted_at": "2022-07-06T17:21:33Z", + "auth_type": "AUTH_TYPE_SSO", + "email": "johndoe@confluent.io", + "expires_at": "2022-07-07T17:22:39Z", + "id": "dlz-f3a90de", + "kind": "Invitation", + "metadata": { + "created_at": "2006-01-02T15:04:05-07:00", + "deleted_at": "2006-01-02T15:04:05-07:00", + "resource_name": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/invitation=i-12345", + "self": "https://api.confluent.cloud/iam/v2/invitations/i-12345", + "updated_at": "2006-01-02T15:04:05-07:00" + }, + "status": "INVITE_STATUS_SENT" + } + } + }, + "operationId": "Access_InviteUser", + "title": "Access_InviteUser" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Access_RoleBindingList.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Access_RoleBindingList.json new file mode 100644 index 0000000000..88794421b4 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Access_RoleBindingList.json @@ -0,0 +1,48 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "body": { + "searchFilters": { + "pageSize": "10", + "pageToken": "asc4fts4ft" + } + }, + "crn_pattern": "crn://confluent.cloud/organization=1111aaaa-11aa-11aa-11aa-111111aaaaaa/environment=env-aaa1111/cloud-cluster=lkc-1111aaa", + "organizationName": "myOrganization", + "principal": "User:u-111aaa", + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": { + "body": { + "data": [ + { + "crn_pattern": "crn://confluent.cloud/organization=1111aaaa-11aa-11aa-11aa-111111aaaaaa/environment=env-aaa1111/cloud-cluster=lkc-1111aaa", + "id": "dlz-f3a90de", + "kind": "RoleBinding", + "metadata": { + "created_at": "2006-01-02T15:04:05-07:00", + "deleted_at": "2006-01-02T15:04:05-07:00", + "resource_name": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/role-binding=rb-12345", + "self": "https://api.confluent.cloud/iam/v2/role-bindings/rb-12345", + "updated_at": "2006-01-02T15:04:05-07:00" + }, + "principal": "User:u-111aaa", + "role_name": "CloudClusterAdmin" + } + ], + "kind": "RoleBindingList", + "metadata": { + "first": "https://api.confluent.cloud/iam/v2/role-bindings", + "last": "https://api.confluent.cloud/iam/v2/role-bindings?page_token=bcAOehAY8F16YD84Z1wT", + "next": "https://api.confluent.cloud/iam/v2/role-bindings?page_token=UvmDWOB1iwfAIBPj6EYb", + "prev": "https://api.confluent.cloud/iam/v2/role-bindings?page_token=YIXRY97wWYmwzrax4dld", + "total_size": 123 + } + } + } + }, + "operationId": "Access_ListRoleBindings", + "title": "Access_RoleBindingList" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Access_RoleBindingNameList.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Access_RoleBindingNameList.json new file mode 100644 index 0000000000..208e749891 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Access_RoleBindingNameList.json @@ -0,0 +1,38 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "body": { + "searchFilters": { + "crn_pattern": "crn://confluent.cloud/organization=1aa7de07-298e-479c-8f2f-16ac91fd8e76", + "namespace": "public,dataplane,networking,identity,datagovernance,connect,streamcatalog,pipelines,ksql" + } + }, + "organizationName": "myOrganization", + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": { + "body": { + "data": [ + "MetricsViewer", + "OrganizationAdmin", + "Operator", + "NetworkAdmin", + "ResourceKeyAdmin", + "AccountAdmin" + ], + "kind": "RoleDisplayNameList", + "metadata": { + "first": "https://api.confluent.cloud/iam/v2/role-bindings", + "last": "https://api.confluent.cloud/iam/v2/role-bindings?page_token=bcAOehAY8F16YD84Z1wT", + "next": "https://api.confluent.cloud/iam/v2/role-bindings?page_token=UvmDWOB1iwfAIBPj6EYb", + "prev": "https://api.confluent.cloud/iam/v2/role-bindings?page_token=YIXRY97wWYmwzrax4dld", + "total_size": 123 + } + } + } + }, + "operationId": "Access_ListRoleBindingNameList", + "title": "Access_RoleBindingNameList" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Access_ServiceAccountsList.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Access_ServiceAccountsList.json new file mode 100644 index 0000000000..cd4b4769be --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Access_ServiceAccountsList.json @@ -0,0 +1,45 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "body": { + "searchFilters": { + "pageSize": "10", + "pageToken": "asc4fts4ft" + } + }, + "organizationName": "myOrganization", + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": { + "body": { + "data": [ + { + "description": "Doc's repair bot for the DeLorean", + "display_name": "DeLorean_auto_repair", + "id": "dlz-f3a90de", + "kind": "ServiceAccount", + "metadata": { + "created_at": "2006-01-02T15:04:05-07:00", + "deleted_at": "2006-01-02T15:04:05-07:00", + "resource_name": "crn://confluent.cloud/service-account=sa-12345", + "self": "https://api.confluent.cloud/iam/v2/service-accounts/sa-12345", + "updated_at": "2006-01-02T15:04:05-07:00" + } + } + ], + "kind": "ServiceAccountList", + "metadata": { + "first": "https://api.confluent.cloud/iam/v2/service-accounts", + "last": "https://api.confluent.cloud/iam/v2/service-accounts?page_token=bcAOehAY8F16YD84Z1wT", + "next": "https://api.confluent.cloud/iam/v2/service-accounts?page_token=UvmDWOB1iwfAIBPj6EYb", + "prev": "https://api.confluent.cloud/iam/v2/service-accounts?page_token=YIXRY97wWYmwzrax4dld", + "total_size": 123 + } + } + } + }, + "operationId": "Access_ListServiceAccounts", + "title": "Access_ServiceAccountsList" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Access_UsersList.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Access_UsersList.json new file mode 100644 index 0000000000..954ea94da2 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Access_UsersList.json @@ -0,0 +1,46 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "body": { + "searchFilters": { + "pageSize": "10", + "pageToken": "asc4fts4ft" + } + }, + "organizationName": "myOrganization", + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": { + "body": { + "data": [ + { + "auth_type": "AUTH_TYPE_SSO", + "email": "marty.mcfly@example.com", + "full_name": "Marty McFly", + "id": "dlz-f3a90de", + "kind": "User", + "metadata": { + "created_at": "2006-01-02T15:04:05-07:00", + "deleted_at": "2006-01-02T15:04:05-07:00", + "resource_name": "crn://confluent.cloud/user=u-12345", + "self": "https://api.confluent.cloud/iam/v2/users/u-12345", + "updated_at": "2006-01-02T15:04:05-07:00" + } + } + ], + "kind": "UserList", + "metadata": { + "first": "https://api.confluent.cloud/iam/v2/users", + "last": "https://api.confluent.cloud/iam/v2/users?page_token=bcAOehAY8F16YD84Z1wT", + "next": "https://api.confluent.cloud/iam/v2/users?page_token=UvmDWOB1iwfAIBPj6EYb", + "prev": "https://api.confluent.cloud/iam/v2/users?page_token=YIXRY97wWYmwzrax4dld", + "total_size": 123 + } + } + } + }, + "operationId": "Access_ListUsers", + "title": "Access_UsersList" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Cluster_Create.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Cluster_Create.json new file mode 100644 index 0000000000..64f19810bb --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Cluster_Create.json @@ -0,0 +1,123 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "body": { + "properties": { + "spec": { + "environment": { + "id": "env-1" + }, + "package": "ESSENTIALS", + "region": "us-east4" + } + } + }, + "clusterId": "cluster-1", + "environmentId": "env-1", + "organizationName": "myOrganization", + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": { + "body": { + "name": "cluster-1", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Confluent/organizations/myOrganization/environments/env-1/clusters/cluster-1", + "kind": "Cluster", + "properties": { + "metadata": { + "createdTimestamp": "2006-01-02T15:04:05-07:00", + "deletedTimestamp": "2006-01-02T15:04:05-07:00", + "resourceName": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/environment=env-abc123/cloud-cluster=lkc-12345", + "self": "https://api.confluent.cloud/cmk/v2/clusters/lkc-12345", + "updatedTimestamp": "2006-01-02T15:04:05-07:00" + }, + "spec": { + "name": "ProdKafkaCluster", + "apiEndpoint": "https://pkac-00000.us-west-2.aws.confluent.cloud", + "availability": "SINGLE_ZONE", + "byok": { + "id": "cck-00000", + "related": "https://api.confluent.cloud/byok/v1/keys/cck-00000", + "resourceName": "https://api.confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/key=cck-00000" + }, + "cloud": "GCP", + "config": { + "kind": "Basic" + }, + "environment": { + "environment": "string", + "id": "env-00000", + "related": "https://api.confluent.cloud/v2/environments/env-00000", + "resourceName": "https://api.confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/environment=env-00000" + }, + "httpEndpoint": "https://lkc-00000-00000.us-central1.gcp.glb.confluent.cloud", + "kafkaBootstrapEndpoint": "lkc-00000-00000.us-central1.gcp.glb.confluent.cloud:9092", + "network": { + "environment": "string", + "id": "n-00000", + "related": "https://api.confluent.cloud/networking/v1/networks/n-00000", + "resourceName": "https://api.confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/environment=env-abc123/network=n-00000" + }, + "region": "us-east4" + }, + "status": { + "cku": 2, + "phase": "PROVISIONED" + } + } + } + }, + "201": { + "body": { + "name": "cluster-1", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Confluent/organizations/myOrganization/environments/env-1/clusters/cluster-1", + "kind": "Cluster", + "properties": { + "metadata": { + "createdTimestamp": "2006-01-02T15:04:05-07:00", + "deletedTimestamp": "2006-01-02T15:04:05-07:00", + "resourceName": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/environment=env-abc123/cloud-cluster=lkc-12345", + "self": "https://api.confluent.cloud/cmk/v2/clusters/lkc-12345", + "updatedTimestamp": "2006-01-02T15:04:05-07:00" + }, + "spec": { + "name": "ProdKafkaCluster", + "apiEndpoint": "https://pkac-00000.us-west-2.aws.confluent.cloud", + "availability": "SINGLE_ZONE", + "byok": { + "id": "cck-00000", + "related": "https://api.confluent.cloud/byok/v1/keys/cck-00000", + "resourceName": "https://api.confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/key=cck-00000" + }, + "cloud": "GCP", + "config": { + "kind": "Basic" + }, + "environment": { + "environment": "string", + "id": "env-00000", + "related": "https://api.confluent.cloud/v2/environments/env-00000", + "resourceName": "https://api.confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/environment=env-00000" + }, + "httpEndpoint": "https://lkc-00000-00000.us-central1.gcp.glb.confluent.cloud", + "kafkaBootstrapEndpoint": "lkc-00000-00000.us-central1.gcp.glb.confluent.cloud:9092", + "network": { + "environment": "string", + "id": "n-00000", + "related": "https://api.confluent.cloud/networking/v1/networks/n-00000", + "resourceName": "https://api.confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/environment=env-abc123/network=n-00000" + }, + "region": "us-east4" + }, + "status": { + "cku": 2, + "phase": "PROVISIONED" + } + } + } + } + }, + "operationId": "Cluster_CreateOrUpdate", + "title": "Cluster_CreateOrUpdate" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Cluster_Delete.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Cluster_Delete.json new file mode 100644 index 0000000000..5e83b410a9 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Cluster_Delete.json @@ -0,0 +1,24 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "clusterId": "dlz-f3a90de", + "environmentId": "env-12132", + "organizationName": "myOrganization", + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "202": { + "headers": { + "azure-AsyncOperation": "http://azure.async.operation/status" + } + }, + "204": { + "headers": { + "azure-AsyncOperation": "http://azure.async.operation/status" + } + } + }, + "operationId": "Cluster_Delete", + "title": "Cluster_Delete" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Environment_Create.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Environment_Create.json new file mode 100644 index 0000000000..c4dd67b26e --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Environment_Create.json @@ -0,0 +1,58 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "body": { + "properties": { + "streamGovernanceConfig": { + "package": "ESSENTIALS" + } + } + }, + "environmentId": "env-1", + "organizationName": "myOrganization", + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": { + "body": { + "name": "env-1", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Confluent/organizations/myOrganization/environments/env-1", + "kind": "Environment", + "properties": { + "metadata": { + "createdTimestamp": "2006-01-02T15:04:05-07:00", + "deletedTimestamp": "2006-01-02T15:04:05-07:00", + "resourceName": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/environment=env-1", + "self": "https://api.confluent.cloud/org/v2/environments/env-1", + "updatedTimestamp": "2006-01-02T15:04:05-07:00" + }, + "streamGovernanceConfig": { + "package": "ESSENTIALS" + } + } + } + }, + "201": { + "body": { + "name": "env-1", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Confluent/organizations/myOrganization/environments/env-1", + "kind": "Environment", + "properties": { + "metadata": { + "createdTimestamp": "2006-01-02T15:04:05-07:00", + "deletedTimestamp": "2006-01-02T15:04:05-07:00", + "resourceName": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/environment=env-1", + "self": "https://api.confluent.cloud/org/v2/environments/env-1", + "updatedTimestamp": "2006-01-02T15:04:05-07:00" + }, + "streamGovernanceConfig": { + "package": "ESSENTIALS" + } + } + } + } + }, + "operationId": "Environment_CreateOrUpdate", + "title": "Environment_CreateOrUpdate" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Environment_Delete.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Environment_Delete.json new file mode 100644 index 0000000000..f92d34a2fd --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Environment_Delete.json @@ -0,0 +1,23 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "environmentId": "env-12132", + "organizationName": "myOrganization", + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "202": { + "headers": { + "azure-AsyncOperation": "http://azure.async.operation/status" + } + }, + "204": { + "headers": { + "azure-AsyncOperation": "http://azure.async.operation/status" + } + } + }, + "operationId": "Environment_Delete", + "title": "Environment_Delete" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/MarketplaceAgreements_Create.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/MarketplaceAgreements_Create.json new file mode 100644 index 0000000000..12d5d61876 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/MarketplaceAgreements_Create.json @@ -0,0 +1,40 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "requestBody": { + "properties": { + "accepted": true + } + }, + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": { + "body": { + "name": "default", + "type": "Microsoft.Confluent/agreements", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Confluent/agreements/default", + "properties": { + "accepted": true, + "licenseTextLink": "test.licenseLink1", + "plan": "planid1", + "privacyPolicyLink": "test.privacyPolicyLink1", + "product": "offid1", + "publisher": "pubid1", + "retrieveDatetime": "2020-11-05T17:33:07.12132Z", + "signature": "YKWOQOKH2BCKZ46O7SCKHANWEENRFRU5WB4LXDFUYWCBWTS4AG4SGQXCOZYIR5ZJCZTXRMZKYZMO2BJSL5YKPLAR4LBFRUNS6CRYE7A" + }, + "systemData": { + "createdAt": "2020-05-09T14:28:47.284Z", + "createdBy": "string", + "createdByType": "User", + "lastModifiedAt": "2020-05-09T14:28:47.284Z", + "lastModifiedBy": "string", + "lastModifiedByType": "User" + } + } + } + }, + "operationId": "MarketplaceAgreements_Create", + "title": "MarketplaceAgreements_Create" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/MarketplaceAgreements_List.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/MarketplaceAgreements_List.json new file mode 100644 index 0000000000..960b8fc5db --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/MarketplaceAgreements_List.json @@ -0,0 +1,47 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": { + "body": { + "nextLink": null, + "value": [ + { + "name": "planid1", + "type": "Microsoft.Confluent/agreements", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Confluent/agreements/default", + "properties": { + "accepted": true, + "licenseTextLink": "test.licenseLink1", + "plan": "planid1", + "privacyPolicyLink": "test.privacyPolicyLink1", + "product": "offid1", + "publisher": "pubid1", + "retrieveDatetime": "2017-08-15T11:33:07.12132Z", + "signature": "ASDFSDAFWEFASDGWERLWER" + } + }, + { + "name": "planid2", + "type": "Microsoft.MarketplaceOrdering/offertypes", + "id": "id2", + "properties": { + "accepted": true, + "licenseTextLink": "test.licenseLin2k", + "plan": "planid2", + "privacyPolicyLink": "test.privacyPolicyLink2", + "product": "offid2", + "publisher": "pubid2", + "retrieveDatetime": "2017-08-14T11:33:07.12132Z", + "signature": "ASDFSDAFWEFASDGWERLWER" + } + } + ] + } + } + }, + "operationId": "MarketplaceAgreements_List", + "title": "MarketplaceAgreements_List" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/OrganizationOperations_List.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/OrganizationOperations_List.json new file mode 100644 index 0000000000..20b249303c --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/OrganizationOperations_List.json @@ -0,0 +1,46 @@ +{ + "parameters": { + "api-version": "2024-07-01" + }, + "responses": { + "200": { + "body": { + "nextLink": null, + "value": [ + { + "name": "Microsoft.Confluent/organizations/Read", + "display": { + "description": "Read organization", + "operation": "Get/List organization resources", + "provider": "Microsoft.Confluent", + "resource": "organizations" + }, + "isDataAction": false + }, + { + "name": "Microsoft.Confluent/organizations/Write", + "display": { + "description": "Write organization", + "operation": "Create/Update organization resources", + "provider": "Microsoft.Confluent", + "resource": "organizations" + }, + "isDataAction": false + }, + { + "name": "Microsoft.Confluent/organizations/Delete", + "display": { + "description": "Delete organization", + "operation": "Delete organization resources", + "provider": "Microsoft.Confluent", + "resource": "organizations" + }, + "isDataAction": false + } + ] + } + } + }, + "operationId": "OrganizationOperations_List", + "title": "OrganizationOperations_List" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_ClusterList.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_ClusterList.json new file mode 100644 index 0000000000..b3bd2cf9d8 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_ClusterList.json @@ -0,0 +1,68 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "environmentId": "env-12132", + "organizationName": "myOrganization", + "pageSize": 10, + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": { + "body": { + "nextLink": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Confluent/organizations/myOrganization/environments/env-12132/clusters?api-version=2024-07-01&$count=10&$skipToken=xoi3753asdfe", + "value": [ + { + "name": "ProdKafkaCluster", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Confluent/organizations/myOrganization/environments/env-12132/clusters/ProdKafkaCluster", + "kind": "Cluster", + "properties": { + "metadata": { + "createdTimestamp": "2006-01-02T15:04:05-07:00", + "deletedTimestamp": "2006-01-02T15:04:05-07:00", + "resourceName": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/environment=env-abc123/cloud-cluster=lkc-12345", + "self": "https://api.confluent.cloud/cmk/v2/clusters/lkc-12345", + "updatedTimestamp": "2006-01-02T15:04:05-07:00" + }, + "spec": { + "name": "ProdKafkaCluster", + "apiEndpoint": "https://pkac-00000.us-west-2.aws.confluent.cloud", + "availability": "SINGLE_ZONE", + "byok": { + "id": "cck-00000", + "related": "https://api.confluent.cloud/byok/v1/keys/cck-00000", + "resourceName": "https://api.confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/key=cck-00000" + }, + "cloud": "GCP", + "config": { + "kind": "Basic" + }, + "environment": { + "environment": "string", + "id": "env-00000", + "related": "https://api.confluent.cloud/v2/environments/env-00000", + "resourceName": "https://api.confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/environment=env-00000" + }, + "httpEndpoint": "https://lkc-00000-00000.us-central1.gcp.glb.confluent.cloud", + "kafkaBootstrapEndpoint": "lkc-00000-00000.us-central1.gcp.glb.confluent.cloud:9092", + "network": { + "environment": "string", + "id": "n-00000", + "related": "https://api.confluent.cloud/networking/v1/networks/n-00000", + "resourceName": "https://api.confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/environment=env-abc123/network=n-00000" + }, + "region": "us-east4" + }, + "status": { + "cku": 2, + "phase": "PROVISIONED" + } + } + } + ] + } + } + }, + "operationId": "Organization_ListClusters", + "title": "Organization_ListClusters" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_ConnectorList.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_ConnectorList.json new file mode 100644 index 0000000000..4d40e8c804 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_ConnectorList.json @@ -0,0 +1,56 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "clusterId": "cluster-1", + "environmentId": "env-12132", + "organizationName": "myOrganization", + "pageSize": 10, + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": { + "body": { + "nextLink": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Confluent/organizations/myOrganization/environments/env-12132/clusters/cluster-1/connectors?api-version=2024-07-01&$count=10&$skipToken=xoi3753asdfe", + "value": [ + { + "name": "connector-1", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Confluent/organizations/myOrganization/environments/env-12132/clusters/cluster-1/connectors/connector-1", + "properties": { + "connectorBasicInfo": { + "connectorClass": "AZUREBLOBSINK", + "connectorId": "lcc-l", + "connectorName": "connector-1", + "connectorState": "RUNNING", + "connectorType": "SINK" + }, + "connectorServiceTypeInfo": { + "connectorServiceType": "AzureBlobStorageSinkConnector", + "storageAccountKey": "*******", + "storageAccountName": "stcfaccount-1", + "storageContainerName": "continer-1" + }, + "partnerConnectorInfo": { + "apiKey": "xxxxxxx", + "apiSecret": "*******", + "authType": "KAFKA_API_KEY", + "flushSize": "1000", + "inputFormat": "JSON", + "maxTasks": "2", + "outputFormat": "JSON", + "partnerConnectorType": "KafkaAzureBlobStorageSink", + "timeInterval": "DAILY", + "topics": [ + "topic-1" + ], + "topicsDir": "topicsDir" + } + } + } + ] + } + } + }, + "operationId": "Connector_List", + "title": "Connector_List" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_Create.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_Create.json new file mode 100644 index 0000000000..9fa87ac075 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_Create.json @@ -0,0 +1,121 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "body": { + "location": "West US", + "properties": { + "linkOrganization": { + "token": "string" + }, + "offerDetail": { + "id": "string", + "planId": "string", + "planName": "string", + "privateOfferId": "string", + "privateOfferIds": [ + "string" + ], + "publisherId": "string", + "termUnit": "string" + }, + "userDetail": { + "aadEmail": "contoso@microsoft.com", + "emailAddress": "contoso@microsoft.com", + "firstName": "string", + "lastName": "string", + "userPrincipalName": "contoso@microsoft.com" + } + }, + "tags": { + "Environment": "Dev" + } + }, + "organizationName": "myOrganization", + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": { + "body": { + "name": "myOrganization", + "type": "Microsoft.Confluent/organizations", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Confluent/organizations/myOrganization", + "location": "West US", + "properties": { + "createdTime": "2020-05-09T14:28:47.284Z", + "offerDetail": { + "id": "string", + "planId": "string", + "planName": "string", + "privateOfferId": "string", + "privateOfferIds": [ + "string" + ], + "publisherId": "string", + "status": "Started", + "termUnit": "string" + }, + "organizationId": "string", + "provisioningState": "Succeeded", + "ssoUrl": "string", + "userDetail": { + "aadEmail": "contoso@microsoft.com", + "emailAddress": "contoso@microsoft.com", + "firstName": "string", + "lastName": "string", + "userPrincipalName": "contoso@microsoft.com" + } + }, + "systemData": { + "createdAt": "2020-05-09T14:28:47.284Z", + "createdBy": "string", + "createdByType": "User", + "lastModifiedAt": "2020-05-09T14:28:47.284Z", + "lastModifiedBy": "string", + "lastModifiedByType": "User" + }, + "tags": { + "Environment": "Dev" + } + } + }, + "201": { + "body": { + "name": "myOrganization", + "type": "Microsoft.Confluent/organizations", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Confluent/organizations/myOrganization", + "location": "West US", + "properties": { + "createdTime": "2020-05-09T14:28:47.284Z", + "offerDetail": { + "id": "string", + "planId": "string", + "planName": "string", + "privateOfferId": "string", + "privateOfferIds": [ + "string" + ], + "publisherId": "string", + "status": "Started", + "termUnit": "string" + }, + "organizationId": "string", + "provisioningState": "Accepted", + "ssoUrl": "string", + "userDetail": { + "aadEmail": "contoso@microsoft.com", + "emailAddress": "contoso@microsoft.com", + "firstName": "string", + "lastName": "string", + "userPrincipalName": "contoso@microsoft.com" + } + }, + "tags": { + "Environment": "Dev" + } + } + } + }, + "operationId": "Organization_Create", + "title": "Organization_Create" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_CreateClusterAPIKey.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_CreateClusterAPIKey.json new file mode 100644 index 0000000000..b0ab1d3cc8 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_CreateClusterAPIKey.json @@ -0,0 +1,49 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "body": { + "name": "CI kafka access key", + "description": "This API key provides kafka access to cluster x" + }, + "clusterId": "clusterId-123", + "environmentId": "env-12132", + "organizationName": "myOrganization", + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": { + "body": { + "id": "JDCXTFUVFVQGF56J", + "kind": "ApiKey", + "properties": { + "metadata": { + "createdTimestamp": "2023-11-15T16:15:44.489498Z", + "resourceName": "crn://api.stag.cpdev.cloud/organization=37d1220b-93a6-43e3-a114-dd8a20a94a31/service-account=sa-wwn7mm/api-key=JDCXTFUVFVQGF56J", + "self": "https://api.stag.cpdev.cloud/iam/v2/api-keys/JDCXTFUVFVQGF56J", + "updatedTimestamp": "2023-11-15T16:15:44.489498Z" + }, + "spec": { + "name": "CI kafka access key", + "description": "This API key provides kafka access to cluster x", + "owner": { + "id": "sa-wwn7mm", + "kind": "ServiceAccount", + "related": "https://api.stag.cpdev.cloud/iam/v2/service-accounts/sa-wwn7mm", + "resourceName": "crn://api.stag.cpdev.cloud/organization=37d1220b-93a6-43e3-a114-dd8a20a94a31/service-account=sa-wwn7mm" + }, + "resource": { + "id": "lsrc-stgc1yrzz3", + "kind": "SchemaRegistry", + "related": "https://api.stag.cpdev.cloud/srcm/v2/schema-registries/lsrc-stgc1yrzz3", + "resourceName": "crn://api.stag.cpdev.cloud/organization=37d1220b-93a6-43e3-a114-dd8a20a94a31/schema-registry=lsrc-stgc1yrzz3" + }, + "secret": "" + } + } + } + } + }, + "operationId": "Organization_CreateAPIKey", + "title": "Organization_CreateClusterAPIKey" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_CreateConnectorByName.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_CreateConnectorByName.json new file mode 100644 index 0000000000..b313f96c18 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_CreateConnectorByName.json @@ -0,0 +1,119 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "body": { + "properties": { + "connectorBasicInfo": { + "connectorClass": "AZUREBLOBSTORAGESINK", + "connectorName": "connector-1", + "connectorType": "SINK" + }, + "connectorServiceTypeInfo": { + "connectorServiceType": "AzureBlobStorageSinkConnector", + "storageAccountKey": "*******", + "storageAccountName": "stcfaccount-1", + "storageContainerName": "continer-1" + }, + "partnerConnectorInfo": { + "apiKey": "xxxxxxx", + "apiSecret": "*******", + "authType": "KAFKA_API_KEY", + "flushSize": "1000", + "inputFormat": "JSON", + "maxTasks": "2", + "outputFormat": "JSON", + "partnerConnectorType": "KafkaAzureBlobStorageSink", + "timeInterval": "DAILY", + "topics": [ + "topic-1" + ], + "topicsDir": "topicsDir" + } + } + }, + "clusterId": "dlz-f3a90de", + "connectorName": "connector-1", + "environmentId": "env-12132", + "organizationName": "myOrganization", + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": { + "body": { + "name": "connector-1", + "type": "Microsoft.Confluent/organizations/environments/clusters/connectors", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Confluent/organizations/myOrganization/environments/env-12132/clusters/dlz-f3a90de/connectors/connector-1", + "properties": { + "connectorBasicInfo": { + "connectorClass": "AZUREBLOBSTORAGESINK", + "connectorId": "lcc-l", + "connectorName": "connector-1", + "connectorState": "RUNNING", + "connectorType": "SINK" + }, + "connectorServiceTypeInfo": { + "connectorServiceType": "AzureBlobStorageSinkConnector", + "storageAccountKey": "*******", + "storageAccountName": "stcfaccount-1", + "storageContainerName": "continer-1" + }, + "partnerConnectorInfo": { + "apiKey": "xxxxxxx", + "apiSecret": "*******", + "authType": "KAFKA_API_KEY", + "flushSize": "1000", + "inputFormat": "JSON", + "maxTasks": "2", + "outputFormat": "JSON", + "partnerConnectorType": "KafkaAzureBlobStorageSink", + "timeInterval": "DAILY", + "topics": [ + "topic-1" + ], + "topicsDir": "topicsDir" + } + } + } + }, + "201": { + "body": { + "name": "connector-1", + "type": "Microsoft.Confluent/organizations/environments/clusters/connectors", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Confluent/organizations/myOrganization/environments/env-12132/clusters/dlz-f3a90de/connectors/connector-1", + "properties": { + "connectorBasicInfo": { + "connectorClass": "AZUREBLOBSINK", + "connectorId": "lcc-l", + "connectorName": "connector-1", + "connectorState": "RUNNING", + "connectorType": "SINK" + }, + "connectorServiceTypeInfo": { + "connectorServiceType": "AzureBlobStorageSinkConnector", + "storageAccountKey": "*******", + "storageAccountName": "stcfaccount-1", + "storageContainerName": "continer-1" + }, + "partnerConnectorInfo": { + "apiKey": "xxxxxxx", + "apiSecret": "*******", + "authType": "KAFKA_API_KEY", + "flushSize": "1000", + "inputFormat": "JSON", + "maxTasks": "2", + "outputFormat": "JSON", + "partnerConnectorType": "KafkaAzureBlobStorageSink", + "timeInterval": "DAILY", + "topics": [ + "topic-1" + ], + "topicsDir": "topicsDir" + } + } + } + } + }, + "operationId": "Connector_CreateOrUpdate", + "title": "Connector_CreateOrUpdate" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_Delete.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_Delete.json new file mode 100644 index 0000000000..078b0a3668 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_Delete.json @@ -0,0 +1,27 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "organizationName": "myOrganization", + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": { + "headers": { + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Confluent/locations/eastus/operationStatuses/00000000-0000-0000-0000-000000000000?api-version=2023-02-09-preview" + } + }, + "202": { + "headers": { + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Confluent/locations/eastus/operationStatuses/00000000-0000-0000-0000-000000000000?api-version=2023-02-09-preview" + } + }, + "204": { + "headers": { + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Confluent/locations/eastus/operationStatuses/00000000-0000-0000-0000-000000000000?api-version=2023-02-09-preview" + } + } + }, + "operationId": "Organization_Delete", + "title": "Confluent_Delete" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_DeleteClusterAPIKey.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_DeleteClusterAPIKey.json new file mode 100644 index 0000000000..00a21b4ac2 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_DeleteClusterAPIKey.json @@ -0,0 +1,15 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "apiKeyId": "ZFZ6SZZZWGYBEIFB", + "organizationName": "myOrganization", + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": {}, + "204": {} + }, + "operationId": "Organization_DeleteClusterAPIKey", + "title": "Organization_DeleteClusterAPIKey" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_DeleteConnectorByName.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_DeleteConnectorByName.json new file mode 100644 index 0000000000..f5dd4dd423 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_DeleteConnectorByName.json @@ -0,0 +1,25 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "clusterId": "dlz-f3a90de", + "connectorName": "connector-1", + "environmentId": "env-12132", + "organizationName": "myOrganization", + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "202": { + "headers": { + "azure-AsyncOperation": "http://azure.async.operation/status" + } + }, + "204": { + "headers": { + "azure-AsyncOperation": "http://azure.async.operation/status" + } + } + }, + "operationId": "Connector_Delete", + "title": "Connector_Delete" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_EnvironmentList.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_EnvironmentList.json new file mode 100644 index 0000000000..ec6b773515 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_EnvironmentList.json @@ -0,0 +1,34 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "organizationName": "myOrganization", + "pageSize": 10, + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": { + "body": { + "nextLink": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Confluent/organizations/myOrganization/environments?api-version=2024-07-01&$count=10&$skipToken=xoi3753asdfe", + "value": [ + { + "name": "prod-finance01", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Confluent/organizations/myOrganization/environments/prod-finance01", + "kind": "Environment", + "properties": { + "metadata": { + "createdTimestamp": "2006-01-02T15:04:05-07:00", + "deletedTimestamp": "2006-01-02T15:04:05-07:00", + "resourceName": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/environment=e-12345", + "self": "https://api.confluent.cloud/org/v2/environments/e-12345", + "updatedTimestamp": "2006-01-02T15:04:05-07:00" + } + } + } + ] + } + } + }, + "operationId": "Organization_ListEnvironments", + "title": "Organization_ListEnvironments" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_Get.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_Get.json new file mode 100644 index 0000000000..9d06defe64 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_Get.json @@ -0,0 +1,56 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "organizationName": "myOrganization", + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": { + "body": { + "name": "myOrganization", + "type": "Microsoft.Confluent/organizations", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Confluent/organizations/myOrganization", + "location": "West US", + "properties": { + "createdTime": "2020-05-09T14:28:47.284Z", + "offerDetail": { + "id": "string", + "planId": "string", + "planName": "string", + "privateOfferId": "string", + "privateOfferIds": [ + "string" + ], + "publisherId": "string", + "status": "Started", + "termUnit": "string" + }, + "organizationId": "string", + "provisioningState": "Accepted", + "ssoUrl": "string", + "userDetail": { + "aadEmail": "contoso@microsoft.com", + "emailAddress": "contoso@microsoft.com", + "firstName": "string", + "lastName": "string", + "userPrincipalName": "contoso@microsoft.com" + } + }, + "systemData": { + "createdAt": "2020-05-09T14:28:47.284Z", + "createdBy": "string", + "createdByType": "User", + "lastModifiedAt": "2020-05-09T14:28:47.284Z", + "lastModifiedBy": "string", + "lastModifiedByType": "User" + }, + "tags": { + "Environment": "Dev" + } + } + } + }, + "operationId": "Organization_Get", + "title": "Organization_Get" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_GetClusterAPIKey.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_GetClusterAPIKey.json new file mode 100644 index 0000000000..9732c8e546 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_GetClusterAPIKey.json @@ -0,0 +1,44 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "apiKeyId": "apiKeyId-123", + "organizationName": "myOrganization", + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": { + "body": { + "id": "apiKeyId-123", + "kind": "ApiKey", + "properties": { + "metadata": { + "createdTimestamp": "2023-11-15T16:15:44.489498Z", + "resourceName": "crn://api.stag.cpdev.cloud/organization=37d1220b-93a6-43e3-a114-dd8a20a94a31/service-account=sa-wwn7mm/api-key=apiKeyId-123", + "self": "https://api.stag.cpdev.cloud/iam/v2/api-keys/apiKeyId-123", + "updatedTimestamp": "2023-11-15T16:15:44.489498Z" + }, + "spec": { + "name": "CI kafka access key", + "description": "This API key provides kafka access to cluster x", + "owner": { + "id": "sa-wwn7mm", + "kind": "ServiceAccount", + "related": "https://api.stag.cpdev.cloud/iam/v2/service-accounts/sa-wwn7mm", + "resourceName": "crn://api.stag.cpdev.cloud/organization=37d1220b-93a6-43e3-a114-dd8a20a94a31/service-account=sa-wwn7mm" + }, + "resource": { + "environment": "env-0000", + "id": "lsrc-stgc1yrzz3", + "kind": "SchemaRegistry", + "related": "https://api.stag.cpdev.cloud/srcm/v2/schema-registries/lsrc-stgc1yrzz3", + "resourceName": "crn://api.stag.cpdev.cloud/organization=37d1220b-93a6-43e3-a114-dd8a20a94a31/schema-registry=lsrc-stgc1yrzz3" + } + } + } + } + } + }, + "operationId": "Organization_GetClusterAPIKey", + "title": "Organization_GetClusterAPIKey" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_GetClusterById.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_GetClusterById.json new file mode 100644 index 0000000000..d65e95f0c7 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_GetClusterById.json @@ -0,0 +1,63 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "clusterId": "ProdKafkaCluster", + "environmentId": "env-12132", + "organizationName": "myOrganization", + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": { + "body": { + "name": "ProdKafkaCluster", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Confluent/organizations/myOrganization/environments/env-12132/clusters/ProdKafkaCluster", + "kind": "Cluster", + "properties": { + "metadata": { + "createdTimestamp": "2006-01-02T15:04:05-07:00", + "deletedTimestamp": "2006-01-02T15:04:05-07:00", + "resourceName": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/environment=env-abc123/cloud-cluster=lkc-12345", + "self": "https://api.confluent.cloud/cmk/v2/clusters/lkc-12345", + "updatedTimestamp": "2006-01-02T15:04:05-07:00" + }, + "spec": { + "name": "ProdKafkaCluster", + "apiEndpoint": "https://pkac-00000.us-west-2.aws.confluent.cloud", + "availability": "SINGLE_ZONE", + "byok": { + "id": "cck-00000", + "related": "https://api.confluent.cloud/byok/v1/keys/cck-00000", + "resourceName": "https://api.confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/key=cck-00000" + }, + "cloud": "GCP", + "config": { + "kind": "Basic" + }, + "environment": { + "environment": "string", + "id": "env-00000", + "related": "https://api.confluent.cloud/v2/environments/env-00000", + "resourceName": "https://api.confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/environment=env-00000" + }, + "httpEndpoint": "https://lkc-00000-00000.us-central1.gcp.glb.confluent.cloud", + "kafkaBootstrapEndpoint": "lkc-00000-00000.us-central1.gcp.glb.confluent.cloud:9092", + "network": { + "environment": "string", + "id": "n-00000", + "related": "https://api.confluent.cloud/networking/v1/networks/n-00000", + "resourceName": "https://api.confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/environment=env-abc123/network=n-00000" + }, + "region": "us-east4" + }, + "status": { + "cku": 2, + "phase": "PROVISIONED" + } + } + } + } + }, + "operationId": "Organization_GetClusterById", + "title": "Organization_GetClusterById" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_GetConnectorByName.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_GetConnectorByName.json new file mode 100644 index 0000000000..563b7e9568 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_GetConnectorByName.json @@ -0,0 +1,51 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "clusterId": "dlz-f3a90de", + "connectorName": "connector-1", + "environmentId": "env-12132", + "organizationName": "myOrganization", + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": { + "body": { + "name": "connector-1", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Confluent/organizations/myOrganization/environments/env-12132/clusters/dlz-f3a90de/connectors/connector-1", + "properties": { + "connectorBasicInfo": { + "connectorClass": "AZUREBLOBSTORAGESINK", + "connectorId": "lcc-l", + "connectorName": "connector-1", + "connectorState": "RUNNING", + "connectorType": "SINK" + }, + "connectorServiceTypeInfo": { + "connectorServiceType": "AzureBlobStorageSinkConnector", + "storageAccountKey": "*******", + "storageAccountName": "stcfaccount-1", + "storageContainerName": "continer-1" + }, + "partnerConnectorInfo": { + "apiKey": "xxxxxxx", + "apiSecret": "*******", + "authType": "KAFKA_API_KEY", + "flushSize": "1000", + "inputFormat": "JSON", + "maxTasks": "2", + "outputFormat": "JSON", + "partnerConnectorType": "KafkaAzureBlobStorageSink", + "timeInterval": "DAILY", + "topics": [ + "topic-1" + ], + "topicsDir": "topicsDir" + } + } + } + } + }, + "operationId": "Connector_Get", + "title": "Connector_Get" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_GetEnvironmentById.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_GetEnvironmentById.json new file mode 100644 index 0000000000..5ae04828ca --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_GetEnvironmentById.json @@ -0,0 +1,30 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "environmentId": "prod-finance01", + "organizationName": "myOrganization", + "pageSize": 10, + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": { + "body": { + "name": "prod-finance01", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Confluent/organizations/myOrganization/environments/prod-finance01", + "kind": "Environment", + "properties": { + "metadata": { + "createdTimestamp": "2006-01-02T15:04:05-07:00", + "deletedTimestamp": "2006-01-02T15:04:05-07:00", + "resourceName": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/environment=e-12345", + "self": "https://api.confluent.cloud/org/v2/environments/e-12345", + "updatedTimestamp": "2006-01-02T15:04:05-07:00" + } + } + } + } + }, + "operationId": "Organization_GetEnvironmentById", + "title": "Organization_GetEnvironmentById" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_GetSchemaRegistryClusterById.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_GetSchemaRegistryClusterById.json new file mode 100644 index 0000000000..846b011e16 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_GetSchemaRegistryClusterById.json @@ -0,0 +1,48 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "clusterId": "lsrc-stgczkq22z", + "environmentId": "env-stgcczjp2j3", + "organizationName": "myOrganization", + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": { + "body": { + "id": "lsrc-stgczkq22z", + "kind": "Cluster", + "properties": { + "metadata": { + "createdTimestamp": "2023-11-08T07:37:14.309386Z", + "deletedTimestamp": "2023-11-08T07:37:14.309386Z", + "resourceName": "crn://confluent.cloud/organization=37d1220b-93a6-43e3-a114-dd8a20a94a31/environment=env-stgccnk2mgd/schema-registry=lsrc-stgczkq22z", + "self": "https://api.stag.cpdev.cloud/srcm/v2/clusters/lsrc-stgczkq22z", + "updatedTimestamp": "2023-11-08T07:37:14.309386Z" + }, + "spec": { + "name": "Stream Governance Package", + "cloud": "GCP", + "environment": { + "id": "env-stgccnk2mgd", + "related": "https://api.stag.cpdev.cloud/org/v2/environments/env-stgccnk2mgd", + "resourceName": "crn://confluent.cloud/organization=37d1220b-93a6-43e3-a114-dd8a20a94a31/environment=env-stgccnk2mgd" + }, + "httpEndpoint": "https://psrc-57wzyg.centralus.azure.stag.cpdev.cloud", + "package": "ADVANCED", + "region": { + "id": "sgreg-7", + "related": "https://api.stag.cpdev.cloud/srcm/v2/regions/sgreg-7", + "resourceName": "crn://confluent.cloud/schema-registry-region=sgreg-7" + } + }, + "status": { + "phase": "PROVISIONED" + } + } + } + } + }, + "operationId": "Organization_GetSchemaRegistryClusterById", + "title": "Organization_GetSchemaRegistryClusterById" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_ListByResourceGroup.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_ListByResourceGroup.json new file mode 100644 index 0000000000..36da3149be --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_ListByResourceGroup.json @@ -0,0 +1,52 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": { + "body": { + "nextLink": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Confluent/organizations?api-version=2024-07-01&$count=2&$skipToken=fake-continuation-token-12345", + "value": [ + { + "name": "myOrganizations", + "type": "Microsoft.Confluent/organizations", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Confluent/organizations/myOrganizations", + "location": "West US", + "properties": { + "createdTime": "2020-05-09T14:28:47.284Z", + "offerDetail": { + "id": "string", + "planId": "string", + "planName": "string", + "privateOfferId": "string", + "privateOfferIds": [ + "string" + ], + "publisherId": "string", + "status": "Started", + "termUnit": "string" + }, + "organizationId": "string", + "provisioningState": "Accepted", + "ssoUrl": "string", + "userDetail": { + "aadEmail": "contoso@microsoft.com", + "emailAddress": "contoso@microsoft.com", + "firstName": "string", + "lastName": "string", + "userPrincipalName": "contoso@microsoft.com" + } + }, + "tags": { + "Environment": "Dev" + } + } + ] + } + } + }, + "operationId": "Organization_ListByResourceGroup", + "title": "Organization_ListByResourceGroup" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_ListBySubscription.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_ListBySubscription.json new file mode 100644 index 0000000000..8af8f1317d --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_ListBySubscription.json @@ -0,0 +1,51 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": { + "body": { + "nextLink": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Confluent/organizations?api-version=2024-07-01&$count=2&$skipToken=fake-continuation-token-12345", + "value": [ + { + "name": "myOrganizations", + "type": "Microsoft.Confluent/organizations", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Confluent/organizations/myOrganizations", + "location": "West US", + "properties": { + "createdTime": "2020-05-09T14:28:47.284Z", + "offerDetail": { + "id": "string", + "planId": "string", + "planName": "string", + "privateOfferId": "string", + "privateOfferIds": [ + "string" + ], + "publisherId": "string", + "status": "Started", + "termUnit": "string" + }, + "organizationId": "string", + "provisioningState": "Accepted", + "ssoUrl": "string", + "userDetail": { + "aadEmail": "contoso@microsoft.com", + "emailAddress": "contoso@microsoft.com", + "firstName": "string", + "lastName": "string", + "userPrincipalName": "contoso@microsoft.com" + } + }, + "tags": { + "Environment": "Dev" + } + } + ] + } + } + }, + "operationId": "Organization_ListBySubscription", + "title": "Organization_ListBySubscription" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_ListRegions.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_ListRegions.json new file mode 100644 index 0000000000..9c1885ec06 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_ListRegions.json @@ -0,0 +1,45 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "body": { + "searchFilters": { + "cloud": "azure", + "packages": "ADVANCED,ESSENTIALS", + "region": "eastus" + } + }, + "organizationName": "myOrganization", + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": { + "body": { + "data": [ + { + "id": "sgreg-7", + "kind": "Region", + "properties": { + "metadata": { + "createdTimestamp": "2023-04-06T10:24:09.840788Z", + "resourceName": "crn://confluent.cloud/schema-registry-region=sgreg-7", + "self": "https://api.stag.cpdev.cloud/srcm/v2/regions/sgreg-7", + "updatedTimestamp": "2023-04-06T10:24:09.840788Z" + }, + "spec": { + "name": "Iowa (centralus)", + "cloud": "AZURE", + "packages": [ + "ADVANCED" + ], + "regionName": "centralus" + } + } + } + ] + } + } + }, + "operationId": "Organization_ListRegions", + "title": "Organization_ListRegions" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_ListSchemaRegistryClusters.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_ListSchemaRegistryClusters.json new file mode 100644 index 0000000000..bcc8d0b72f --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_ListSchemaRegistryClusters.json @@ -0,0 +1,51 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "environmentId": "env-stgcczjp2j3", + "organizationName": "myOrganization", + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": { + "body": { + "nextLink": null, + "value": [ + { + "id": "lsrc-stgczkq22z", + "kind": "Cluster", + "properties": { + "metadata": { + "createdTimestamp": "2023-11-08T07:37:14.309386Z", + "resourceName": "crn://confluent.cloud/organization=37d1220b-93a6-43e3-a114-dd8a20a94a31/environment=env-stgccnk2mgd/schema-registry=lsrc-stgczkq22z", + "self": "https://api.stag.cpdev.cloud/srcm/v2/clusters/lsrc-stgczkq22z", + "updatedTimestamp": "2023-11-08T07:37:14.309386Z" + }, + "spec": { + "name": "Stream Governance Package", + "cloud": "GCP", + "environment": { + "id": "env-stgccnk2mgd", + "related": "https://api.stag.cpdev.cloud/org/v2/environments/env-stgccnk2mgd", + "resourceName": "crn://confluent.cloud/organization=37d1220b-93a6-43e3-a114-dd8a20a94a31/environment=env-stgccnk2mgd" + }, + "httpEndpoint": "https://psrc-57wzyg.centralus.azure.stag.cpdev.cloud", + "package": "ADVANCED", + "region": { + "id": "sgreg-7", + "related": "https://api.stag.cpdev.cloud/srcm/v2/regions/sgreg-7", + "resourceName": "crn://confluent.cloud/schema-registry-region=sgreg-7" + } + }, + "status": { + "phase": "PROVISIONED" + } + } + } + ] + } + } + }, + "operationId": "Organization_ListSchemaRegistryClusters", + "title": "Organization_ListSchemaRegistryClusters" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_TopicList.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_TopicList.json new file mode 100644 index 0000000000..790f162c7e --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_TopicList.json @@ -0,0 +1,44 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "clusterId": "cluster-1", + "environmentId": "env-12132", + "organizationName": "myOrganization", + "pageSize": 10, + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": { + "body": { + "nextLink": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Confluent/organizations/myOrganization/environments/env-12132/clusters/cluster-1/topics?api-version=2024-07-01&$count=10&$skipToken=xoi3753asdfe", + "value": [ + { + "name": "topic-1", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Confluent/organizations/myOrganization/environments/env-12132/clusters/cluster-1/topics/topic-1", + "properties": { + "configs": { + "related": "https://pkc-00000.region.provider.confluent.cloud/kafka/v3/clusters/cluster-1/topics/topic-2/configs" + }, + "kind": "KafkaTopic", + "metadata": { + "resourceName": "crn:///kafka=cluster-1/topic=topic-1", + "self": "https://pkc-00000.region.provider.confluent.cloud/kafka/v3/clusters/cluster-1/topics/topic-1" + }, + "partitions": { + "related": "https://pkc-00000.region.provider.confluent.cloud/kafka/v3/clusters/cluster-1/topics/topic-2/partitions" + }, + "partitionsCount": "1", + "partitionsReassignments": { + "related": "https://pkc-00000.region.provider.confluent.cloud/kafka/v3/clusters/cluster-1/topics/topic-2/partitions/-/reassignments" + }, + "replicationFactor": "3" + } + } + ] + } + } + }, + "operationId": "Topics_List", + "title": "Organization_ListTopics" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_Update.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_Update.json new file mode 100644 index 0000000000..69c14b86d9 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Organization_Update.json @@ -0,0 +1,58 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "body": { + "tags": { + "client": "dev-client", + "env": "dev" + } + }, + "organizationName": "myOrganization", + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": { + "body": { + "name": "myOrganization", + "type": "Microsoft.Confluent/organizations", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Confluent/organizations/myOrganization", + "location": "West US", + "properties": { + "createdTime": "2020-05-09T14:28:47.284Z", + "offerDetail": { + "id": "string", + "planId": "string", + "planName": "string", + "publisherId": "string", + "status": "Started", + "termUnit": "string" + }, + "organizationId": "string", + "provisioningState": "Succeeded", + "ssoUrl": "string", + "userDetail": { + "aadEmail": "contoso@microsoft.com", + "emailAddress": "contoso@microsoft.com", + "firstName": "string", + "lastName": "string", + "userPrincipalName": "contoso@microsoft.com" + } + }, + "systemData": { + "createdAt": "2020-05-09T14:28:47.284Z", + "createdBy": "string", + "createdByType": "User", + "lastModifiedAt": "2020-05-09T14:28:47.284Z", + "lastModifiedBy": "string", + "lastModifiedByType": "User" + }, + "tags": { + "Environment": "Dev" + } + } + } + }, + "operationId": "Organization_Update", + "title": "Confluent_Update" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Topics_Create.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Topics_Create.json new file mode 100644 index 0000000000..dcc618fad7 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Topics_Create.json @@ -0,0 +1,81 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "body": { + "properties": { + "inputConfigs": [ + { + "name": "cleanup.policy", + "value": "compact" + }, + { + "name": "retention.ms", + "value": "86400000" + } + ], + "partitionsCount": "1", + "replicationFactor": "3" + } + }, + "clusterId": "dlz-f3a90de", + "environmentId": "env-12132", + "organizationName": "myOrganization", + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000", + "topicName": "topic-1" + }, + "responses": { + "200": { + "body": { + "name": "topic-1", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Confluent/organizations/myOrganization/environments/env-12132/clusters/dlz-f3a90de/topics/topic-1", + "properties": { + "configs": { + "related": "https://pkc-00000.region.provider.confluent.cloud/kafka/v3/clusters/cluster-1/topics/topic-2/configs" + }, + "kind": "KafkaTopic", + "metadata": { + "resourceName": "crn:///kafka=cluster-1/topic=topic-1", + "self": "https://pkc-00000.region.provider.confluent.cloud/kafka/v3/clusters/cluster-1/topics/topic-1" + }, + "partitions": { + "related": "https://pkc-00000.region.provider.confluent.cloud/kafka/v3/clusters/cluster-1/topics/topic-2/partitions" + }, + "partitionsCount": "1", + "partitionsReassignments": { + "related": "https://pkc-00000.region.provider.confluent.cloud/kafka/v3/clusters/cluster-1/topics/topic-2/partitions/-/reassignments" + }, + "replicationFactor": "3", + "topicId": "topic-1" + } + } + }, + "201": { + "body": { + "name": "topic-1", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Confluent/organizations/myOrganization/environments/env-12132/clusters/dlz-f3a90de/topics/topic-1", + "properties": { + "configs": { + "related": "https://pkc-00000.region.provider.confluent.cloud/kafka/v3/clusters/cluster-1/topics/topic-2/configs" + }, + "kind": "KafkaTopic", + "metadata": { + "resourceName": "crn:///kafka=cluster-1/topic=topic-1", + "self": "https://pkc-00000.region.provider.confluent.cloud/kafka/v3/clusters/cluster-1/topics/topic-1" + }, + "partitions": { + "related": "https://pkc-00000.region.provider.confluent.cloud/kafka/v3/clusters/cluster-1/topics/topic-2/partitions" + }, + "partitionsCount": "1", + "partitionsReassignments": { + "related": "https://pkc-00000.region.provider.confluent.cloud/kafka/v3/clusters/cluster-1/topics/topic-2/partitions/-/reassignments" + }, + "replicationFactor": "3", + "topicId": "topic-1" + } + } + } + }, + "operationId": "Topics_Create", + "title": "Topics_Create" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Topics_Delete.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Topics_Delete.json new file mode 100644 index 0000000000..f50cb62545 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Topics_Delete.json @@ -0,0 +1,25 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "clusterId": "dlz-f3a90de", + "environmentId": "env-12132", + "organizationName": "myOrganization", + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000", + "topicName": "topic-1" + }, + "responses": { + "202": { + "headers": { + "azure-AsyncOperation": "http://azure.async.operation/status" + } + }, + "204": { + "headers": { + "azure-AsyncOperation": "http://azure.async.operation/status" + } + } + }, + "operationId": "Topics_Delete", + "title": "Topics_Delete" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Topics_Get.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Topics_Get.json new file mode 100644 index 0000000000..9445db7b77 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Topics_Get.json @@ -0,0 +1,40 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "clusterId": "dlz-f3a90de", + "environmentId": "env-12132", + "organizationName": "myOrganization", + "pageSize": 10, + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000", + "topicName": "topic-1" + }, + "responses": { + "200": { + "body": { + "name": "topic-1", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Confluent/organizations/myOrganization/environments/env-12132/clusters/dlz-f3a90de/topics/topic-1", + "properties": { + "configs": { + "related": "https://pkc-00000.region.provider.confluent.cloud/kafka/v3/clusters/cluster-1/topics/topic-2/configs" + }, + "kind": "KafkaTopic", + "metadata": { + "resourceName": "crn:///kafka=cluster-1/topic=topic-1", + "self": "https://pkc-00000.region.provider.confluent.cloud/kafka/v3/clusters/cluster-1/topics/topic-1" + }, + "partitions": { + "related": "https://pkc-00000.region.provider.confluent.cloud/kafka/v3/clusters/cluster-1/topics/topic-2/partitions" + }, + "partitionsCount": "1", + "partitionsReassignments": { + "related": "https://pkc-00000.region.provider.confluent.cloud/kafka/v3/clusters/cluster-1/topics/topic-2/partitions/-/reassignments" + }, + "replicationFactor": "3" + } + } + } + }, + "operationId": "Topics_Get", + "title": "Topics_Get" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Validations_ValidateOrganizations.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Validations_ValidateOrganizations.json new file mode 100644 index 0000000000..1c6ad642de --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Validations_ValidateOrganizations.json @@ -0,0 +1,74 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "body": { + "location": "West US", + "properties": { + "offerDetail": { + "id": "string", + "planId": "string", + "planName": "string", + "privateOfferId": "string", + "privateOfferIds": [ + "string" + ], + "publisherId": "string", + "termUnit": "string" + }, + "userDetail": { + "aadEmail": "abc@microsoft.com", + "emailAddress": "abc@microsoft.com", + "firstName": "string", + "lastName": "string", + "userPrincipalName": "abc@microsoft.com" + } + }, + "tags": { + "Environment": "Dev" + } + }, + "organizationName": "myOrganization", + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": { + "body": { + "name": "myOrganization", + "type": "Microsoft.Confluent/organizations", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Confluent/organizations/myOrganization", + "location": "West US", + "properties": { + "createdTime": "2020-05-09T14:28:47.284Z", + "offerDetail": { + "id": "string", + "planId": "string", + "planName": "string", + "privateOfferId": "string", + "privateOfferIds": [ + "string" + ], + "publisherId": "string", + "status": "Started", + "termUnit": "string" + }, + "organizationId": "string", + "provisioningState": "Succeeded", + "ssoUrl": "string", + "userDetail": { + "aadEmail": "abc@microsoft.com", + "emailAddress": "abc@microsoft.com", + "firstName": "string", + "lastName": "string", + "userPrincipalName": "abc@microsoft.com" + } + }, + "tags": { + "Environment": "Dev" + } + } + } + }, + "operationId": "Validations_ValidateOrganization", + "title": "Validations_ValidateOrganizations" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Validations_ValidateOrganizationsV2.json b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Validations_ValidateOrganizationsV2.json new file mode 100644 index 0000000000..9b7df4a9bc --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/examples/2024-07-01/Validations_ValidateOrganizationsV2.json @@ -0,0 +1,45 @@ +{ + "parameters": { + "api-version": "2024-07-01", + "body": { + "location": "West US", + "properties": { + "offerDetail": { + "id": "string", + "planId": "string", + "planName": "string", + "privateOfferId": "string", + "privateOfferIds": [ + "string" + ], + "publisherId": "string", + "termUnit": "string" + }, + "userDetail": { + "aadEmail": "abc@microsoft.com", + "emailAddress": "abc@microsoft.com", + "firstName": "string", + "lastName": "string", + "userPrincipalName": "abc@microsoft.com" + } + }, + "tags": { + "Environment": "Dev" + } + }, + "organizationName": "myOrganization", + "resourceGroupName": "myResourceGroup", + "subscriptionId": "00000000-0000-0000-0000-000000000000" + }, + "responses": { + "200": { + "body": { + "info": { + "displayMessage": "This is display message" + } + } + } + }, + "operationId": "Validations_ValidateOrganizationV2", + "title": "Validations_ValidateOrganizations" +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/main.tsp b/packages/typespec-test/test/Confluent.Management/spec/main.tsp new file mode 100644 index 0000000000..69b6d04082 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/main.tsp @@ -0,0 +1,68 @@ +/** + * PLEASE DO NOT REMOVE - USED FOR CONVERTER METRICS + * Generated by package: @autorest/openapi-to-typespec + * Parameters used: + * isFullCompatible: true + * guessResourceKey: true + * Version: Not generated in test + * Date: Not generated in test + */ +import "@typespec/rest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; +import "@typespec/openapi"; +import "./models.tsp"; +import "./back-compatible.tsp"; +import "./OrganizationResource.tsp"; +import "./SCEnvironmentRecord.tsp"; +import "./SCClusterRecord.tsp"; +import "./ConnectorResource.tsp"; +import "./TopicRecord.tsp"; +import "./routes.tsp"; + +using TypeSpec.Rest; +using TypeSpec.Http; +using Azure.ResourceManager.Foundations; +using Azure.Core; +using Azure.ResourceManager; +using TypeSpec.Versioning; +using TypeSpec.OpenAPI; + +@armProviderNamespace +@service(#{ title: "ConfluentManagementClient" }) +@versioned(Versions) +@armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v5) +namespace Microsoft.Confluent; + +/** + * The available API versions. + */ +enum Versions { + /** + * The 2024-07-01 API version. + */ + @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) + @useDependency(Azure.Core.Versions.v1_0_Preview_1) + v2024_07_01: "2024-07-01", +} + +interface Operations { + #suppress "@azure-tools/typespec-azure-core/no-private-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @tag("Operations") + @autoRoute + @Azure.ResourceManager.Private.armUpdateProviderNamespace + @doc("List the operations for the provider") + @segment("operations") + @get + list( + ...ApiVersionParameter, + + @path + @segment("providers") + @doc("The provider namespace (this parameter will not show up in operations).") + provider: "Microsoft.ThisWillBeReplaced", + ): ArmResponse | ResourceProviderDefaultErrorResponse; +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/models.tsp b/packages/typespec-test/test/Confluent.Management/spec/models.tsp new file mode 100644 index 0000000000..94668d4932 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/models.tsp @@ -0,0 +1,2417 @@ +import "@typespec/rest"; +import "@typespec/http"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; + +using TypeSpec.Rest; +using TypeSpec.Http; +using Azure.ResourceManager; +using Azure.ResourceManager.Foundations; + +namespace Microsoft.Confluent; + +/** + * Result of GET request to list Confluent operations. + */ +@Azure.Core.pagedResult +model OperationListResult { + /** + * List of Confluent operations supported by the Microsoft.Confluent provider. + */ + @Azure.Core.items + value: OperationResult[]; + + /** + * URL to get the next set of operation list results if there are any. + */ + @nextLink + nextLink?: string; +} + +/** + * The type of identity that created the resource. + */ +union CreatedByType { + string, + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + User: "User", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Application: "Application", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + ManagedIdentity: "ManagedIdentity", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Key: "Key", +} + +/** + * Provision states for confluent RP + */ +union ProvisionState { + string, + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Accepted: "Accepted", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Creating: "Creating", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Updating: "Updating", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Deleting: "Deleting", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Succeeded: "Succeeded", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Failed: "Failed", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Canceled: "Canceled", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Deleted: "Deleted", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + NotSpecified: "NotSpecified", +} + +/** + * SaaS Offer Status for confluent RP + */ +union SaaSOfferStatus { + string, + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Started: "Started", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + PendingFulfillmentStart: "PendingFulfillmentStart", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + InProgress: "InProgress", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Subscribed: "Subscribed", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Suspended: "Suspended", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Reinstated: "Reinstated", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Succeeded: "Succeeded", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Failed: "Failed", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Unsubscribed: "Unsubscribed", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Updating: "Updating", +} + +/** + * Stream Governance Package. Supported values are ESSENTIALS and ADVANCED + */ +union Package { + string, + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + ESSENTIALS: "ESSENTIALS", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + ADVANCED: "ADVANCED", +} + +/** + * Connector Type + */ +union ConnectorType { + string, + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + SINK: "SINK", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + SOURCE: "SOURCE", +} + +/** + * Connector Class + */ +union ConnectorClass { + string, + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + AZUREBLOBSOURCE: "AZUREBLOBSOURCE", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + AZUREBLOBSINK: "AZUREBLOBSINK", +} + +/** + * Connector Status + */ +union ConnectorStatus { + string, + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + PROVISIONING: "PROVISIONING", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + RUNNING: "RUNNING", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + PAUSED: "PAUSED", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + FAILED: "FAILED", +} + +/** + * The connector service type. + */ +union ConnectorServiceType { + string, + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + AzureBlobStorageSinkConnector: "AzureBlobStorageSinkConnector", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + AzureBlobStorageSourceConnector: "AzureBlobStorageSourceConnector", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + AzureCosmosDBSinkConnector: "AzureCosmosDBSinkConnector", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + AzureCosmosDBSourceConnector: "AzureCosmosDBSourceConnector", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + AzureSynapseAnalyticsSinkConnector: "AzureSynapseAnalyticsSinkConnector", +} + +/** + * Partner Connector type. + */ +union PartnerConnectorType { + string, + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + KafkaAzureBlobStorageSource: "KafkaAzureBlobStorageSource", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + KafkaAzureBlobStorageSink: "KafkaAzureBlobStorageSink", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + KafkaAzureCosmosDBSource: "KafkaAzureCosmosDBSource", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + KafkaAzureCosmosDBSink: "KafkaAzureCosmosDBSink", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + KafkaAzureSynapseAnalyticsSink: "KafkaAzureSynapseAnalyticsSink", +} + +/** + * Kafka Connector Auth Type + */ +union AuthType { + string, + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + SERVICE_ACCOUNT: "SERVICE_ACCOUNT", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + KAFKA_API_KEY: "KAFKA_API_KEY", +} + +/** + * Data Format Type + */ +union DataFormatType { + string, + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + AVRO: "AVRO", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + JSON: "JSON", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + STRING: "STRING", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + BYTES: "BYTES", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + PROTOBUF: "PROTOBUF", +} + +/** + * Response of a list operation. + */ +model ConfluentAgreementResourceListResponse + is Azure.Core.Page; + +/** + * Agreement Terms definition + */ +model ConfluentAgreementResource { + /** + * The ARM id of the resource. + */ + @visibility(Lifecycle.Read) + id?: string; + + /** + * The name of the agreement. + */ + @visibility(Lifecycle.Read) + name?: string; + + /** + * The type of the agreement. + */ + @visibility(Lifecycle.Read) + type?: string; + + /** + * Metadata pertaining to creation and last modification of the resource + */ + @visibility(Lifecycle.Read) + systemData?: SystemData; + + /** + * Represents the properties of the resource. + */ + #suppress "@azure-tools/typespec-azure-core/no-private-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + properties?: ConfluentAgreementProperties; +} + +/** + * Terms properties for Marketplace and Confluent. + */ +model ConfluentAgreementProperties { + /** + * Publisher identifier string. + */ + publisher?: string; + + /** + * Product identifier string. + */ + product?: string; + + /** + * Plan identifier string. + */ + plan?: string; + + /** + * Link to HTML with Microsoft and Publisher terms. + */ + licenseTextLink?: string; + + /** + * Link to the privacy policy of the publisher. + */ + privacyPolicyLink?: string; + + /** + * Date and time in UTC of when the terms were accepted. This is empty if Accepted is false. + */ + retrieveDatetime?: utcDateTime; + + /** + * Terms signature. + */ + signature?: string; + + /** + * If any version of the terms have been accepted, otherwise false. + */ + accepted?: boolean; +} + +/** + * Default error response for resource provider + */ +@error +model ResourceProviderDefaultErrorResponse { + /** + * Response body of Error + */ + @visibility(Lifecycle.Read) + error?: ErrorResponseBody; +} + +/** + * Response body of Error + */ +model ErrorResponseBody { + /** + * Error code + */ + @visibility(Lifecycle.Read) + code?: string; + + /** + * Error message + */ + @visibility(Lifecycle.Read) + message?: string; + + /** + * Error target + */ + @visibility(Lifecycle.Read) + target?: string; + + /** + * Error detail + */ + @visibility(Lifecycle.Read) + @OpenAPI.extension("x-ms-identifiers", #[]) + details?: ErrorResponseBody[]; +} + +/** + * An Confluent REST API operation. + */ +model OperationResult { + /** + * Operation name: {provider}/{resource}/{operation} + */ + name?: string; + + /** + * The object that represents the operation. + */ + display?: OperationDisplay; + + /** + * Indicates whether the operation is a data action + */ + isDataAction?: boolean; +} + +/** + * The object that represents the operation. + */ +model OperationDisplay { + /** + * Service provider: Microsoft.Confluent + */ + provider?: string; + + /** + * Type on which the operation is performed, e.g., 'clusters'. + */ + resource?: string; + + /** + * Operation type, e.g., read, write, delete, etc. + */ + operation?: string; + + /** + * Description of the operation, e.g., 'Write confluent'. + */ + description?: string; +} + +/** + * Organization resource property + */ +model OrganizationResourceProperties { + /** + * The creation time of the resource. + */ + @visibility(Lifecycle.Read) + createdTime?: utcDateTime; + + /** + * Provision states for confluent RP + */ + @visibility(Lifecycle.Read) + provisioningState?: ProvisionState; + + /** + * Id of the Confluent organization. + */ + @visibility(Lifecycle.Read) + organizationId?: string; + + /** + * SSO url for the Confluent organization. + */ + @visibility(Lifecycle.Read) + ssoUrl?: string; + + /** + * Confluent offer detail + */ + offerDetail: OfferDetail; + + /** + * Subscriber detail + */ + userDetail: UserDetail; + + /** + * Link an existing Confluent organization + */ + linkOrganization?: LinkOrganization; +} + +/** + * Confluent Offer detail + */ +model OfferDetail { + /** + * Publisher Id + */ + @maxLength(50) + publisherId: string; + + /** + * Offer Id + */ + @maxLength(50) + id: string; + + /** + * Offer Plan Id + */ + @maxLength(200) + planId: string; + + /** + * Offer Plan Name + */ + @maxLength(200) + planName: string; + + /** + * Offer Plan Term unit + */ + @maxLength(25) + termUnit: string; + + /** + * Offer Plan Term Id + */ + @maxLength(50) + termId?: string; + + /** + * Private Offer Id + */ + @maxLength(255) + privateOfferId?: string; + + /** + * Array of Private Offer Ids + */ + privateOfferIds?: string[]; + + /** + * SaaS Offer Status + */ + status?: SaaSOfferStatus; +} + +/** + * Subscriber detail + */ +model UserDetail { + /** + * First name + */ + @maxLength(50) + firstName?: string; + + /** + * Last name + */ + @maxLength(50) + lastName?: string; + + /** + * Email address + */ + @pattern("^\\S+@\\S+\\.\\S+$") + emailAddress: string; + + /** + * User principal name + */ + userPrincipalName?: string; + + /** + * AAD email address + */ + aadEmail?: string; +} + +/** + * Link an existing Confluent organization + */ +model LinkOrganization { + /** + * User auth token + */ + @visibility(Lifecycle.Create) + @secret + token: string; +} + +/** + * Organization Resource update + */ +model OrganizationResourceUpdate { + /** + * ARM resource tags + */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + tags?: Record; +} + +/** + * Validation response from the provider + */ +model ValidationResponse { + /** + * Info from the response + */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + info?: Record; +} + +/** + * List Access Request Model + */ +model ListAccessRequestModel { + /** + * Search filters for the request + */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + searchFilters?: Record; +} + +/** + * List users success response + */ +model AccessListUsersSuccessResponse { + /** + * Type of response + */ + kind?: string; + + /** + * Metadata of the list + */ + metadata?: ConfluentListMetadata; + + /** + * Data of the users list + */ + data?: UserRecord[]; +} + +/** + * Metadata of the list + */ +model ConfluentListMetadata { + /** + * First page of the list + */ + first?: string; + + /** + * Last page of the list + */ + last?: string; + + /** + * Previous page of the list + */ + prev?: string; + + /** + * Next page of the list + */ + next?: string; + + /** + * Total size of the list + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + total_size?: int32; +} + +/** + * Record of the user + */ +model UserRecord { + /** + * Type of account + */ + kind?: string; + + /** + * Id of the user + */ + id?: string; + + /** + * Metadata of the record + */ + metadata?: MetadataEntity; + + /** + * Email of the user + */ + email?: string; + + /** + * Name of the user + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + full_name?: string; + + /** + * Auth type of the user + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + auth_type?: string; +} + +/** + * Metadata of the data record + */ +model MetadataEntity { + /** + * Self lookup url + */ + self?: string; + + /** + * Resource name of the record + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + resource_name?: string; + + /** + * Created Date Time + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + created_at?: string; + + /** + * Updated Date time + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + updated_at?: string; + + /** + * Deleted Date time + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + deleted_at?: string; +} + +/** + * List service accounts success response + */ +model AccessListServiceAccountsSuccessResponse { + /** + * Type of response + */ + kind?: string; + + /** + * Metadata of the list + */ + metadata?: ConfluentListMetadata; + + /** + * Data of the service accounts list + */ + data?: ServiceAccountRecord[]; +} + +/** + * Record of the service account + */ +model ServiceAccountRecord { + /** + * Type of account + */ + kind?: string; + + /** + * Id of the service account + */ + id?: string; + + /** + * Metadata of the record + */ + metadata?: MetadataEntity; + + /** + * Name of the service account + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + display_name?: string; + + /** + * Description of the service account + */ + description?: string; +} + +/** + * List invitations success response + */ +model AccessListInvitationsSuccessResponse { + /** + * Type of response + */ + kind?: string; + + /** + * Metadata of the list + */ + metadata?: ConfluentListMetadata; + + /** + * Data of the invitations list + */ + data?: InvitationRecord[]; +} + +/** + * Record of the invitation + */ +model InvitationRecord { + /** + * Type of account + */ + kind?: string; + + /** + * Id of the invitation + */ + id?: string; + + /** + * Metadata of the record + */ + metadata?: MetadataEntity; + + /** + * Email of the user + */ + email?: string; + + /** + * Auth type of the user + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + auth_type?: string; + + /** + * Status of the invitation + */ + status?: string; + + /** + * Accepted date time of the invitation + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + accepted_at?: string; + + /** + * Expiration date time of the invitation + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + expires_at?: string; +} + +/** + * Invite User Account model + */ +model AccessInviteUserAccountModel { + /** + * Id of the organization + */ + organizationId?: string; + + /** + * Email of the logged in user + */ + email?: string; + + /** + * Upn of the logged in user + */ + upn?: string; + + /** + * Details of the user who is being invited + */ + invitedUserDetails?: AccessInvitedUserDetails; +} + +/** + * Details of the user being invited + */ +model AccessInvitedUserDetails { + /** + * UPN/Email of the user who is being invited + */ + invitedEmail?: string; + + /** + * Auth type of the user + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + auth_type?: string; +} + +/** + * Details of the environments returned on successful response + */ +model AccessListEnvironmentsSuccessResponse { + /** + * Type of response + */ + kind?: string; + + /** + * Metadata of the environment list + */ + metadata?: ConfluentListMetadata; + + /** + * Environment list data + */ + data?: EnvironmentRecord[]; +} + +/** + * Details about environment name, metadata and environment id of an environment + */ +model EnvironmentRecord { + /** + * Type of environment + */ + kind?: string; + + /** + * Id of the environment + */ + id?: string; + + /** + * Metadata of the record + */ + metadata?: MetadataEntity; + + /** + * Display name of the user + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + display_name?: string; +} + +/** + * Details of the clusters returned on successful response + */ +model AccessListClusterSuccessResponse { + /** + * Type of response + */ + kind?: string; + + /** + * Metadata of the list + */ + metadata?: ConfluentListMetadata; + + /** + * List of clusters + */ + data?: ClusterRecord[]; +} + +/** + * Details of cluster record + */ +model ClusterRecord { + /** + * Type of cluster + */ + kind?: string; + + /** + * Id of the cluster + */ + id?: string; + + /** + * Metadata of the record + */ + metadata?: MetadataEntity; + + /** + * Display name of the cluster + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + display_name?: string; + + /** + * Specification of the cluster + */ + spec?: ClusterSpecEntity; + + /** + * Specification of the cluster + */ + status?: ClusterStatusEntity; +} + +/** + * Spec of the cluster record + */ +model ClusterSpecEntity { + /** + * The name of the cluster + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + display_name?: string; + + /** + * The availability zone configuration of the cluster + */ + availability?: string; + + /** + * The cloud service provider + */ + cloud?: string; + + /** + * type of zone availability + */ + zone?: string; + + /** + * The cloud service provider region + */ + region?: string; + + /** + * The bootstrap endpoint used by Kafka clients to connect to the cluster + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + kafka_bootstrap_endpoint?: string; + + /** + * The cluster HTTP request URL. + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + http_endpoint?: string; + + /** + * The Kafka API cluster endpoint + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + api_endpoint?: string; + + /** + * Specification of the cluster + */ + config?: ClusterConfigEntity; + + /** + * Specification of the cluster + */ + environment?: ClusterEnvironmentEntity; + + /** + * Specification of the cluster + */ + network?: ClusterNetworkEntity; + + /** + * Specification of the cluster + */ + byok?: ClusterByokEntity; +} + +/** + * The configuration of the Kafka cluster + */ +model ClusterConfigEntity { + /** + * The lifecycle phase of the cluster + */ + kind?: string; +} + +/** + * The environment to which cluster belongs + */ +model ClusterEnvironmentEntity { + /** + * ID of the referred resource + */ + id?: string; + + /** + * Environment of the referred resource + */ + environment?: string; + + /** + * API URL for accessing or modifying the referred object + */ + related?: string; + + /** + * CRN reference to the referred resource + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + resource_name?: string; +} + +/** + * The network associated with this object + */ +model ClusterNetworkEntity { + /** + * ID of the referred resource + */ + id?: string; + + /** + * Environment of the referred resource + */ + environment?: string; + + /** + * API URL for accessing or modifying the referred object + */ + related?: string; + + /** + * CRN reference to the referred resource + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + resource_name?: string; +} + +/** + * The network associated with this object + */ +model ClusterByokEntity { + /** + * ID of the referred resource + */ + id?: string; + + /** + * API URL for accessing or modifying the referred object + */ + related?: string; + + /** + * CRN reference to the referred resource + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + resource_name?: string; +} + +/** + * Status of the cluster record + */ +model ClusterStatusEntity { + /** + * The lifecycle phase of the cluster + */ + phase?: string; + + /** + * The number of Confluent Kafka Units + */ + cku?: int32; +} + +/** + * Details of the role bindings returned on successful response + */ +model AccessListRoleBindingsSuccessResponse { + /** + * Type of response + */ + kind?: string; + + /** + * Metadata of the list + */ + metadata?: ConfluentListMetadata; + + /** + * List of role binding + */ + data?: RoleBindingRecord[]; +} + +/** + * Details on principal, role name and crn pattern of a role binding + */ +model RoleBindingRecord { + /** + * The type of the resource. + */ + kind?: string; + + /** + * Id of the role binding + */ + id?: string; + + /** + * Metadata of the record + */ + metadata?: MetadataEntity; + + /** + * The principal User or Group to bind the role to + */ + principal?: string; + + /** + * The name of the role to bind to the principal + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + role_name?: string; + + /** + * A CRN that specifies the scope and resource patterns necessary for the role to bind + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + crn_pattern?: string; +} + +/** + * Create role binding request model + */ +model AccessCreateRoleBindingRequestModel { + /** + * The principal User or Group to bind the role to + */ + principal?: string; + + /** + * The name of the role to bind to the principal + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + role_name?: string; + + /** + * A CRN that specifies the scope and resource patterns necessary for the role to bind + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + crn_pattern?: string; +} + +/** + * Details of the role binding names returned on successful response + */ +model AccessRoleBindingNameListSuccessResponse { + /** + * Type of response + */ + kind?: string; + + /** + * Metadata of the list + */ + metadata?: ConfluentListMetadata; + + /** + * List of role binding names + */ + data?: string[]; +} + +/** + * Result of GET request to list Confluent operations. + */ +model GetEnvironmentsResponse is Azure.Core.Page; + +/** + * Environment resource property + */ +#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-provisioning-state" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model EnvironmentProperties { + /** + * Stream governance configuration + */ + streamGovernanceConfig?: StreamGovernanceConfig; + + /** + * Metadata of the record + */ + metadata?: SCMetadataEntity; +} + +/** + * Stream governance configuration + */ +model StreamGovernanceConfig { + /** + * Stream governance configuration + */ + package?: Package; +} + +/** + * Metadata of the data record + */ +#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model SCMetadataEntity { + /** + * Self lookup url + */ + self?: string; + + /** + * Resource name of the record + */ + resourceName?: string; + + /** + * Created Date Time + */ + createdTimestamp?: string; + + /** + * Updated Date time + */ + updatedTimestamp?: string; + + /** + * Deleted Date time + */ + deletedTimestamp?: string; +} + +/** + * Result of GET request to list clusters in the environment of a confluent organization + */ +model ListClustersSuccessResponse is Azure.Core.Page; + +/** + * Service Connector Cluster Properties + */ +#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-provisioning-state" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model ClusterProperties { + /** + * Metadata of the record + */ + metadata?: SCMetadataEntity; + + /** + * Specification of the cluster + */ + spec?: SCClusterSpecEntity; + + /** + * Specification of the cluster status + */ + status?: ClusterStatusEntity; +} + +/** + * Spec of the cluster record + */ +#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model SCClusterSpecEntity { + /** + * The name of the cluster + */ + name?: string; + + /** + * The availability zone configuration of the cluster + */ + availability?: string; + + /** + * The cloud service provider + */ + cloud?: string; + + /** + * type of zone availability + */ + zone?: string; + + /** + * Stream governance configuration + */ + package?: Package; + + /** + * The cloud service provider region + */ + region?: string; + + /** + * The bootstrap endpoint used by Kafka clients to connect to the cluster + */ + kafkaBootstrapEndpoint?: string; + + /** + * The cluster HTTP request URL. + */ + httpEndpoint?: string; + + /** + * The Kafka API cluster endpoint + */ + apiEndpoint?: string; + + /** + * Specification of the cluster configuration + */ + config?: ClusterConfigEntity; + + /** + * Specification of the cluster environment + */ + environment?: SCClusterNetworkEnvironmentEntity; + + /** + * Specification of the cluster network + */ + network?: SCClusterNetworkEnvironmentEntity; + + /** + * Specification of the cluster byok + */ + byok?: SCClusterByokEntity; +} + +/** + * The environment or the network to which cluster belongs + */ +#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model SCClusterNetworkEnvironmentEntity { + /** + * ID of the referred resource + */ + id?: string; + + /** + * Environment of the referred resource + */ + environment?: string; + + /** + * API URL for accessing or modifying the referred object + */ + related?: string; + + /** + * CRN reference to the referred resource + */ + resourceName?: string; +} + +/** + * The network associated with this object + */ +#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model SCClusterByokEntity { + /** + * ID of the referred resource + */ + id?: string; + + /** + * API URL for accessing or modifying the referred object + */ + related?: string; + + /** + * CRN reference to the referred resource + */ + resourceName?: string; +} + +/** + * Result of GET request to list schema registry clusters in the environment of a confluent organization + */ +model ListSchemaRegistryClustersResponse + is Azure.Core.Page; + +/** + * Details of schema registry cluster record + */ +model SchemaRegistryClusterRecord { + /** + * Kind of the cluster + */ + kind?: string; + + /** + * Id of the cluster + */ + id?: string; + + /** + * Schema Registry Cluster Properties + */ + #suppress "@azure-tools/typespec-azure-core/no-private-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + properties?: SchemaRegistryClusterProperties; +} + +/** + * Schema Registry Cluster Properties + */ +model SchemaRegistryClusterProperties { + /** + * Metadata of the record + */ + metadata?: SCMetadataEntity; + + /** + * Specification of the schema registry cluster + */ + spec?: SchemaRegistryClusterSpecEntity; + + /** + * Specification of the cluster status + */ + status?: SchemaRegistryClusterStatusEntity; +} + +/** + * Details of schema registry cluster spec + */ +model SchemaRegistryClusterSpecEntity { + /** + * Name of the schema registry cluster + */ + name?: string; + + /** + * Http endpoint of the cluster + */ + httpEndpoint?: string; + + /** + * Type of the cluster package Advanced, essentials + */ + package?: string; + + /** + * Region details of the schema registry cluster + */ + region?: SchemaRegistryClusterEnvironmentRegionEntity; + + /** + * Environment details of the schema registry cluster + */ + environment?: SchemaRegistryClusterEnvironmentRegionEntity; + + /** + * The cloud service provider + */ + cloud?: string; +} + +/** + * The environment associated with this object + */ +model SchemaRegistryClusterEnvironmentRegionEntity { + /** + * ID of the referred resource + */ + id?: string; + + /** + * API URL for accessing or modifying the referred object + */ + related?: string; + + /** + * CRN reference to the referred resource + */ + resourceName?: string; +} + +/** + * Status of the schema registry cluster record + */ +model SchemaRegistryClusterStatusEntity { + /** + * The lifecycle phase of the cluster + */ + phase?: string; +} + +/** + * Result of POST request to list regions supported by confluent + */ +model ListRegionsSuccessResponse { + /** + * List of regions supported by confluent + */ + @OpenAPI.extension("x-ms-identifiers", #[]) + data?: RegionRecord[]; +} + +/** + * Details of region record + */ +model RegionRecord { + /** + * Kind of the cluster + */ + kind?: string; + + /** + * Id of the cluster + */ + id?: string; + + /** + * Region Properties + */ + #suppress "@azure-tools/typespec-azure-core/no-private-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + properties?: RegionProperties; +} + +/** + * Region Properties + */ +model RegionProperties { + /** + * Metadata of the record + */ + metadata?: SCMetadataEntity; + + /** + * Specification of the region + */ + spec?: RegionSpecEntity; +} + +/** + * Region spec details + */ +model RegionSpecEntity { + /** + * Display Name of the region + */ + name?: string; + + /** + * Cloud provider name + */ + cloud?: string; + + /** + * Region name + */ + regionName?: string; + + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + packages?: string[]; +} + +/** + * Create API Key model + */ +#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model CreateAPIKeyModel { + /** + * Name of the API Key + */ + name?: string; + + /** + * Description of the API Key + */ + description?: string; +} + +/** + * Details API key + */ +#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model APIKeyRecord { + /** + * Type of api key + */ + kind?: string; + + /** + * Id of the api key + */ + id?: string; + + /** + * API Key Properties + */ + #suppress "@azure-tools/typespec-azure-core/no-private-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + properties?: APIKeyProperties; +} + +/** + * API Key Properties + */ +#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model APIKeyProperties { + /** + * Metadata of the record + */ + metadata?: SCMetadataEntity; + + /** + * Specification of the API Key + */ + spec?: APIKeySpecEntity; +} + +/** + * Spec of the API Key record + */ +#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model APIKeySpecEntity { + /** + * The description of the API Key + */ + description?: string; + + /** + * The name of the API Key + */ + name?: string; + + /** + * API Key Secret + */ + @visibility(Lifecycle.Create) + @secret + secret?: string; + + /** + * Specification of the cluster + */ + resource?: APIKeyResourceEntity; + + /** + * Specification of the cluster + */ + owner?: APIKeyOwnerEntity; +} + +/** + * API Key Resource details which can be kafka cluster or schema registry cluster + */ +#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model APIKeyResourceEntity { + /** + * Id of the resource + */ + id?: string; + + /** + * The environment of the api key + */ + environment?: string; + + /** + * API URL for accessing or modifying the api key resource object + */ + related?: string; + + /** + * CRN reference to the referred resource + */ + resourceName?: string; + + /** + * Type of the owner which can be service or user account + */ + kind?: string; +} + +/** + * API Key Owner details which can be a user or service account + */ +#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model APIKeyOwnerEntity { + /** + * API Key owner id + */ + id?: string; + + /** + * API URL for accessing or modifying the referred object + */ + related?: string; + + /** + * CRN reference to the referred resource + */ + resourceName?: string; + + /** + * Type of the owner service or user account + */ + kind?: string; +} + +/** + * The resource properties of the Connector + */ +#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-provisioning-state" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model ConnectorResourceProperties { + /** + * Connector Info Base + */ + connectorBasicInfo?: ConnectorInfoBase; + + /** + * Connector Service type info base properties. + */ + connectorServiceTypeInfo?: ConnectorServiceTypeInfoBase; + + /** + * The connection information consumed by applications. + */ + partnerConnectorInfo?: PartnerInfoBase; +} + +/** + * Connector Info Base properties + */ +model ConnectorInfoBase { + /** + * Connector Type + */ + connectorType?: ConnectorType; + + /** + * Connector Class + */ + connectorClass?: ConnectorClass; + + /** + * Connector Name + */ + connectorName?: string; + + /** + * Connector Id + */ + connectorId?: string; + + /** + * Connector Status + */ + connectorState?: ConnectorStatus; +} + +/** + * The connector service type info + */ +@discriminator("connectorServiceType") +model ConnectorServiceTypeInfoBase { + /** + * The connector service type. + */ + connectorServiceType: ConnectorServiceType; +} + +/** + * The partner info base + */ +@discriminator("partnerConnectorType") +model PartnerInfoBase { + /** + * The partner connector type. + */ + partnerConnectorType: PartnerConnectorType; +} + +/** + * Result of GET request to list connectors in the cluster of a confluent organization + */ +model ListConnectorsSuccessResponse is Azure.Core.Page; + +/** + * Result of GET request to list topics in the cluster of a confluent organization + */ +model ListTopicsSuccessResponse is Azure.Core.Page; + +/** + * Topic Properties + */ +#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-provisioning-state" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model TopicProperties { + /** + * Type of topic + */ + kind?: string; + + /** + * Topic Id returned by Confluent + */ + topicId?: string; + + /** + * Metadata of the record + */ + metadata?: TopicMetadataEntity; + + /** + * Partition Specification of the topic + */ + partitions?: TopicsRelatedLink; + + /** + * Config Specification of the topic + */ + configs?: TopicsRelatedLink; + + /** + * Input Config Specification of the topic + */ + inputConfigs?: TopicsInputConfig[]; + + /** + * Partition Reassignment Specification of the topic + */ + partitionsReassignments?: TopicsRelatedLink; + + /** + * Partition count of the topic + */ + partitionsCount?: string; + + /** + * Replication factor of the topic + */ + replicationFactor?: string; +} + +/** + * Metadata of the data record + */ +model TopicMetadataEntity { + /** + * Self lookup url + */ + self?: string; + + /** + * Resource name of the record + */ + resourceName?: string; +} + +/** + * Partition Config spec of the topic record + */ +model TopicsRelatedLink { + /** + * Relationship of the topic + */ + related?: string; +} + +/** + * Topics input config + */ +model TopicsInputConfig { + /** + * Name of the topic input config + */ + name?: string; + + /** + * Value of the topic input config + */ + value?: string; +} + +/** + * Metadata of the list + */ +#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model SCConfluentListMetadata { + /** + * First page of the list + */ + first?: string; + + /** + * Last page of the list + */ + last?: string; + + /** + * Previous page of the list + */ + prev?: string; + + /** + * Next page of the list + */ + next?: string; + + /** + * Total size of the list + */ + totalSize?: int32; +} + +/** + * The authentication info when auth_type is azureBlobStorageSinkConnector + */ +model AzureBlobStorageSinkConnectorServiceInfo + extends ConnectorServiceTypeInfoBase { + /** + * Azure Blob Storage Account Name + */ + storageAccountName?: string; + + /** + * Azure Blob Storage Account Key + */ + storageAccountKey?: string; + + /** + * Azure Blob Storage Account Container Name + */ + storageContainerName?: string; + + /** + * The connector service type. + */ + connectorServiceType: "AzureBlobStorageSinkConnector"; +} + +/** + * The connector service type is AzureBlobStorageSourceConnector + */ +model AzureBlobStorageSourceConnectorServiceInfo + extends ConnectorServiceTypeInfoBase { + /** + * Azure Blob Storage Account Name + */ + storageAccountName?: string; + + /** + * Azure Blob Storage Account Key + */ + @secret + storageAccountKey?: string; + + /** + * Azure Blob Storage Account Container Name + */ + storageContainerName?: string; + + /** + * The connector service type. + */ + connectorServiceType: "AzureBlobStorageSourceConnector"; +} + +/** + * The authentication info when auth_type is AzureCosmosDBSinkConnector + */ +#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model AzureCosmosDBSinkConnectorServiceInfo + extends ConnectorServiceTypeInfoBase { + /** + * Azure Cosmos Database Name + */ + cosmosDatabaseName?: string; + + /** + * Azure Cosmos Database Master Key + */ + cosmosMasterKey?: string; + + /** + * Azure Cosmos Database Connection Endpoint + */ + cosmosConnectionEndpoint?: string; + + /** + * Azure Cosmos Database Containers Topic Mapping + */ + cosmosContainersTopicMapping?: string; + + /** + * Azure Cosmos Database Id Strategy + */ + cosmosIdStrategy?: string; + + /** + * The connector service type. + */ + connectorServiceType: "AzureCosmosDBSinkConnector"; +} + +/** + * The authentication info when auth_type is AzureCosmosDBSourceConnector + */ +#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model AzureCosmosDBSourceConnectorServiceInfo + extends ConnectorServiceTypeInfoBase { + /** + * Azure Cosmos Database Name + */ + cosmosDatabaseName?: string; + + /** + * Azure Cosmos Database Master Key + */ + cosmosMasterKey?: string; + + /** + * Azure Cosmos Database Connection Endpoint + */ + cosmosConnectionEndpoint?: string; + + /** + * Azure Cosmos Database Containers Topic Mapping + */ + cosmosContainersTopicMapping?: string; + + /** + * Azure Cosmos Database Message Key Enabled + */ + cosmosMessageKeyEnabled?: boolean; + + /** + * Azure Cosmos Database Message Key Field + */ + cosmosMessageKeyField?: string; + + /** + * The connector service type. + */ + connectorServiceType: "AzureCosmosDBSourceConnector"; +} + +/** + * The authentication info when auth_type is AzureSynapseAnalyticsSinkConnector + */ +model AzureSynapseAnalyticsSinkConnectorServiceInfo + extends ConnectorServiceTypeInfoBase { + /** + * Azure Synapse Analytics SQL Server Name + */ + synapseSqlServerName?: string; + + /** + * Azure Synapse SQL login details + */ + synapseSqlUser?: string; + + /** + * Azure Synapse SQL login details + */ + synapseSqlPassword?: string; + + /** + * Azure Synapse Dedicated SQL Pool Database Name + */ + synapseSqlDatabaseName?: string; + + /** + * The connector service type. + */ + connectorServiceType: "AzureSynapseAnalyticsSinkConnector"; +} + +/** + * The partner connector type is KafkaAzureBlobStorageSink + */ +model KafkaAzureBlobStorageSinkConnectorInfo extends PartnerInfoBase { + /** + * Kafka Auth Type + */ + authType?: AuthType; + + /** + * Kafka Input Data Format Type + */ + inputFormat?: DataFormatType; + + /** + * Kafka Output Data Format Type + */ + outputFormat?: DataFormatType; + + /** + * Kafka API Key + */ + apiKey?: string; + + /** + * Kafka API Key Secret + */ + apiSecret?: string; + + /** + * Kafka Service Account Id + */ + serviceAccountId?: string; + + /** + * Kafka topics list + */ + topics?: string[]; + + /** + * Kafka topics directory + */ + topicsDir?: string; + + /** + * Flush size + */ + flushSize?: string; + + /** + * Maximum Tasks + */ + maxTasks?: string; + + /** + * Time Interval + */ + timeInterval?: string; + + /** + * The partner connector type. + */ + partnerConnectorType: "KafkaAzureBlobStorageSink"; +} + +/** + * The partner connector type is KafkaAzureBlobStorageSource + */ +model KafkaAzureBlobStorageSourceConnectorInfo extends PartnerInfoBase { + /** + * Kafka Auth Type + */ + authType?: AuthType; + + /** + * Kafka Input Data Format Type + */ + inputFormat?: DataFormatType; + + /** + * Kafka Output Data Format Type + */ + outputFormat?: DataFormatType; + + /** + * Kafka API Key + */ + apiKey?: string; + + /** + * Kafka API Secret + */ + @secret + apiSecret?: string; + + /** + * Kafka Service Account Id + */ + serviceAccountId?: string; + + /** + * Kafka topics Regex pattern + */ + topicRegex?: string; + + /** + * Kafka topics directory + */ + topicsDir?: string; + + /** + * Maximum Tasks + */ + maxTasks?: string; + + /** + * The partner connector type. + */ + partnerConnectorType: "KafkaAzureBlobStorageSource"; +} + +/** + * The partner connector type is KafkaAzureCosmosDBSink + */ +#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model KafkaAzureCosmosDBSinkConnectorInfo extends PartnerInfoBase { + /** + * Kafka Auth Type + */ + authType?: AuthType; + + /** + * Kafka Input Data Format Type + */ + inputFormat?: DataFormatType; + + /** + * Kafka Output Data Format Type + */ + outputFormat?: DataFormatType; + + /** + * Kafka API Key + */ + apiKey?: string; + + /** + * Kafka API Key Secret + */ + apiSecret?: string; + + /** + * Kafka Service Account Id + */ + serviceAccountId?: string; + + /** + * Kafka topics list + */ + topics?: string[]; + + /** + * Kafka topics directory + */ + topicsDir?: string; + + /** + * Flush size + */ + flushSize?: string; + + /** + * Maximum Tasks + */ + maxTasks?: string; + + /** + * Time Interval + */ + timeInterval?: string; + + /** + * The partner connector type. + */ + partnerConnectorType: "KafkaAzureCosmosDBSink"; +} + +/** + * The partner connector type is KafkaAzureCosmosDBSource + */ +#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model KafkaAzureCosmosDBSourceConnectorInfo extends PartnerInfoBase { + /** + * Kafka Auth Type + */ + authType?: AuthType; + + /** + * Kafka Input Data Format Type + */ + inputFormat?: DataFormatType; + + /** + * Kafka Output Data Format Type + */ + outputFormat?: DataFormatType; + + /** + * Kafka API Key + */ + apiKey?: string; + + /** + * Kafka API Secret + */ + @secret + apiSecret?: string; + + /** + * Kafka Service Account Id + */ + serviceAccountId?: string; + + /** + * Kafka topics Regex pattern + */ + topicRegex?: string; + + /** + * Kafka topics directory + */ + topicsDir?: string; + + /** + * Maximum Tasks + */ + maxTasks?: string; + + /** + * The partner connector type. + */ + partnerConnectorType: "KafkaAzureCosmosDBSource"; +} + +/** + * The partner connector type is KafkaAzureSynapseAnalyticsSink + */ +model KafkaAzureSynapseAnalyticsSinkConnectorInfo extends PartnerInfoBase { + /** + * Kafka Auth Type + */ + authType?: AuthType; + + /** + * Kafka Input Data Format Type + */ + inputFormat?: DataFormatType; + + /** + * Kafka Output Data Format Type + */ + outputFormat?: DataFormatType; + + /** + * Kafka API Key + */ + apiKey?: string; + + /** + * Kafka API Key Secret + */ + apiSecret?: string; + + /** + * Kafka Service Account Id + */ + serviceAccountId?: string; + + /** + * Kafka topics list + */ + topics?: string[]; + + /** + * Kafka topics directory + */ + topicsDir?: string; + + /** + * Flush size + */ + flushSize?: string; + + /** + * Maximum Tasks + */ + maxTasks?: string; + + /** + * Time Interval + */ + timeInterval?: string; + + /** + * The partner connector type. + */ + partnerConnectorType: "KafkaAzureSynapseAnalyticsSink"; +} diff --git a/packages/typespec-test/test/Confluent.Management/spec/routes.tsp b/packages/typespec-test/test/Confluent.Management/spec/routes.tsp new file mode 100644 index 0000000000..bb650e5ea5 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/spec/routes.tsp @@ -0,0 +1,101 @@ +import "@azure-tools/typespec-azure-core"; +import "@typespec/rest"; +import "./models.tsp"; +import "@azure-tools/typespec-azure-resource-manager"; +import "@typespec/openapi"; + +using TypeSpec.Rest; +using TypeSpec.Http; +using Azure.ResourceManager; +using TypeSpec.OpenAPI; + +namespace Microsoft.Confluent; + +#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +interface MarketplaceAgreementsOperationGroup { + /** + * List Confluent marketplace agreements in the subscription. + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @summary("List Confluent marketplace agreements in the subscription.") + @autoRoute + @get + @action("agreements") + list is ArmProviderActionSync< + Response = ConfluentAgreementResourceListResponse, + Scope = SubscriptionActionScope, + Parameters = {}, + Error = ResourceProviderDefaultErrorResponse + >; + /** + * Create Confluent Marketplace agreement in the subscription. + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @summary("Create Confluent Marketplace agreement in the subscription.") + @autoRoute + @put + @action("agreements/default") + create is ArmProviderActionSync< + Request = ConfluentAgreementResource, + Response = ConfluentAgreementResource, + Scope = SubscriptionActionScope, + Parameters = {}, + OptionalRequestBody = true, + Error = ResourceProviderDefaultErrorResponse + >; +} + +#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +interface ValidationsOperationGroup { + /** + * Organization Validate proxy resource + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @summary("Organization Validate proxy resource") + @route("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/validations/{organizationName}/orgvalidate") + @post + validateOrganization( + ...ApiVersionParameter, + ...SubscriptionIdParameter, + ...ResourceGroupParameter, + + /** + * Organization resource name + */ + @path + organizationName: string, + + /** + * Organization resource model + */ + @bodyRoot + body: OrganizationResource, + ): ArmResponse | ResourceProviderDefaultErrorResponse; + + /** + * Organization Validate proxy resource + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @summary("Organization Validate proxy resource") + @route("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/validations/{organizationName}/orgvalidateV2") + @post + validateOrganizationV2( + ...ApiVersionParameter, + ...SubscriptionIdParameter, + ...ResourceGroupParameter, + + /** + * Organization resource name + */ + @path + organizationName: string, + + /** + * Organization resource model + */ + @bodyRoot + body: OrganizationResource, + ): ArmResponse | ResourceProviderDefaultErrorResponse; +} diff --git a/packages/typespec-test/test/Confluent.Management/tspconfig.yaml b/packages/typespec-test/test/Confluent.Management/tspconfig.yaml new file mode 100644 index 0000000000..8ee3cc52d0 --- /dev/null +++ b/packages/typespec-test/test/Confluent.Management/tspconfig.yaml @@ -0,0 +1,9 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + azure-sdk-for-js: false + experimental-extensible-enums: true + emitter-output-dir: "{project-root}/generated/typespec-ts" + package-details: + name: "@azure/arm-confluent"