diff --git a/sdk/marketplacenotifications/arm-marketplacenotifications/LICENSE.txt b/sdk/marketplacenotifications/arm-marketplacenotifications/LICENSE.txt new file mode 100644 index 000000000000..2d3163745319 --- /dev/null +++ b/sdk/marketplacenotifications/arm-marketplacenotifications/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/marketplacenotifications/arm-marketplacenotifications/README.md b/sdk/marketplacenotifications/arm-marketplacenotifications/README.md new file mode 100644 index 000000000000..5e0762920d48 --- /dev/null +++ b/sdk/marketplacenotifications/arm-marketplacenotifications/README.md @@ -0,0 +1,100 @@ +## Azure MarketplacenotificationsClient SDK for JavaScript + +This package contains an isomorphic SDK for MarketplacenotificationsClient. + +### Currently supported environments + +- Node.js version 6.x.x or higher +- Browser JavaScript + +### How to Install + +```bash +npm install @azure/arm-marketplacenotifications +``` + +### How to use + +#### nodejs - client creation and get operationGroup as an example written in TypeScript. + +##### Install @azure/ms-rest-nodeauth + +- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`. +```bash +npm install @azure/ms-rest-nodeauth@"^3.0.0" +``` + +##### Sample code + +While the below sample uses the interactive login, other authentication options can be found in the [README.md file of @azure/ms-rest-nodeauth](https://www.npmjs.com/package/@azure/ms-rest-nodeauth) package +```typescript +const msRestNodeAuth = require("@azure/ms-rest-nodeauth"); +const { MarketplacenotificationsClient } = require("@azure/arm-marketplacenotifications"); +const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; + +msRestNodeAuth.interactiveLogin().then((creds) => { + const client = new MarketplacenotificationsClient(creds, subscriptionId); + const resourceGroupName = "testresourceGroupName"; + client.operationGroup.get(resourceGroupName).then((result) => { + console.log("The result is:"); + console.log(result); + }); +}).catch((err) => { + console.error(err); +}); +``` + +#### browser - Authentication, client creation and get operationGroup as an example written in JavaScript. + +##### Install @azure/ms-rest-browserauth + +```bash +npm install @azure/ms-rest-browserauth +``` + +##### Sample code + +See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser. + +- index.html +```html + + + + @azure/arm-marketplacenotifications 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/marketplacenotifications/arm-marketplacenotifications/README.png) diff --git a/sdk/marketplacenotifications/arm-marketplacenotifications/package.json b/sdk/marketplacenotifications/arm-marketplacenotifications/package.json new file mode 100644 index 000000000000..3c325e81b725 --- /dev/null +++ b/sdk/marketplacenotifications/arm-marketplacenotifications/package.json @@ -0,0 +1,58 @@ +{ + "name": "@azure/arm-marketplacenotifications", + "author": "Microsoft Corporation", + "description": "MarketplacenotificationsClient Library with typescript type definitions for node.js and browser.", + "version": "1.0.0", + "dependencies": { + "@azure/ms-rest-azure-js": "^2.0.1", + "@azure/ms-rest-js": "^2.0.4", + "tslib": "^1.10.0" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "license": "MIT", + "main": "./dist/arm-marketplacenotifications.js", + "module": "./esm/marketplacenotificationsClient.js", + "types": "./esm/marketplacenotificationsClient.d.ts", + "devDependencies": { + "typescript": "^3.5.3", + "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/marketplacenotifications/arm-marketplacenotifications", + "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-marketplacenotifications.js.map'\" -o ./dist/arm-marketplacenotifications.min.js ./dist/arm-marketplacenotifications.js", + "prepack": "npm install && npm run build" + }, + "sideEffects": false, + "autoPublish": true +} diff --git a/sdk/marketplacenotifications/arm-marketplacenotifications/rollup.config.js b/sdk/marketplacenotifications/arm-marketplacenotifications/rollup.config.js new file mode 100644 index 000000000000..311c6626120f --- /dev/null +++ b/sdk/marketplacenotifications/arm-marketplacenotifications/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/marketplacenotificationsClient.js", + external: [ + "@azure/ms-rest-js", + "@azure/ms-rest-azure-js" + ], + output: { + file: "./dist/arm-marketplacenotifications.js", + format: "umd", + name: "Azure.ArmMarketplacenotifications", + 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/marketplacenotifications/arm-marketplacenotifications/src/marketplacenotificationsClient.ts b/sdk/marketplacenotifications/arm-marketplacenotifications/src/marketplacenotificationsClient.ts new file mode 100644 index 000000000000..a14d7535f271 --- /dev/null +++ b/sdk/marketplacenotifications/arm-marketplacenotifications/src/marketplacenotificationsClient.ts @@ -0,0 +1,42 @@ +/* + * 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/mappers"; +import * as operations from "./operations"; +import { MarketplacenotificationsClientContext } from "./marketplacenotificationsClientContext"; + + +class MarketplacenotificationsClient extends MarketplacenotificationsClientContext { + // Operation groups + operationGroup: operations.OperationGroup; + + /** + * Initializes a new instance of the MarketplacenotificationsClient class. + * @param credentials Credentials needed for the client to connect to Azure. + * @param subscriptionId The Azure subscription ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000) + * @param [options] The parameter options + */ + constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.MarketplacenotificationsClientOptions) { + super(credentials, subscriptionId, options); + this.operationGroup = new operations.OperationGroup(this); + } +} + +// Operation Specifications + +export { + MarketplacenotificationsClient, + MarketplacenotificationsClientContext, + Models as MarketplacenotificationsModels, + Mappers as MarketplacenotificationsMappers +}; +export * from "./operations"; diff --git a/sdk/marketplacenotifications/arm-marketplacenotifications/src/marketplacenotificationsClientContext.ts b/sdk/marketplacenotifications/arm-marketplacenotifications/src/marketplacenotificationsClientContext.ts new file mode 100644 index 000000000000..4bef6c12a100 --- /dev/null +++ b/sdk/marketplacenotifications/arm-marketplacenotifications/src/marketplacenotificationsClientContext.ts @@ -0,0 +1,62 @@ +/* + * 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"; + +const packageName = "@azure/arm-marketplacenotifications"; +const packageVersion = "1.0.0"; + +export class MarketplacenotificationsClientContext extends msRestAzure.AzureServiceClient { + credentials: msRest.ServiceClientCredentials; + subscriptionId: string; + apiVersion?: string; + + /** + * Initializes a new instance of the MarketplacenotificationsClient class. + * @param credentials Credentials needed for the client to connect to Azure. + * @param subscriptionId The Azure subscription ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000) + * @param [options] The parameter options + */ + constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.MarketplacenotificationsClientOptions) { + if (credentials == undefined) { + throw new Error('\'credentials\' cannot be null.'); + } + if (subscriptionId == undefined) { + throw new Error('\'subscriptionId\' cannot be null.'); + } + + if (!options) { + options = {}; + } + if(!options.userAgent) { + const defaultUserAgent = msRestAzure.getDefaultUserAgentValue(); + options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; + } + + super(credentials, options); + + this.apiVersion = '2021-03-03'; + 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; + this.subscriptionId = subscriptionId; + + 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/marketplacenotifications/arm-marketplacenotifications/src/models/index.ts b/sdk/marketplacenotifications/arm-marketplacenotifications/src/models/index.ts new file mode 100644 index 000000000000..464baee9cdaf --- /dev/null +++ b/sdk/marketplacenotifications/arm-marketplacenotifications/src/models/index.ts @@ -0,0 +1,80 @@ +/* + * 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 }; + +/** + * Sample result definition + */ +export interface Result { + /** + * Sample property of type string + */ + sampleProperty?: string; +} + +/** + * Error definition. + */ +export interface ErrorDefinition { + /** + * Service specific error code which serves as the substatus for the HTTP error code. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly code?: string; + /** + * Description of the error. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly message?: string; + /** + * Internal error details. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly details?: ErrorDefinition[]; +} + +/** + * Error response. + */ +export interface ErrorResponse { + /** + * The error details. + */ + error?: ErrorDefinition; +} + +/** + * An interface representing MarketplacenotificationsClientOptions. + */ +export interface MarketplacenotificationsClientOptions extends AzureServiceClientOptions { + baseUri?: string; +} + +/** + * Contains response data for the get operation. + */ +export type OperationGroupGetResponse = Result & { + /** + * 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: Result; + }; +}; diff --git a/sdk/marketplacenotifications/arm-marketplacenotifications/src/models/mappers.ts b/sdk/marketplacenotifications/arm-marketplacenotifications/src/models/mappers.ts new file mode 100644 index 000000000000..a18e9521d00e --- /dev/null +++ b/sdk/marketplacenotifications/arm-marketplacenotifications/src/models/mappers.ts @@ -0,0 +1,83 @@ +/* + * 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 Result: msRest.CompositeMapper = { + serializedName: "Result", + type: { + name: "Composite", + className: "Result", + modelProperties: { + sampleProperty: { + serializedName: "sampleProperty", + type: { + name: "String" + } + } + } + } +}; + +export const ErrorDefinition: msRest.CompositeMapper = { + serializedName: "ErrorDefinition", + type: { + name: "Composite", + className: "ErrorDefinition", + modelProperties: { + code: { + readOnly: true, + serializedName: "code", + type: { + name: "String" + } + }, + message: { + readOnly: true, + serializedName: "message", + type: { + name: "String" + } + }, + details: { + readOnly: true, + serializedName: "details", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorDefinition" + } + } + } + } + } + } +}; + +export const ErrorResponse: msRest.CompositeMapper = { + serializedName: "ErrorResponse", + type: { + name: "Composite", + className: "ErrorResponse", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorDefinition" + } + } + } + } +}; diff --git a/sdk/marketplacenotifications/arm-marketplacenotifications/src/models/operationGroupMappers.ts b/sdk/marketplacenotifications/arm-marketplacenotifications/src/models/operationGroupMappers.ts new file mode 100644 index 000000000000..4e40dbe1a8c3 --- /dev/null +++ b/sdk/marketplacenotifications/arm-marketplacenotifications/src/models/operationGroupMappers.ts @@ -0,0 +1,13 @@ +/* + * 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 { + ErrorDefinition, + ErrorResponse, + Result +} from "../models/mappers"; diff --git a/sdk/marketplacenotifications/arm-marketplacenotifications/src/models/parameters.ts b/sdk/marketplacenotifications/arm-marketplacenotifications/src/models/parameters.ts new file mode 100644 index 000000000000..295a698b7c9d --- /dev/null +++ b/sdk/marketplacenotifications/arm-marketplacenotifications/src/models/parameters.ts @@ -0,0 +1,41 @@ +/* + * 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 resourceGroupName: msRest.OperationURLParameter = { + parameterPath: "resourceGroupName", + mapper: { + required: true, + serializedName: "resourceGroupName", + type: { + name: "String" + } + } +}; +export const subscriptionId: msRest.OperationURLParameter = { + parameterPath: "subscriptionId", + mapper: { + required: true, + serializedName: "subscriptionId", + type: { + name: "String" + } + } +}; diff --git a/sdk/marketplacenotifications/arm-marketplacenotifications/src/operations/index.ts b/sdk/marketplacenotifications/arm-marketplacenotifications/src/operations/index.ts new file mode 100644 index 000000000000..4616427b60e2 --- /dev/null +++ b/sdk/marketplacenotifications/arm-marketplacenotifications/src/operations/index.ts @@ -0,0 +1,10 @@ +/* + * 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 "./operationGroup"; diff --git a/sdk/marketplacenotifications/arm-marketplacenotifications/src/operations/operationGroup.ts b/sdk/marketplacenotifications/arm-marketplacenotifications/src/operations/operationGroup.ts new file mode 100644 index 000000000000..409f29c5983d --- /dev/null +++ b/sdk/marketplacenotifications/arm-marketplacenotifications/src/operations/operationGroup.ts @@ -0,0 +1,79 @@ +/* + * 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/operationGroupMappers"; +import * as Parameters from "../models/parameters"; +import { MarketplacenotificationsClientContext } from "../marketplacenotificationsClientContext"; + +/** Class representing a OperationGroup. */ +export class OperationGroup { + private readonly client: MarketplacenotificationsClientContext; + + /** + * Create a OperationGroup. + * @param {MarketplacenotificationsClientContext} client Reference to the service client. + */ + constructor(client: MarketplacenotificationsClientContext) { + this.client = client; + } + + /** + * This is a sample get operation, please see guidelines in azure-rest-api-specs repository for + * more info + * @param resourceGroupName The name of the resource group. + * @param [options] The optional parameters + * @returns Promise + */ + get(resourceGroupName: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceGroupName The name of the resource group. + * @param callback The callback + */ + get(resourceGroupName: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group. + * @param options The optional parameters + * @param callback The callback + */ + get(resourceGroupName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + get(resourceGroupName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + options + }, + getOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const getOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MarketplaceNotifications/operations", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.Result + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; diff --git a/sdk/marketplacenotifications/arm-marketplacenotifications/tsconfig.json b/sdk/marketplacenotifications/arm-marketplacenotifications/tsconfig.json new file mode 100644 index 000000000000..422b584abd5e --- /dev/null +++ b/sdk/marketplacenotifications/arm-marketplacenotifications/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"] +}