From bed13cabca7d1eafa9c43d9e73fa818b9c25a2b0 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 8 Oct 2021 04:11:22 +0000 Subject: [PATCH] CodeGen from PR 16301 in Azure/azure-rest-api-specs Merge 91e1942697f9a4791cc5b86ed8de6108ade3b919 into 5ae66380818550c5d9a79c45c704e2ab8f46e63f --- .../arm-hybridconnectivity/LICENSE.txt | 21 + .../arm-hybridconnectivity/README.md | 106 ++++ .../arm-hybridconnectivity/package.json | 59 ++ .../arm-hybridconnectivity/rollup.config.js | 37 ++ .../src/hybridConnectivityManagementAPI.ts | 48 ++ .../hybridConnectivityManagementAPIContext.ts | 61 +++ .../src/models/endpointsMappers.ts | 21 + .../src/models/index.ts | 503 ++++++++++++++++++ .../src/models/mappers.ts | 460 ++++++++++++++++ .../src/models/operationsMappers.ts | 16 + .../src/models/parameters.ts | 84 +++ .../src/operations/endpoints.ts | 452 ++++++++++++++++ .../src/operations/index.ts | 11 + .../src/operations/operations.ts | 125 +++++ .../arm-hybridconnectivity/tsconfig.json | 19 + 15 files changed, 2023 insertions(+) create mode 100644 sdk/hybridconnectivity/arm-hybridconnectivity/LICENSE.txt create mode 100644 sdk/hybridconnectivity/arm-hybridconnectivity/README.md create mode 100644 sdk/hybridconnectivity/arm-hybridconnectivity/package.json create mode 100644 sdk/hybridconnectivity/arm-hybridconnectivity/rollup.config.js create mode 100644 sdk/hybridconnectivity/arm-hybridconnectivity/src/hybridConnectivityManagementAPI.ts create mode 100644 sdk/hybridconnectivity/arm-hybridconnectivity/src/hybridConnectivityManagementAPIContext.ts create mode 100644 sdk/hybridconnectivity/arm-hybridconnectivity/src/models/endpointsMappers.ts create mode 100644 sdk/hybridconnectivity/arm-hybridconnectivity/src/models/index.ts create mode 100644 sdk/hybridconnectivity/arm-hybridconnectivity/src/models/mappers.ts create mode 100644 sdk/hybridconnectivity/arm-hybridconnectivity/src/models/operationsMappers.ts create mode 100644 sdk/hybridconnectivity/arm-hybridconnectivity/src/models/parameters.ts create mode 100644 sdk/hybridconnectivity/arm-hybridconnectivity/src/operations/endpoints.ts create mode 100644 sdk/hybridconnectivity/arm-hybridconnectivity/src/operations/index.ts create mode 100644 sdk/hybridconnectivity/arm-hybridconnectivity/src/operations/operations.ts create mode 100644 sdk/hybridconnectivity/arm-hybridconnectivity/tsconfig.json diff --git a/sdk/hybridconnectivity/arm-hybridconnectivity/LICENSE.txt b/sdk/hybridconnectivity/arm-hybridconnectivity/LICENSE.txt new file mode 100644 index 000000000000..2d3163745319 --- /dev/null +++ b/sdk/hybridconnectivity/arm-hybridconnectivity/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2021 Microsoft + +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. diff --git a/sdk/hybridconnectivity/arm-hybridconnectivity/README.md b/sdk/hybridconnectivity/arm-hybridconnectivity/README.md new file mode 100644 index 000000000000..b3185ac4bee3 --- /dev/null +++ b/sdk/hybridconnectivity/arm-hybridconnectivity/README.md @@ -0,0 +1,106 @@ +## Azure HybridConnectivityManagementAPI SDK for JavaScript + +This package contains an isomorphic SDK (runs both in node.js and in browsers) for HybridConnectivityManagementAPI. + +### Currently supported environments + +- [LTS versions of Node.js](https://nodejs.org/about/releases/) +- Latest versions of Safari, Chrome, Edge and Firefox. + +### Prerequisites + +You must have an [Azure subscription](https://azure.microsoft.com/free/). + +### How to install + +To use this SDK in your project, you will need to install two packages. +- `@azure/arm-hybridconnectivity` that contains the client. +- `@azure/identity` that provides different mechanisms for the client to authenticate your requests using Azure Active Directory. + +Install both packages using the below command: +```bash +npm install --save @azure/arm-hybridconnectivity @azure/identity +``` +> **Note**: You may have used either `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` in the past. These packages are in maintenance mode receiving critical bug fixes, but no new features. +If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/), or are writing a client side browser application, we strongly encourage you to upgrade to `@azure/identity` which uses the latest versions of Azure Active Directory and MSAL APIs and provides more authentication options. + +### How to use + +- If you are writing a client side browser application, + - Follow the instructions in the section on Authenticating client side browser applications in [Azure Identity examples](https://aka.ms/azsdk/js/identity/examples) to register your application in the Microsoft identity platform and set the right permissions. + - Copy the client ID and tenant ID from the Overview section of your app registration in Azure portal and use it in the browser sample below. +- If you are writing a server side application, + - [Select a credential from `@azure/identity` based on the authentication method of your choice](https://aka.ms/azsdk/js/identity/examples) + - Complete the set up steps required by the credential if any. + - Use the credential you picked in the place of `DefaultAzureCredential` in the Node.js sample below. + +In the below samples, we pass the credential and the Azure subscription id to instantiate the client. +Once the client is created, explore the operations on it either in your favorite editor or in our [API reference documentation](https://docs.microsoft.com/javascript/api) to get started. +#### nodejs - Authentication, client creation, and list operations as an example written in JavaScript. + +##### Sample code + +```javascript +const { DefaultAzureCredential } = require("@azure/identity"); +const { HybridConnectivityManagementAPI } = require("@azure/arm-hybridconnectivity"); +const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; + +// Use `DefaultAzureCredential` or any other credential of your choice based on https://aka.ms/azsdk/js/identity/examples +// Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead. +const creds = new DefaultAzureCredential(); +const client = new HybridConnectivityManagementAPI(creds, subscriptionId); +client.operations.list().then((result) => { + console.log("The result is:"); + console.log(result); +}).catch((err) => { + console.log("An error occurred:"); + console.error(err); +}); +``` + +#### browser - Authentication, client creation, and list operations as an example written in JavaScript. + +In browser applications, we recommend using the `InteractiveBrowserCredential` that interactively authenticates using the default system browser. + - See [Single-page application: App registration guide](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-app-registration) to configure your app registration for the browser. + - Note down the client Id from the previous step and use it in the browser sample below. + +##### Sample code + +- index.html + +```html + + + + @azure/arm-hybridconnectivity sample + + + + + + + +``` + +## Related projects + +- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/hybridconnectivity/arm-hybridconnectivity/README.png) diff --git a/sdk/hybridconnectivity/arm-hybridconnectivity/package.json b/sdk/hybridconnectivity/arm-hybridconnectivity/package.json new file mode 100644 index 000000000000..1c0918b4f157 --- /dev/null +++ b/sdk/hybridconnectivity/arm-hybridconnectivity/package.json @@ -0,0 +1,59 @@ +{ + "name": "@azure/arm-hybridconnectivity", + "author": "Microsoft Corporation", + "description": "HybridConnectivityManagementAPI Library with typescript type definitions for node.js and browser.", + "version": "1.0.0", + "dependencies": { + "@azure/ms-rest-azure-js": "^2.1.0", + "@azure/ms-rest-js": "^2.2.0", + "@azure/core-auth": "^1.1.4", + "tslib": "^1.10.0" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "license": "MIT", + "main": "./dist/arm-hybridconnectivity.js", + "module": "./esm/hybridConnectivityManagementAPI.js", + "types": "./esm/hybridConnectivityManagementAPI.d.ts", + "devDependencies": { + "typescript": "^3.6.0", + "rollup": "^1.18.0", + "rollup-plugin-node-resolve": "^5.2.0", + "rollup-plugin-sourcemaps": "^0.4.2", + "uglify-js": "^3.6.0" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/hybridconnectivity/arm-hybridconnectivity", + "repository": { + "type": "git", + "url": "https://github.com/Azure/azure-sdk-for-js.git" + }, + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "files": [ + "dist/**/*.js", + "dist/**/*.js.map", + "dist/**/*.d.ts", + "dist/**/*.d.ts.map", + "esm/**/*.js", + "esm/**/*.js.map", + "esm/**/*.d.ts", + "esm/**/*.d.ts.map", + "src/**/*.ts", + "README.md", + "rollup.config.js", + "tsconfig.json" + ], + "scripts": { + "build": "tsc && rollup -c rollup.config.js && npm run minify", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/arm-hybridconnectivity.js.map'\" -o ./dist/arm-hybridconnectivity.min.js ./dist/arm-hybridconnectivity.js", + "prepack": "npm install && npm run build" + }, + "sideEffects": false, + "autoPublish": true +} diff --git a/sdk/hybridconnectivity/arm-hybridconnectivity/rollup.config.js b/sdk/hybridconnectivity/arm-hybridconnectivity/rollup.config.js new file mode 100644 index 000000000000..c4bb4116d682 --- /dev/null +++ b/sdk/hybridconnectivity/arm-hybridconnectivity/rollup.config.js @@ -0,0 +1,37 @@ +import rollup from "rollup"; +import nodeResolve from "rollup-plugin-node-resolve"; +import sourcemaps from "rollup-plugin-sourcemaps"; + +/** + * @type {rollup.RollupFileOptions} + */ +const config = { + input: "./esm/hybridConnectivityManagementAPI.js", + external: [ + "@azure/ms-rest-js", + "@azure/ms-rest-azure-js" + ], + output: { + file: "./dist/arm-hybridconnectivity.js", + format: "umd", + name: "Azure.ArmHybridconnectivity", + sourcemap: true, + globals: { + "@azure/ms-rest-js": "msRest", + "@azure/ms-rest-azure-js": "msRestAzure" + }, + banner: `/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */` + }, + plugins: [ + nodeResolve({ mainFields: ['module', 'main'] }), + sourcemaps() + ] +}; + +export default config; diff --git a/sdk/hybridconnectivity/arm-hybridconnectivity/src/hybridConnectivityManagementAPI.ts b/sdk/hybridconnectivity/arm-hybridconnectivity/src/hybridConnectivityManagementAPI.ts new file mode 100644 index 000000000000..1ecd13e6ea77 --- /dev/null +++ b/sdk/hybridconnectivity/arm-hybridconnectivity/src/hybridConnectivityManagementAPI.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "@azure/ms-rest-js"; +import { TokenCredential } from "@azure/core-auth"; +import * as Models from "./models"; +import * as Mappers from "./models/mappers"; +import * as operations from "./operations"; +import { HybridConnectivityManagementAPIContext } from "./hybridConnectivityManagementAPIContext"; + + +class HybridConnectivityManagementAPI extends HybridConnectivityManagementAPIContext { + // Operation groups + operations: operations.Operations; + endpoints: operations.Endpoints; + + /** + * Initializes a new instance of the HybridConnectivityManagementAPI class. + * @param credentials Credentials needed for the client to connect to Azure. Credentials + * implementing the TokenCredential interface from the @azure/identity package are recommended. For + * more information about these credentials, see + * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the + * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and + * @azure/ms-rest-browserauth are also supported. + * @param [options] The parameter options + */ + constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, options?: Models.HybridConnectivityManagementAPIOptions) { + super(credentials, options); + this.operations = new operations.Operations(this); + this.endpoints = new operations.Endpoints(this); + } +} + +// Operation Specifications + +export { + HybridConnectivityManagementAPI, + HybridConnectivityManagementAPIContext, + Models as HybridConnectivityManagementAPIModels, + Mappers as HybridConnectivityManagementAPIMappers +}; +export * from "./operations"; diff --git a/sdk/hybridconnectivity/arm-hybridconnectivity/src/hybridConnectivityManagementAPIContext.ts b/sdk/hybridconnectivity/arm-hybridconnectivity/src/hybridConnectivityManagementAPIContext.ts new file mode 100644 index 000000000000..003d4c498f1a --- /dev/null +++ b/sdk/hybridconnectivity/arm-hybridconnectivity/src/hybridConnectivityManagementAPIContext.ts @@ -0,0 +1,61 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as Models from "./models"; +import * as msRest from "@azure/ms-rest-js"; +import * as msRestAzure from "@azure/ms-rest-azure-js"; +import { TokenCredential } from "@azure/core-auth"; + +const packageName = "@azure/arm-hybridconnectivity"; +const packageVersion = "1.0.0"; + +export class HybridConnectivityManagementAPIContext extends msRestAzure.AzureServiceClient { + credentials: msRest.ServiceClientCredentials | TokenCredential; + apiVersion?: string; + + /** + * Initializes a new instance of the HybridConnectivityManagementAPI class. + * @param credentials Credentials needed for the client to connect to Azure. Credentials + * implementing the TokenCredential interface from the @azure/identity package are recommended. For + * more information about these credentials, see + * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the + * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and + * @azure/ms-rest-browserauth are also supported. + * @param [options] The parameter options + */ + constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, options?: Models.HybridConnectivityManagementAPIOptions) { + if (credentials == undefined) { + throw new Error('\'credentials\' cannot be null.'); + } + + if (!options) { + options = {}; + } + if (!options.userAgent) { + const defaultUserAgent = msRestAzure.getDefaultUserAgentValue(); + options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; + } + + super(credentials, options); + + this.apiVersion = '2021-10-06-preview'; + this.acceptLanguage = 'en-US'; + this.longRunningOperationRetryTimeout = 30; + this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com"; + this.requestContentType = "application/json; charset=utf-8"; + this.credentials = credentials; + + if (options.acceptLanguage !== null && options.acceptLanguage !== undefined) { + this.acceptLanguage = options.acceptLanguage; + } + if (options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { + this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; + } + } +} diff --git a/sdk/hybridconnectivity/arm-hybridconnectivity/src/models/endpointsMappers.ts b/sdk/hybridconnectivity/arm-hybridconnectivity/src/models/endpointsMappers.ts new file mode 100644 index 000000000000..f0ddbc948cf2 --- /dev/null +++ b/sdk/hybridconnectivity/arm-hybridconnectivity/src/models/endpointsMappers.ts @@ -0,0 +1,21 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export { + AzureEntityResource, + BaseResource, + EndpointAccessResource, + EndpointResource, + EndpointsList, + ErrorAdditionalInfo, + ErrorDetail, + ErrorResponse, + ProxyResource, + Resource, + TrackedResource +} from "../models/mappers"; diff --git a/sdk/hybridconnectivity/arm-hybridconnectivity/src/models/index.ts b/sdk/hybridconnectivity/arm-hybridconnectivity/src/models/index.ts new file mode 100644 index 000000000000..efba746c9811 --- /dev/null +++ b/sdk/hybridconnectivity/arm-hybridconnectivity/src/models/index.ts @@ -0,0 +1,503 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { BaseResource, CloudError, AzureServiceClientOptions } from "@azure/ms-rest-azure-js"; +import * as msRest from "@azure/ms-rest-js"; + +export { BaseResource, CloudError }; + +/** + * The endpoint access for the target resource. + */ +export interface EndpointAccessResource { + /** + * The namespace name. + */ + namespaceName: string; + /** + * The suffix domain name of relay namespace. + */ + namespaceNameSuffix: string; + /** + * Azure Relay hybrid connection name for the resource. + */ + hybridConnectionName: string; + /** + * Access key for hybrid connection. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly accessKey?: string; + /** + * The expiration of access key in unix time. + */ + expiresOn?: number; +} + +/** + * Common fields that are returned in the response for all Azure Resource Manager resources + * @summary Resource + */ +export interface Resource extends BaseResource { + /** + * Fully qualified resource ID for the resource. Ex - + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly id?: string; + /** + * The name of the resource + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly name?: string; + /** + * The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + * "Microsoft.Storage/storageAccounts" + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly type?: string; +} + +/** + * The resource model definition for a Azure Resource Manager proxy resource. It will not have tags + * and a location + * @summary Proxy Resource + */ +export interface ProxyResource extends Resource { +} + +/** + * The endpoint for the target resource. + */ +export interface EndpointResource extends ProxyResource { + /** + * The identity that created the resource. + */ + createdBy?: string; + /** + * The type of identity that created the resource. Possible values include: 'User', + * 'Application', 'ManagedIdentity', 'Key' + */ + 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. Possible values include: 'User', + * 'Application', 'ManagedIdentity', 'Key' + */ + lastModifiedByType?: CreatedByType; + /** + * The timestamp of resource last modification (UTC) + */ + lastModifiedAt?: Date; + /** + * The type of endpoint. Possible values include: 'default', 'custom' + */ + endpointResourceType: Type; + /** + * The resource Id of the connectivity endpoint (optional). + */ + resourceId?: string; + /** + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly provisioningState?: string; +} + +/** + * The resource model definition for an Azure Resource Manager tracked top level resource which has + * 'tags' and a 'location' + * @summary Tracked Resource + */ +export interface TrackedResource extends Resource { + /** + * Resource tags. + */ + tags?: { [propertyName: string]: string }; + /** + * The geo-location where the resource lives + */ + location: string; +} + +/** + * The resource model definition for an Azure Resource Manager resource with an etag. + * @summary Entity Resource + */ +export interface AzureEntityResource extends Resource { + /** + * Resource Etag. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly etag?: string; +} + +/** + * The resource management error additional info. + */ +export interface ErrorAdditionalInfo { + /** + * The additional info type. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly type?: string; + /** + * The additional info. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly info?: any; +} + +/** + * The error detail. + */ +export interface ErrorDetail { + /** + * The error code. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly code?: string; + /** + * The error message. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly message?: string; + /** + * The error target. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly target?: string; + /** + * The error details. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly details?: ErrorDetail[]; + /** + * The error additional info. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly additionalInfo?: ErrorAdditionalInfo[]; +} + +/** + * Common error response for all Azure Resource Manager APIs to return error details for failed + * operations. (This also follows the OData error response format.). + * @summary Error response + */ +export interface ErrorResponse { + /** + * The error object. + */ + error?: ErrorDetail; +} + +/** + * Localized display information for this particular operation. + */ +export interface OperationDisplay { + /** + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly provider?: string; + /** + * The localized friendly name of the resource type related to this operation. E.g. "Virtual + * Machines" or "Job Schedule Collections". + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly resource?: string; + /** + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create + * or Update Virtual Machine", "Restart Virtual Machine". + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly operation?: string; + /** + * The short, localized friendly description of the operation; suitable for tool tips and + * detailed views. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly description?: string; +} + +/** + * Details of a REST API operation, returned from the Resource Provider Operations API + * @summary REST API Operation + */ +export interface Operation { + /** + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly name?: string; + /** + * Whether the operation applies to data-plane. This is "true" for data-plane operations and + * "false" for ARM/control-plane operations. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly isDataAction?: boolean; + /** + * Localized display information for this particular operation. + */ + display?: OperationDisplay; + /** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + * logs UX. Default value is "user,system". Possible values include: 'user', 'system', + * 'user,system' + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly origin?: Origin; + /** + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + * Possible values include: 'Internal' + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly actionType?: ActionType; +} + +/** + * Optional Parameters. + */ +export interface EndpointsListCredentialsOptionalParams extends msRest.RequestOptionsBase { + /** + * The is how long the endpoint access token is valid (in seconds). Default value: 10800. + */ + expiresin?: number; +} + +/** + * An interface representing HybridConnectivityManagementAPIOptions. + */ +export interface HybridConnectivityManagementAPIOptions extends AzureServiceClientOptions { + baseUri?: string; +} + +/** + * @interface + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link + * to get the next set of results. + * @extends Array + */ +export interface OperationListResult extends Array { + /** + * URL to get the next set of operation list results (if there are any). + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly nextLink?: string; +} + +/** + * @interface + * The list of endpoints. + * @extends Array + */ +export interface EndpointsList extends Array { + /** + * The link used to get the next page of endpoints list. + */ + nextLink?: string; +} + +/** + * Defines values for Type. + * Possible values include: 'default', 'custom' + * @readonly + * @enum {string} + */ +export type Type = 'default' | 'custom'; + +/** + * Defines values for CreatedByType. + * Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + * @readonly + * @enum {string} + */ +export type CreatedByType = 'User' | 'Application' | 'ManagedIdentity' | 'Key'; + +/** + * Defines values for Origin. + * Possible values include: 'user', 'system', 'user,system' + * @readonly + * @enum {string} + */ +export type Origin = 'user' | 'system' | 'user,system'; + +/** + * Defines values for ActionType. + * Possible values include: 'Internal' + * @readonly + * @enum {string} + */ +export type ActionType = 'Internal'; + +/** + * Contains response data for the list operation. + */ +export type OperationsListResponse = OperationListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: OperationListResult; + }; +}; + +/** + * Contains response data for the listNext operation. + */ +export type OperationsListNextResponse = OperationListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: OperationListResult; + }; +}; + +/** + * Contains response data for the list operation. + */ +export type EndpointsListResponse = EndpointsList & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: EndpointsList; + }; +}; + +/** + * Contains response data for the get operation. + */ +export type EndpointsGetResponse = EndpointResource & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: EndpointResource; + }; +}; + +/** + * Contains response data for the createOrUpdate operation. + */ +export type EndpointsCreateOrUpdateResponse = EndpointResource & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: EndpointResource; + }; +}; + +/** + * Contains response data for the update operation. + */ +export type EndpointsUpdateResponse = EndpointResource & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: EndpointResource; + }; +}; + +/** + * Contains response data for the listCredentials operation. + */ +export type EndpointsListCredentialsResponse = EndpointAccessResource & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: EndpointAccessResource; + }; +}; + +/** + * Contains response data for the listNext operation. + */ +export type EndpointsListNextResponse = EndpointsList & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: EndpointsList; + }; +}; diff --git a/sdk/hybridconnectivity/arm-hybridconnectivity/src/models/mappers.ts b/sdk/hybridconnectivity/arm-hybridconnectivity/src/models/mappers.ts new file mode 100644 index 000000000000..b05cb2a123b2 --- /dev/null +++ b/sdk/hybridconnectivity/arm-hybridconnectivity/src/models/mappers.ts @@ -0,0 +1,460 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { CloudErrorMapper, BaseResourceMapper } from "@azure/ms-rest-azure-js"; +import * as msRest from "@azure/ms-rest-js"; + +export const CloudError = CloudErrorMapper; +export const BaseResource = BaseResourceMapper; + +export const EndpointAccessResource: msRest.CompositeMapper = { + serializedName: "EndpointAccessResource", + type: { + name: "Composite", + className: "EndpointAccessResource", + modelProperties: { + namespaceName: { + required: true, + serializedName: "relay.namespaceName", + constraints: { + MaxLength: 200, + MinLength: 1 + }, + type: { + name: "String" + } + }, + namespaceNameSuffix: { + required: true, + serializedName: "relay.namespaceNameSuffix", + constraints: { + MaxLength: 100, + MinLength: 1 + }, + type: { + name: "String" + } + }, + hybridConnectionName: { + required: true, + serializedName: "relay.hybridConnectionName", + type: { + name: "String" + } + }, + accessKey: { + readOnly: true, + serializedName: "relay.accessKey", + type: { + name: "String" + } + }, + expiresOn: { + serializedName: "relay.expiresOn", + type: { + name: "Number" + } + } + } + } +}; + +export const Resource: msRest.CompositeMapper = { + serializedName: "Resource", + type: { + name: "Composite", + className: "Resource", + modelProperties: { + id: { + readOnly: true, + serializedName: "id", + type: { + name: "String" + } + }, + name: { + readOnly: true, + serializedName: "name", + type: { + name: "String" + } + }, + type: { + readOnly: true, + serializedName: "type", + type: { + name: "String" + } + } + } + } +}; + +export const ProxyResource: msRest.CompositeMapper = { + serializedName: "ProxyResource", + type: { + name: "Composite", + className: "ProxyResource", + modelProperties: { + ...Resource.type.modelProperties + } + } +}; + +export const EndpointResource: msRest.CompositeMapper = { + serializedName: "EndpointResource", + type: { + name: "Composite", + className: "EndpointResource", + modelProperties: { + ...ProxyResource.type.modelProperties, + createdBy: { + serializedName: "systemData.createdBy", + type: { + name: "String" + } + }, + createdByType: { + serializedName: "systemData.createdByType", + type: { + name: "String" + } + }, + createdAt: { + serializedName: "systemData.createdAt", + type: { + name: "DateTime" + } + }, + lastModifiedBy: { + serializedName: "systemData.lastModifiedBy", + type: { + name: "String" + } + }, + lastModifiedByType: { + serializedName: "systemData.lastModifiedByType", + type: { + name: "String" + } + }, + lastModifiedAt: { + serializedName: "systemData.lastModifiedAt", + type: { + name: "DateTime" + } + }, + endpointResourceType: { + required: true, + serializedName: "properties.type", + type: { + name: "String" + } + }, + resourceId: { + serializedName: "properties.resourceId", + type: { + name: "String" + } + }, + provisioningState: { + readOnly: true, + serializedName: "properties.provisioningState", + type: { + name: "String" + } + } + } + } +}; + +export const TrackedResource: msRest.CompositeMapper = { + serializedName: "TrackedResource", + type: { + name: "Composite", + className: "TrackedResource", + modelProperties: { + ...Resource.type.modelProperties, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { + type: { + name: "String" + } + } + } + }, + location: { + required: true, + serializedName: "location", + type: { + name: "String" + } + } + } + } +}; + +export const AzureEntityResource: msRest.CompositeMapper = { + serializedName: "AzureEntityResource", + type: { + name: "Composite", + className: "AzureEntityResource", + modelProperties: { + ...Resource.type.modelProperties, + etag: { + readOnly: true, + serializedName: "etag", + type: { + name: "String" + } + } + } + } +}; + +export const ErrorAdditionalInfo: msRest.CompositeMapper = { + serializedName: "ErrorAdditionalInfo", + type: { + name: "Composite", + className: "ErrorAdditionalInfo", + modelProperties: { + type: { + readOnly: true, + serializedName: "type", + type: { + name: "String" + } + }, + info: { + readOnly: true, + serializedName: "info", + type: { + name: "Object" + } + } + } + } +}; + +export const ErrorDetail: msRest.CompositeMapper = { + serializedName: "ErrorDetail", + type: { + name: "Composite", + className: "ErrorDetail", + modelProperties: { + code: { + readOnly: true, + serializedName: "code", + type: { + name: "String" + } + }, + message: { + readOnly: true, + serializedName: "message", + type: { + name: "String" + } + }, + target: { + readOnly: true, + serializedName: "target", + type: { + name: "String" + } + }, + details: { + readOnly: true, + serializedName: "details", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + }, + additionalInfo: { + readOnly: true, + serializedName: "additionalInfo", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorAdditionalInfo" + } + } + } + } + } + } +}; + +export const ErrorResponse: msRest.CompositeMapper = { + serializedName: "ErrorResponse", + type: { + name: "Composite", + className: "ErrorResponse", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + } +}; + +export const OperationDisplay: msRest.CompositeMapper = { + serializedName: "Operation_display", + type: { + name: "Composite", + className: "OperationDisplay", + modelProperties: { + provider: { + readOnly: true, + serializedName: "provider", + type: { + name: "String" + } + }, + resource: { + readOnly: true, + serializedName: "resource", + type: { + name: "String" + } + }, + operation: { + readOnly: true, + serializedName: "operation", + type: { + name: "String" + } + }, + description: { + readOnly: true, + serializedName: "description", + type: { + name: "String" + } + } + } + } +}; + +export const Operation: msRest.CompositeMapper = { + serializedName: "Operation", + type: { + name: "Composite", + className: "Operation", + modelProperties: { + name: { + readOnly: true, + serializedName: "name", + type: { + name: "String" + } + }, + isDataAction: { + readOnly: true, + serializedName: "isDataAction", + type: { + name: "Boolean" + } + }, + display: { + serializedName: "display", + type: { + name: "Composite", + className: "OperationDisplay" + } + }, + origin: { + readOnly: true, + serializedName: "origin", + type: { + name: "String" + } + }, + actionType: { + readOnly: true, + serializedName: "actionType", + type: { + name: "String" + } + } + } + } +}; + +export const OperationListResult: msRest.CompositeMapper = { + serializedName: "OperationListResult", + type: { + name: "Composite", + className: "OperationListResult", + modelProperties: { + value: { + readOnly: true, + serializedName: "", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Operation" + } + } + } + }, + nextLink: { + readOnly: true, + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const EndpointsList: msRest.CompositeMapper = { + serializedName: "EndpointsList", + type: { + name: "Composite", + className: "EndpointsList", + modelProperties: { + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + }, + value: { + serializedName: "", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "EndpointResource" + } + } + } + } + } + } +}; diff --git a/sdk/hybridconnectivity/arm-hybridconnectivity/src/models/operationsMappers.ts b/sdk/hybridconnectivity/arm-hybridconnectivity/src/models/operationsMappers.ts new file mode 100644 index 000000000000..fddc3077d64b --- /dev/null +++ b/sdk/hybridconnectivity/arm-hybridconnectivity/src/models/operationsMappers.ts @@ -0,0 +1,16 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export { + ErrorAdditionalInfo, + ErrorDetail, + ErrorResponse, + Operation, + OperationDisplay, + OperationListResult +} from "../models/mappers"; diff --git a/sdk/hybridconnectivity/arm-hybridconnectivity/src/models/parameters.ts b/sdk/hybridconnectivity/arm-hybridconnectivity/src/models/parameters.ts new file mode 100644 index 000000000000..30d85164c36c --- /dev/null +++ b/sdk/hybridconnectivity/arm-hybridconnectivity/src/models/parameters.ts @@ -0,0 +1,84 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "@azure/ms-rest-js"; + +export const acceptLanguage: msRest.OperationParameter = { + parameterPath: "acceptLanguage", + mapper: { + serializedName: "accept-language", + defaultValue: 'en-US', + type: { + name: "String" + } + } +}; +export const apiVersion: msRest.OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + required: true, + serializedName: "api-version", + constraints: { + MinLength: 1 + }, + type: { + name: "String" + } + } +}; +export const endpointName: msRest.OperationURLParameter = { + parameterPath: "endpointName", + mapper: { + required: true, + serializedName: "endpointName", + type: { + name: "String" + } + }, + skipEncoding: true +}; +export const expiresin: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "expiresin" + ], + mapper: { + serializedName: "expiresin", + defaultValue: 10800, + constraints: { + InclusiveMaximum: 10800, + InclusiveMinimum: 600 + }, + type: { + name: "Number" + } + } +}; +export const nextPageLink: msRest.OperationURLParameter = { + parameterPath: "nextPageLink", + mapper: { + required: true, + serializedName: "nextLink", + type: { + name: "String" + } + }, + skipEncoding: true +}; +export const resourceUri: msRest.OperationURLParameter = { + parameterPath: "resourceUri", + mapper: { + required: true, + serializedName: "resourceUri", + type: { + name: "String" + } + }, + skipEncoding: true +}; diff --git a/sdk/hybridconnectivity/arm-hybridconnectivity/src/operations/endpoints.ts b/sdk/hybridconnectivity/arm-hybridconnectivity/src/operations/endpoints.ts new file mode 100644 index 000000000000..37945569b68d --- /dev/null +++ b/sdk/hybridconnectivity/arm-hybridconnectivity/src/operations/endpoints.ts @@ -0,0 +1,452 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "@azure/ms-rest-js"; +import * as Models from "../models"; +import * as Mappers from "../models/endpointsMappers"; +import * as Parameters from "../models/parameters"; +import { HybridConnectivityManagementAPIContext } from "../hybridConnectivityManagementAPIContext"; + +/** Class representing a Endpoints. */ +export class Endpoints { + private readonly client: HybridConnectivityManagementAPIContext; + + /** + * Create a Endpoints. + * @param {HybridConnectivityManagementAPIContext} client Reference to the service client. + */ + constructor(client: HybridConnectivityManagementAPIContext) { + this.client = client; + } + + /** + * List of endpoints to the target resource. + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be + * connected. + * @param [options] The optional parameters + * @returns Promise + */ + list(resourceUri: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be + * connected. + * @param callback The callback + */ + list(resourceUri: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be + * connected. + * @param options The optional parameters + * @param callback The callback + */ + list(resourceUri: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + list(resourceUri: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceUri, + options + }, + listOperationSpec, + callback) as Promise; + } + + /** + * Gets the endpoint to the resource. + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be + * connected. + * @param endpointName The endpoint name. + * @param [options] The optional parameters + * @returns Promise + */ + get(resourceUri: string, endpointName: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be + * connected. + * @param endpointName The endpoint name. + * @param callback The callback + */ + get(resourceUri: string, endpointName: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be + * connected. + * @param endpointName The endpoint name. + * @param options The optional parameters + * @param callback The callback + */ + get(resourceUri: string, endpointName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + get(resourceUri: string, endpointName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceUri, + endpointName, + options + }, + getOperationSpec, + callback) as Promise; + } + + /** + * Create or update the endpoint to the target resource. + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be + * connected. + * @param endpointName The endpoint name. + * @param endpointResource Endpoint details + * @param [options] The optional parameters + * @returns Promise + */ + createOrUpdate(resourceUri: string, endpointName: string, endpointResource: Models.EndpointResource, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be + * connected. + * @param endpointName The endpoint name. + * @param endpointResource Endpoint details + * @param callback The callback + */ + createOrUpdate(resourceUri: string, endpointName: string, endpointResource: Models.EndpointResource, callback: msRest.ServiceCallback): void; + /** + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be + * connected. + * @param endpointName The endpoint name. + * @param endpointResource Endpoint details + * @param options The optional parameters + * @param callback The callback + */ + createOrUpdate(resourceUri: string, endpointName: string, endpointResource: Models.EndpointResource, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + createOrUpdate(resourceUri: string, endpointName: string, endpointResource: Models.EndpointResource, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceUri, + endpointName, + endpointResource, + options + }, + createOrUpdateOperationSpec, + callback) as Promise; + } + + /** + * Update the endpoint to the target resource. + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be + * connected. + * @param endpointName The endpoint name. + * @param endpointResource Endpoint details + * @param [options] The optional parameters + * @returns Promise + */ + update(resourceUri: string, endpointName: string, endpointResource: Models.EndpointResource, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be + * connected. + * @param endpointName The endpoint name. + * @param endpointResource Endpoint details + * @param callback The callback + */ + update(resourceUri: string, endpointName: string, endpointResource: Models.EndpointResource, callback: msRest.ServiceCallback): void; + /** + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be + * connected. + * @param endpointName The endpoint name. + * @param endpointResource Endpoint details + * @param options The optional parameters + * @param callback The callback + */ + update(resourceUri: string, endpointName: string, endpointResource: Models.EndpointResource, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + update(resourceUri: string, endpointName: string, endpointResource: Models.EndpointResource, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceUri, + endpointName, + endpointResource, + options + }, + updateOperationSpec, + callback) as Promise; + } + + /** + * Deletes the endpoint access to the target resource. + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be + * connected. + * @param endpointName The endpoint name. + * @param [options] The optional parameters + * @returns Promise + */ + deleteMethod(resourceUri: string, endpointName: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be + * connected. + * @param endpointName The endpoint name. + * @param callback The callback + */ + deleteMethod(resourceUri: string, endpointName: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be + * connected. + * @param endpointName The endpoint name. + * @param options The optional parameters + * @param callback The callback + */ + deleteMethod(resourceUri: string, endpointName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + deleteMethod(resourceUri: string, endpointName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceUri, + endpointName, + options + }, + deleteMethodOperationSpec, + callback); + } + + /** + * Gets the endpoint access credentials to the resource. + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be + * connected. + * @param endpointName The endpoint name. + * @param [options] The optional parameters + * @returns Promise + */ + listCredentials(resourceUri: string, endpointName: string, options?: Models.EndpointsListCredentialsOptionalParams): Promise; + /** + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be + * connected. + * @param endpointName The endpoint name. + * @param callback The callback + */ + listCredentials(resourceUri: string, endpointName: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be + * connected. + * @param endpointName The endpoint name. + * @param options The optional parameters + * @param callback The callback + */ + listCredentials(resourceUri: string, endpointName: string, options: Models.EndpointsListCredentialsOptionalParams, callback: msRest.ServiceCallback): void; + listCredentials(resourceUri: string, endpointName: string, options?: Models.EndpointsListCredentialsOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceUri, + endpointName, + options + }, + listCredentialsOperationSpec, + callback) as Promise; + } + + /** + * List of endpoints to the target resource. + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param [options] The optional parameters + * @returns Promise + */ + listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param callback The callback + */ + listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param options The optional parameters + * @param callback The callback + */ + listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + options + }, + listNextOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints", + urlParameters: [ + Parameters.resourceUri + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.EndpointsList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const getOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}", + urlParameters: [ + Parameters.resourceUri, + Parameters.endpointName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.EndpointResource + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const createOrUpdateOperationSpec: msRest.OperationSpec = { + httpMethod: "PUT", + path: "{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}", + urlParameters: [ + Parameters.resourceUri, + Parameters.endpointName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: "endpointResource", + mapper: { + ...Mappers.EndpointResource, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.EndpointResource + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const updateOperationSpec: msRest.OperationSpec = { + httpMethod: "PATCH", + path: "{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}", + urlParameters: [ + Parameters.resourceUri, + Parameters.endpointName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: "endpointResource", + mapper: { + ...Mappers.EndpointResource, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.EndpointResource + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const deleteMethodOperationSpec: msRest.OperationSpec = { + httpMethod: "DELETE", + path: "{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}", + urlParameters: [ + Parameters.resourceUri, + Parameters.endpointName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const listCredentialsOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/listCredentials", + urlParameters: [ + Parameters.resourceUri, + Parameters.endpointName + ], + queryParameters: [ + Parameters.apiVersion, + Parameters.expiresin + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.EndpointAccessResource + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const listNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.EndpointsList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; diff --git a/sdk/hybridconnectivity/arm-hybridconnectivity/src/operations/index.ts b/sdk/hybridconnectivity/arm-hybridconnectivity/src/operations/index.ts new file mode 100644 index 000000000000..dfdea8877506 --- /dev/null +++ b/sdk/hybridconnectivity/arm-hybridconnectivity/src/operations/index.ts @@ -0,0 +1,11 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +export * from "./operations"; +export * from "./endpoints"; diff --git a/sdk/hybridconnectivity/arm-hybridconnectivity/src/operations/operations.ts b/sdk/hybridconnectivity/arm-hybridconnectivity/src/operations/operations.ts new file mode 100644 index 000000000000..785bbbfd3596 --- /dev/null +++ b/sdk/hybridconnectivity/arm-hybridconnectivity/src/operations/operations.ts @@ -0,0 +1,125 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "@azure/ms-rest-js"; +import * as Models from "../models"; +import * as Mappers from "../models/operationsMappers"; +import * as Parameters from "../models/parameters"; +import { HybridConnectivityManagementAPIContext } from "../hybridConnectivityManagementAPIContext"; + +/** Class representing a Operations. */ +export class Operations { + private readonly client: HybridConnectivityManagementAPIContext; + + /** + * Create a Operations. + * @param {HybridConnectivityManagementAPIContext} client Reference to the service client. + */ + constructor(client: HybridConnectivityManagementAPIContext) { + this.client = client; + } + + /** + * Lists the available Hybrid Connectivity REST API operations. + * @param [options] The optional parameters + * @returns Promise + */ + list(options?: msRest.RequestOptionsBase): Promise; + /** + * @param callback The callback + */ + list(callback: msRest.ServiceCallback): void; + /** + * @param options The optional parameters + * @param callback The callback + */ + list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + options + }, + listOperationSpec, + callback) as Promise; + } + + /** + * Lists the available Hybrid Connectivity REST API operations. + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param [options] The optional parameters + * @returns Promise + */ + listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param callback The callback + */ + listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param options The optional parameters + * @param callback The callback + */ + listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + options + }, + listNextOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "providers/Microsoft.HybridConnectivity/operations", + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.OperationListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const listNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.OperationListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; diff --git a/sdk/hybridconnectivity/arm-hybridconnectivity/tsconfig.json b/sdk/hybridconnectivity/arm-hybridconnectivity/tsconfig.json new file mode 100644 index 000000000000..422b584abd5e --- /dev/null +++ b/sdk/hybridconnectivity/arm-hybridconnectivity/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "es6", + "moduleResolution": "node", + "strict": true, + "target": "es5", + "sourceMap": true, + "declarationMap": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "lib": ["es6", "dom"], + "declaration": true, + "outDir": "./esm", + "importHelpers": true + }, + "include": ["./src/**/*.ts"], + "exclude": ["node_modules"] +}