From c4120bd7229cf5fc3052263a82604504129c60b4 Mon Sep 17 00:00:00 2001 From: colawwj <70128817+colawwj@users.noreply.github.com> Date: Tue, 17 Nov 2020 16:13:02 +0800 Subject: [PATCH] azure-arm_attestation (#12437) --- sdk/attestation/arm-attestation/LICENSE.txt | 21 + sdk/attestation/arm-attestation/README.md | 99 ++++ sdk/attestation/arm-attestation/package.json | 58 ++ .../arm-attestation/rollup.config.js | 37 ++ .../src/attestationManagementClient.ts | 44 ++ .../src/attestationManagementClientContext.ts | 62 ++ .../src/models/attestationProvidersMappers.ts | 24 + .../arm-attestation/src/models/index.ts | 528 ++++++++++++++++++ .../arm-attestation/src/models/mappers.ts | 519 +++++++++++++++++ .../src/models/operationsMappers.ts | 15 + .../arm-attestation/src/models/parameters.ts | 83 +++ .../src/operations/attestationProviders.ts | 481 ++++++++++++++++ .../arm-attestation/src/operations/index.ts | 12 + .../src/operations/operations.ts | 74 +++ sdk/attestation/arm-attestation/tsconfig.json | 19 + 15 files changed, 2076 insertions(+) create mode 100644 sdk/attestation/arm-attestation/LICENSE.txt create mode 100644 sdk/attestation/arm-attestation/README.md create mode 100644 sdk/attestation/arm-attestation/package.json create mode 100644 sdk/attestation/arm-attestation/rollup.config.js create mode 100644 sdk/attestation/arm-attestation/src/attestationManagementClient.ts create mode 100644 sdk/attestation/arm-attestation/src/attestationManagementClientContext.ts create mode 100644 sdk/attestation/arm-attestation/src/models/attestationProvidersMappers.ts create mode 100644 sdk/attestation/arm-attestation/src/models/index.ts create mode 100644 sdk/attestation/arm-attestation/src/models/mappers.ts create mode 100644 sdk/attestation/arm-attestation/src/models/operationsMappers.ts create mode 100644 sdk/attestation/arm-attestation/src/models/parameters.ts create mode 100644 sdk/attestation/arm-attestation/src/operations/attestationProviders.ts create mode 100644 sdk/attestation/arm-attestation/src/operations/index.ts create mode 100644 sdk/attestation/arm-attestation/src/operations/operations.ts create mode 100644 sdk/attestation/arm-attestation/tsconfig.json diff --git a/sdk/attestation/arm-attestation/LICENSE.txt b/sdk/attestation/arm-attestation/LICENSE.txt new file mode 100644 index 000000000000..ea8fb1516028 --- /dev/null +++ b/sdk/attestation/arm-attestation/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2020 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/attestation/arm-attestation/README.md b/sdk/attestation/arm-attestation/README.md new file mode 100644 index 000000000000..08a634ff796d --- /dev/null +++ b/sdk/attestation/arm-attestation/README.md @@ -0,0 +1,99 @@ +## Azure AttestationManagementClient SDK for JavaScript + +This package contains an isomorphic SDK for AttestationManagementClient. + +### Currently supported environments + +- Node.js version 6.x.x or higher +- Browser JavaScript + +### How to Install + +```bash +npm install @azure/arm-attestation +``` + +### How to use + +#### nodejs - Authentication, client creation and list operations 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 + +```typescript +import * as msRest from "@azure/ms-rest-js"; +import * as msRestAzure from "@azure/ms-rest-azure-js"; +import * as msRestNodeAuth from "@azure/ms-rest-nodeauth"; +import { AttestationManagementClient, AttestationManagementModels, AttestationManagementMappers } from "@azure/arm-attestation"; +const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; + +msRestNodeAuth.interactiveLogin().then((creds) => { + const client = new AttestationManagementClient(creds, subscriptionId); + client.operations.list().then((result) => { + console.log("The result is:"); + console.log(result); + }); +}).catch((err) => { + console.error(err); +}); +``` + +#### browser - Authentication, client creation and list operations 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-attestation 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/attestation/arm-attestation/README.png) diff --git a/sdk/attestation/arm-attestation/package.json b/sdk/attestation/arm-attestation/package.json new file mode 100644 index 000000000000..109eab318b34 --- /dev/null +++ b/sdk/attestation/arm-attestation/package.json @@ -0,0 +1,58 @@ +{ + "name": "@azure/arm-attestation", + "author": "Microsoft Corporation", + "description": "AttestationManagementClient 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-attestation.js", + "module": "./esm/attestationManagementClient.js", + "types": "./esm/attestationManagementClient.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/attestation/arm-attestation", + "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-attestation.js.map'\" -o ./dist/arm-attestation.min.js ./dist/arm-attestation.js", + "prepack": "npm install && npm run build" + }, + "sideEffects": false, + "autoPublish": true +} diff --git a/sdk/attestation/arm-attestation/rollup.config.js b/sdk/attestation/arm-attestation/rollup.config.js new file mode 100644 index 000000000000..562646229ed1 --- /dev/null +++ b/sdk/attestation/arm-attestation/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/attestationManagementClient.js", + external: [ + "@azure/ms-rest-js", + "@azure/ms-rest-azure-js" + ], + output: { + file: "./dist/arm-attestation.js", + format: "umd", + name: "Azure.ArmAttestation", + sourcemap: true, + globals: { + "@azure/ms-rest-js": "msRest", + "@azure/ms-rest-azure-js": "msRestAzure" + }, + banner: `/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * + * 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/attestation/arm-attestation/src/attestationManagementClient.ts b/sdk/attestation/arm-attestation/src/attestationManagementClient.ts new file mode 100644 index 000000000000..1657aee1b92f --- /dev/null +++ b/sdk/attestation/arm-attestation/src/attestationManagementClient.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * 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 { AttestationManagementClientContext } from "./attestationManagementClientContext"; + + +class AttestationManagementClient extends AttestationManagementClientContext { + // Operation groups + operations: operations.Operations; + attestationProviders: operations.AttestationProviders; + + /** + * Initializes a new instance of the AttestationManagementClient class. + * @param credentials Credentials needed for the client to connect to Azure. + * @param subscriptionId The ID of the target subscription. + * @param [options] The parameter options + */ + constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.AttestationManagementClientOptions) { + super(credentials, subscriptionId, options); + this.operations = new operations.Operations(this); + this.attestationProviders = new operations.AttestationProviders(this); + } +} + +// Operation Specifications + +export { + AttestationManagementClient, + AttestationManagementClientContext, + Models as AttestationManagementModels, + Mappers as AttestationManagementMappers +}; +export * from "./operations"; diff --git a/sdk/attestation/arm-attestation/src/attestationManagementClientContext.ts b/sdk/attestation/arm-attestation/src/attestationManagementClientContext.ts new file mode 100644 index 000000000000..c07885699d86 --- /dev/null +++ b/sdk/attestation/arm-attestation/src/attestationManagementClientContext.ts @@ -0,0 +1,62 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * 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-attestation"; +const packageVersion = "1.0.0"; + +export class AttestationManagementClientContext extends msRestAzure.AzureServiceClient { + credentials: msRest.ServiceClientCredentials; + apiVersion?: string; + subscriptionId: string; + + /** + * Initializes a new instance of the AttestationManagementClient class. + * @param credentials Credentials needed for the client to connect to Azure. + * @param subscriptionId The ID of the target subscription. + * @param [options] The parameter options + */ + constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.AttestationManagementClientOptions) { + 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 = '2020-10-01'; + 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/attestation/arm-attestation/src/models/attestationProvidersMappers.ts b/sdk/attestation/arm-attestation/src/models/attestationProvidersMappers.ts new file mode 100644 index 000000000000..fcead856c16c --- /dev/null +++ b/sdk/attestation/arm-attestation/src/models/attestationProvidersMappers.ts @@ -0,0 +1,24 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export { + AttestationProvider, + AttestationProviderListResult, + AttestationServiceCreationParams, + AttestationServiceCreationSpecificParams, + AttestationServicePatchParams, + AzureEntityResource, + BaseResource, + CloudError, + JSONWebKey, + JSONWebKeySet, + ProxyResource, + Resource, + SystemData, + TrackedResource +} from "../models/mappers"; diff --git a/sdk/attestation/arm-attestation/src/models/index.ts b/sdk/attestation/arm-attestation/src/models/index.ts new file mode 100644 index 000000000000..9e0198f5ff55 --- /dev/null +++ b/sdk/attestation/arm-attestation/src/models/index.ts @@ -0,0 +1,528 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * + * 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 }; + +/** + * 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. 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 type of identity that last modified the resource. + */ + lastModifiedAt?: Date; +} + +/** + * Display object with properties of the operation. + */ +export interface OperationsDisplayDefinition { + /** + * Resource provider of the operation. + */ + provider?: string; + /** + * Resource for the operation. + */ + resource?: string; + /** + * Short description of the operation. + */ + operation?: string; + /** + * Description of the operation. + */ + description?: string; +} + +/** + * Definition object with the name and properties of an operation. + */ +export interface OperationsDefinition { + /** + * Name of the operation. + */ + name?: string; + /** + * Display object with properties of the operation. + */ + display?: OperationsDisplayDefinition; +} + +/** + * List of supported operations. + */ +export interface OperationList { + /** + * The system metadata relating to this resource + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly systemData?: SystemData; + /** + * List of supported operations. + */ + value?: OperationsDefinition[]; +} + +/** + * 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 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; +} + +/** + * Attestation service response message. + */ +export interface AttestationProvider extends TrackedResource { + /** + * The system metadata relating to this resource + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly systemData?: SystemData; + /** + * Trust model for the attestation service instance. + */ + trustModel?: string; + /** + * Status of attestation service. Possible values include: 'Ready', 'NotReady', 'Error' + */ + status?: AttestationServiceStatus; + /** + * Gets the uri of attestation service + */ + attestUri?: string; +} + +/** + * Attestation Providers List. + */ +export interface AttestationProviderListResult { + /** + * The system metadata relating to this resource + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly systemData?: SystemData; + /** + * Attestation Provider array. + */ + value?: AttestationProvider[]; +} + +/** + * Parameters for patching an attestation service instance + */ +export interface AttestationServicePatchParams extends BaseResource { + /** + * The tags that will be assigned to the attestation service instance. + */ + tags?: { [propertyName: string]: string }; +} + +/** + * An interface representing JSONWebKey. + */ +export interface JSONWebKey { + /** + * The "alg" (algorithm) parameter identifies the algorithm intended for + * use with the key. The values used should either be registered in the + * IANA "JSON Web Signature and Encryption Algorithms" registry + * established by [JWA] or be a value that contains a Collision- + * Resistant Name. + */ + alg: string; + /** + * The "crv" (curve) parameter identifies the curve type + */ + crv?: string; + /** + * RSA private exponent or ECC private key + */ + d?: string; + /** + * RSA Private Key Parameter + */ + dp?: string; + /** + * RSA Private Key Parameter + */ + dq?: string; + /** + * RSA public exponent, in Base64 + */ + e?: string; + /** + * Symmetric key + */ + k?: string; + /** + * The "kid" (key ID) parameter is used to match a specific key. This + * is used, for instance, to choose among a set of keys within a JWK Set + * during key rollover. The structure of the "kid" value is + * unspecified. When "kid" values are used within a JWK Set, different + * keys within the JWK Set SHOULD use distinct "kid" values. (One + * example in which different keys might use the same "kid" value is if + * they have different "kty" (key type) values but are considered to be + * equivalent alternatives by the application using them.) The "kid" + * value is a case-sensitive string. + */ + kid: string; + /** + * The "kty" (key type) parameter identifies the cryptographic algorithm + * family used with the key, such as "RSA" or "EC". "kty" values should + * either be registered in the IANA "JSON Web Key Types" registry + * established by [JWA] or be a value that contains a Collision- + * Resistant Name. The "kty" value is a case-sensitive string. + */ + kty: string; + /** + * RSA modulus, in Base64 + */ + n?: string; + /** + * RSA secret prime + */ + p?: string; + /** + * RSA secret prime, with p < q + */ + q?: string; + /** + * RSA Private Key Parameter + */ + qi?: string; + /** + * Use ("public key use") identifies the intended use of + * the public key. The "use" parameter is employed to indicate whether + * a public key is used for encrypting data or verifying the signature + * on data. Values are commonly "sig" (signature) or "enc" (encryption). + */ + use: string; + /** + * X coordinate for the Elliptic Curve point + */ + x?: string; + /** + * The "x5c" (X.509 certificate chain) parameter contains a chain of one + * or more PKIX certificates [RFC5280]. The certificate chain is + * represented as a JSON array of certificate value strings. Each + * string in the array is a base64-encoded (Section 4 of [RFC4648] -- + * not base64url-encoded) DER [ITU.X690.1994] PKIX certificate value. + * The PKIX certificate containing the key value MUST be the first + * certificate. + */ + x5c?: string[]; + /** + * Y coordinate for the Elliptic Curve point + */ + y?: string; +} + +/** + * An interface representing JSONWebKeySet. + */ +export interface JSONWebKeySet { + /** + * The value of the "keys" parameter is an array of JWK values. By + * default, the order of the JWK values within the array does not imply + * an order of preference among them, although applications of JWK Sets + * can choose to assign a meaning to the order for their purposes, if + * desired. + */ + keys?: JSONWebKey[]; +} + +/** + * Client supplied parameters used to create a new attestation service instance. + */ +export interface AttestationServiceCreationSpecificParams { + /** + * JSON Web Key Set defining a set of X.509 Certificates that will represent the parent + * certificate for the signing certificate used for policy operations + */ + policySigningCertificates?: JSONWebKeySet; +} + +/** + * Parameters for creating an attestation service instance + */ +export interface AttestationServiceCreationParams extends BaseResource { + /** + * The supported Azure location where the attestation service instance should be created. + */ + location: string; + /** + * The tags that will be assigned to the attestation service instance. + */ + tags?: { [propertyName: string]: string }; + /** + * Properties of the attestation service instance + */ + properties: AttestationServiceCreationSpecificParams; +} + +/** + * 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 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; +} + +/** + * An interface representing AttestationManagementClientOptions. + */ +export interface AttestationManagementClientOptions extends AzureServiceClientOptions { + baseUri?: string; +} + +/** + * Defines values for CreatedByType. + * Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + * @readonly + * @enum {string} + */ +export type CreatedByType = 'User' | 'Application' | 'ManagedIdentity' | 'Key'; + +/** + * Defines values for AttestationServiceStatus. + * Possible values include: 'Ready', 'NotReady', 'Error' + * @readonly + * @enum {string} + */ +export type AttestationServiceStatus = 'Ready' | 'NotReady' | 'Error'; + +/** + * Contains response data for the list operation. + */ +export type OperationsListResponse = OperationList & { + /** + * 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: OperationList; + }; +}; + +/** + * Contains response data for the get operation. + */ +export type AttestationProvidersGetResponse = AttestationProvider & { + /** + * 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: AttestationProvider; + }; +}; + +/** + * Contains response data for the create operation. + */ +export type AttestationProvidersCreateResponse = AttestationProvider & { + /** + * 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: AttestationProvider; + }; +}; + +/** + * Contains response data for the update operation. + */ +export type AttestationProvidersUpdateResponse = AttestationProvider & { + /** + * 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: AttestationProvider; + }; +}; + +/** + * Contains response data for the list operation. + */ +export type AttestationProvidersListResponse = AttestationProviderListResult & { + /** + * 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: AttestationProviderListResult; + }; +}; + +/** + * Contains response data for the listByResourceGroup operation. + */ +export type AttestationProvidersListByResourceGroupResponse = AttestationProviderListResult & { + /** + * 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: AttestationProviderListResult; + }; +}; + +/** + * Contains response data for the listDefault operation. + */ +export type AttestationProvidersListDefaultResponse = AttestationProviderListResult & { + /** + * 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: AttestationProviderListResult; + }; +}; + +/** + * Contains response data for the getDefaultByLocation operation. + */ +export type AttestationProvidersGetDefaultByLocationResponse = AttestationProvider & { + /** + * 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: AttestationProvider; + }; +}; diff --git a/sdk/attestation/arm-attestation/src/models/mappers.ts b/sdk/attestation/arm-attestation/src/models/mappers.ts new file mode 100644 index 000000000000..47b461c6d7b7 --- /dev/null +++ b/sdk/attestation/arm-attestation/src/models/mappers.ts @@ -0,0 +1,519 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * + * 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 SystemData: msRest.CompositeMapper = { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData", + modelProperties: { + createdBy: { + serializedName: "createdBy", + type: { + name: "String" + } + }, + createdByType: { + serializedName: "createdByType", + type: { + name: "String" + } + }, + createdAt: { + serializedName: "createdAt", + type: { + name: "DateTime" + } + }, + lastModifiedBy: { + serializedName: "lastModifiedBy", + type: { + name: "String" + } + }, + lastModifiedByType: { + serializedName: "lastModifiedByType", + type: { + name: "String" + } + }, + lastModifiedAt: { + serializedName: "lastModifiedAt", + type: { + name: "DateTime" + } + } + } + } +}; + +export const OperationsDisplayDefinition: msRest.CompositeMapper = { + serializedName: "OperationsDisplayDefinition", + type: { + name: "Composite", + className: "OperationsDisplayDefinition", + modelProperties: { + provider: { + serializedName: "provider", + type: { + name: "String" + } + }, + resource: { + serializedName: "resource", + type: { + name: "String" + } + }, + operation: { + serializedName: "operation", + type: { + name: "String" + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } + } + } + } +}; + +export const OperationsDefinition: msRest.CompositeMapper = { + serializedName: "OperationsDefinition", + type: { + name: "Composite", + className: "OperationsDefinition", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + display: { + serializedName: "display", + type: { + name: "Composite", + className: "OperationsDisplayDefinition" + } + } + } + } +}; + +export const OperationList: msRest.CompositeMapper = { + serializedName: "OperationList", + type: { + name: "Composite", + className: "OperationList", + modelProperties: { + systemData: { + readOnly: true, + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + }, + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "OperationsDefinition" + } + } + } + } + } + } +}; + +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 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 AttestationProvider: msRest.CompositeMapper = { + serializedName: "AttestationProvider", + type: { + name: "Composite", + className: "AttestationProvider", + modelProperties: { + ...TrackedResource.type.modelProperties, + systemData: { + readOnly: true, + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + }, + trustModel: { + serializedName: "properties.trustModel", + type: { + name: "String" + } + }, + status: { + serializedName: "properties.status", + type: { + name: "String" + } + }, + attestUri: { + serializedName: "properties.attestUri", + type: { + name: "String" + } + } + } + } +}; + +export const AttestationProviderListResult: msRest.CompositeMapper = { + serializedName: "AttestationProviderListResult", + type: { + name: "Composite", + className: "AttestationProviderListResult", + modelProperties: { + systemData: { + readOnly: true, + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + }, + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "AttestationProvider" + } + } + } + } + } + } +}; + +export const AttestationServicePatchParams: msRest.CompositeMapper = { + serializedName: "AttestationServicePatchParams", + type: { + name: "Composite", + className: "AttestationServicePatchParams", + modelProperties: { + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const JSONWebKey: msRest.CompositeMapper = { + serializedName: "JSONWebKey", + type: { + name: "Composite", + className: "JSONWebKey", + modelProperties: { + alg: { + required: true, + serializedName: "alg", + type: { + name: "String" + } + }, + crv: { + serializedName: "crv", + type: { + name: "String" + } + }, + d: { + serializedName: "d", + type: { + name: "String" + } + }, + dp: { + serializedName: "dp", + type: { + name: "String" + } + }, + dq: { + serializedName: "dq", + type: { + name: "String" + } + }, + e: { + serializedName: "e", + type: { + name: "String" + } + }, + k: { + serializedName: "k", + type: { + name: "String" + } + }, + kid: { + required: true, + serializedName: "kid", + type: { + name: "String" + } + }, + kty: { + required: true, + serializedName: "kty", + type: { + name: "String" + } + }, + n: { + serializedName: "n", + type: { + name: "String" + } + }, + p: { + serializedName: "p", + type: { + name: "String" + } + }, + q: { + serializedName: "q", + type: { + name: "String" + } + }, + qi: { + serializedName: "qi", + type: { + name: "String" + } + }, + use: { + required: true, + serializedName: "use", + type: { + name: "String" + } + }, + x: { + serializedName: "x", + type: { + name: "String" + } + }, + x5c: { + serializedName: "x5c", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + y: { + serializedName: "y", + type: { + name: "String" + } + } + } + } +}; + +export const JSONWebKeySet: msRest.CompositeMapper = { + serializedName: "JSONWebKeySet", + type: { + name: "Composite", + className: "JSONWebKeySet", + modelProperties: { + keys: { + serializedName: "keys", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "JSONWebKey" + } + } + } + } + } + } +}; + +export const AttestationServiceCreationSpecificParams: msRest.CompositeMapper = { + serializedName: "AttestationServiceCreationSpecificParams", + type: { + name: "Composite", + className: "AttestationServiceCreationSpecificParams", + modelProperties: { + policySigningCertificates: { + serializedName: "policySigningCertificates", + type: { + name: "Composite", + className: "JSONWebKeySet" + } + } + } + } +}; + +export const AttestationServiceCreationParams: msRest.CompositeMapper = { + serializedName: "AttestationServiceCreationParams", + type: { + name: "Composite", + className: "AttestationServiceCreationParams", + modelProperties: { + location: { + required: true, + serializedName: "location", + type: { + name: "String" + } + }, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { + type: { + name: "String" + } + } + } + }, + properties: { + required: true, + serializedName: "properties", + type: { + name: "Composite", + className: "AttestationServiceCreationSpecificParams" + } + } + } + } +}; + +export const ProxyResource: msRest.CompositeMapper = { + serializedName: "ProxyResource", + type: { + name: "Composite", + className: "ProxyResource", + modelProperties: { + ...Resource.type.modelProperties + } + } +}; + +export const AzureEntityResource: msRest.CompositeMapper = { + serializedName: "AzureEntityResource", + type: { + name: "Composite", + className: "AzureEntityResource", + modelProperties: { + ...Resource.type.modelProperties, + etag: { + readOnly: true, + serializedName: "etag", + type: { + name: "String" + } + } + } + } +}; diff --git a/sdk/attestation/arm-attestation/src/models/operationsMappers.ts b/sdk/attestation/arm-attestation/src/models/operationsMappers.ts new file mode 100644 index 000000000000..de9b9fa3908e --- /dev/null +++ b/sdk/attestation/arm-attestation/src/models/operationsMappers.ts @@ -0,0 +1,15 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export { + CloudError, + OperationList, + OperationsDefinition, + OperationsDisplayDefinition, + SystemData +} from "../models/mappers"; diff --git a/sdk/attestation/arm-attestation/src/models/parameters.ts b/sdk/attestation/arm-attestation/src/models/parameters.ts new file mode 100644 index 000000000000..dddd4f15efe6 --- /dev/null +++ b/sdk/attestation/arm-attestation/src/models/parameters.ts @@ -0,0 +1,83 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * 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", + type: { + name: "String" + } + } +}; +export const location: msRest.OperationURLParameter = { + parameterPath: "location", + mapper: { + required: true, + serializedName: "location", + constraints: { + MinLength: 1 + }, + type: { + name: "String" + } + } +}; +export const providerName: msRest.OperationURLParameter = { + parameterPath: "providerName", + mapper: { + required: true, + serializedName: "providerName", + type: { + name: "String" + } + } +}; +export const resourceGroupName: msRest.OperationURLParameter = { + parameterPath: "resourceGroupName", + mapper: { + required: true, + serializedName: "resourceGroupName", + constraints: { + MaxLength: 90, + MinLength: 1, + Pattern: /^[-\w\._\(\)]+$/ + }, + type: { + name: "String" + } + } +}; +export const subscriptionId: msRest.OperationURLParameter = { + parameterPath: "subscriptionId", + mapper: { + required: true, + serializedName: "subscriptionId", + constraints: { + MinLength: 1 + }, + type: { + name: "String" + } + } +}; diff --git a/sdk/attestation/arm-attestation/src/operations/attestationProviders.ts b/sdk/attestation/arm-attestation/src/operations/attestationProviders.ts new file mode 100644 index 000000000000..b15ef848d02b --- /dev/null +++ b/sdk/attestation/arm-attestation/src/operations/attestationProviders.ts @@ -0,0 +1,481 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * 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/attestationProvidersMappers"; +import * as Parameters from "../models/parameters"; +import { AttestationManagementClientContext } from "../attestationManagementClientContext"; + +/** Class representing a AttestationProviders. */ +export class AttestationProviders { + private readonly client: AttestationManagementClientContext; + + /** + * Create a AttestationProviders. + * @param {AttestationManagementClientContext} client Reference to the service client. + */ + constructor(client: AttestationManagementClientContext) { + this.client = client; + } + + /** + * Get the status of Attestation Provider. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service instance + * @param [options] The optional parameters + * @returns Promise + */ + get(resourceGroupName: string, providerName: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service instance + * @param callback The callback + */ + get(resourceGroupName: string, providerName: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service instance + * @param options The optional parameters + * @param callback The callback + */ + get(resourceGroupName: string, providerName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + get(resourceGroupName: string, providerName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + providerName, + options + }, + getOperationSpec, + callback) as Promise; + } + + /** + * Creates a new Attestation Provider instance. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service instance. + * @param creationParams Client supplied parameters. + * @param [options] The optional parameters + * @returns Promise + */ + create(resourceGroupName: string, providerName: string, creationParams: Models.AttestationServiceCreationParams, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service instance. + * @param creationParams Client supplied parameters. + * @param callback The callback + */ + create(resourceGroupName: string, providerName: string, creationParams: Models.AttestationServiceCreationParams, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service instance. + * @param creationParams Client supplied parameters. + * @param options The optional parameters + * @param callback The callback + */ + create(resourceGroupName: string, providerName: string, creationParams: Models.AttestationServiceCreationParams, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + create(resourceGroupName: string, providerName: string, creationParams: Models.AttestationServiceCreationParams, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + providerName, + creationParams, + options + }, + createOperationSpec, + callback) as Promise; + } + + /** + * Updates the Attestation Provider. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service instance. + * @param updateParams Client supplied parameters. + * @param [options] The optional parameters + * @returns Promise + */ + update(resourceGroupName: string, providerName: string, updateParams: Models.AttestationServicePatchParams, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service instance. + * @param updateParams Client supplied parameters. + * @param callback The callback + */ + update(resourceGroupName: string, providerName: string, updateParams: Models.AttestationServicePatchParams, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service instance. + * @param updateParams Client supplied parameters. + * @param options The optional parameters + * @param callback The callback + */ + update(resourceGroupName: string, providerName: string, updateParams: Models.AttestationServicePatchParams, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + update(resourceGroupName: string, providerName: string, updateParams: Models.AttestationServicePatchParams, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + providerName, + updateParams, + options + }, + updateOperationSpec, + callback) as Promise; + } + + /** + * Delete Attestation Service. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service + * @param [options] The optional parameters + * @returns Promise + */ + deleteMethod(resourceGroupName: string, providerName: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service + * @param callback The callback + */ + deleteMethod(resourceGroupName: string, providerName: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service + * @param options The optional parameters + * @param callback The callback + */ + deleteMethod(resourceGroupName: string, providerName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + deleteMethod(resourceGroupName: string, providerName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + providerName, + options + }, + deleteMethodOperationSpec, + callback); + } + + /** + * Returns a list of attestation providers in a subscription. + * @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; + } + + /** + * Returns attestation providers list in a resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param [options] The optional parameters + * @returns Promise + */ + listByResourceGroup(resourceGroupName: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param callback The callback + */ + listByResourceGroup(resourceGroupName: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The optional parameters + * @param callback The callback + */ + listByResourceGroup(resourceGroupName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + options + }, + listByResourceGroupOperationSpec, + callback) as Promise; + } + + /** + * Get the default provider + * @param [options] The optional parameters + * @returns Promise + */ + listDefault(options?: msRest.RequestOptionsBase): Promise; + /** + * @param callback The callback + */ + listDefault(callback: msRest.ServiceCallback): void; + /** + * @param options The optional parameters + * @param callback The callback + */ + listDefault(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listDefault(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + options + }, + listDefaultOperationSpec, + callback) as Promise; + } + + /** + * Get the default provider by location. + * @param location The location of the default provider. + * @param [options] The optional parameters + * @returns Promise + */ + getDefaultByLocation(location: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param location The location of the default provider. + * @param callback The callback + */ + getDefaultByLocation(location: string, callback: msRest.ServiceCallback): void; + /** + * @param location The location of the default provider. + * @param options The optional parameters + * @param callback The callback + */ + getDefaultByLocation(location: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + getDefaultByLocation(location: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + location, + options + }, + getDefaultByLocationOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const getOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.providerName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.AttestationProvider + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const createOperationSpec: msRest.OperationSpec = { + httpMethod: "PUT", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.providerName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: "creationParams", + mapper: { + ...Mappers.AttestationServiceCreationParams, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.AttestationProvider + }, + 201: { + bodyMapper: Mappers.AttestationProvider + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const updateOperationSpec: msRest.OperationSpec = { + httpMethod: "PATCH", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.providerName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: "updateParams", + mapper: { + ...Mappers.AttestationServicePatchParams, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.AttestationProvider + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const deleteMethodOperationSpec: msRest.OperationSpec = { + httpMethod: "DELETE", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.providerName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/providers/Microsoft.Attestation/attestationProviders", + urlParameters: [ + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.AttestationProviderListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const listByResourceGroupOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders", + urlParameters: [ + Parameters.resourceGroupName, + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.AttestationProviderListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const listDefaultOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/providers/Microsoft.Attestation/defaultProviders", + urlParameters: [ + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.AttestationProviderListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const getDefaultByLocationOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/providers/Microsoft.Attestation/locations/{location}/defaultProvider", + urlParameters: [ + Parameters.location, + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.AttestationProvider + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; diff --git a/sdk/attestation/arm-attestation/src/operations/index.ts b/sdk/attestation/arm-attestation/src/operations/index.ts new file mode 100644 index 000000000000..b8a242e5b5b4 --- /dev/null +++ b/sdk/attestation/arm-attestation/src/operations/index.ts @@ -0,0 +1,12 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * 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 "./attestationProviders"; diff --git a/sdk/attestation/arm-attestation/src/operations/operations.ts b/sdk/attestation/arm-attestation/src/operations/operations.ts new file mode 100644 index 000000000000..71d7e5859cdb --- /dev/null +++ b/sdk/attestation/arm-attestation/src/operations/operations.ts @@ -0,0 +1,74 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * 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 { AttestationManagementClientContext } from "../attestationManagementClientContext"; + +/** Class representing a Operations. */ +export class Operations { + private readonly client: AttestationManagementClientContext; + + /** + * Create a Operations. + * @param {AttestationManagementClientContext} client Reference to the service client. + */ + constructor(client: AttestationManagementClientContext) { + this.client = client; + } + + /** + * Lists all of the available Azure attestation 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; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "providers/Microsoft.Attestation/operations", + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.OperationList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; diff --git a/sdk/attestation/arm-attestation/tsconfig.json b/sdk/attestation/arm-attestation/tsconfig.json new file mode 100644 index 000000000000..422b584abd5e --- /dev/null +++ b/sdk/attestation/arm-attestation/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"] +}