Skip to content

Commit

Permalink
CodeGen from PR 14909 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
[DataBox] Bump the api version to add new values for enums for JobStageStatus (Azure#14909)

* copy of 2021-03-01, first commit

* adding new api version and its example

* updating readme files with 2021-05-01 version and cSpell.json too with Tera as acceptable word

* updating 2021-readme files

* adding reference to the file

* removing track1 changes for python
  • Loading branch information
SDKAuto committed Jun 28, 2021
1 parent b8da289 commit d475ac7
Show file tree
Hide file tree
Showing 16 changed files with 2,165 additions and 697 deletions.
2 changes: 1 addition & 1 deletion sdk/databox/arm-databox/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2020 Microsoft
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
Expand Down
9 changes: 3 additions & 6 deletions sdk/databox/arm-databox/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
## Azure DataBoxManagementClient SDK for JavaScript

This package contains an isomorphic SDK (runs both in Node.js and in browsers) for DataBoxManagementClient.
This package contains an isomorphic SDK (runs both in node.js and in browsers) for DataBoxManagementClient.

### Currently supported environments

- [LTS versions of Node.js](https://nodejs.org/about/releases/)
- Latest versions of Safari, Chrome, Edge, and Firefox.
- Latest versions of Safari, Chrome, Edge and Firefox.

### Prerequisites

Expand All @@ -21,7 +21,6 @@ Install both packages using the below command:
```bash
npm install --save @azure/arm-databox @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.

Expand All @@ -37,7 +36,6 @@ If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/

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
Expand All @@ -51,7 +49,6 @@ const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
// Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead.
const creds = new DefaultAzureCredential();
const client = new DataBoxManagementClient(creds, subscriptionId);

client.operations.list().then((result) => {
console.log("The result is:");
console.log(result);
Expand Down Expand Up @@ -86,7 +83,7 @@ In browser applications, we recommend using the `InteractiveBrowserCredential` t
const credential = new InteractiveBrowserCredential(
{
clientId: "<client id for your Azure AD app>",
tenantId: "<optional tenant for your organization>"
tenant: "<optional tenant for your organization>"
});
const client = new Azure.ArmDatabox.DataBoxManagementClient(creds, subscriptionId);
client.operations.list().then((result) => {
Expand Down
2 changes: 1 addition & 1 deletion sdk/databox/arm-databox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"rollup-plugin-sourcemaps": "^0.4.2",
"uglify-js": "^3.6.0"
},
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/databox/arm-databox",
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/databox/arm-databox",
"repository": {
"type": "git",
"url": "https://github.com/Azure/azure-sdk-for-js.git"
Expand Down
4 changes: 2 additions & 2 deletions sdk/databox/arm-databox/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ const config = {
"@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.
* 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.
Expand Down
80 changes: 77 additions & 3 deletions sdk/databox/arm-databox/src/dataBoxManagementClient.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
* 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
Expand All @@ -12,6 +11,7 @@ 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 Parameters from "./models/parameters";
import * as operations from "./operations";
import { DataBoxManagementClientContext } from "./dataBoxManagementClientContext";

Expand Down Expand Up @@ -39,9 +39,83 @@ class DataBoxManagementClient extends DataBoxManagementClientContext {
this.jobs = new operations.Jobs(this);
this.service = new operations.Service(this);
}

/**
* Request to mitigate for a given job
* @param jobName The name of the job Resource within the specified resource group. job names must
* be between 3 and 24 characters in length and use any alphanumeric and underscore only
* @param resourceGroupName The Resource Group Name
* @param customerResolutionCode Resolution code for the job. Possible values include: 'None',
* 'MoveToCleanUpDevice', 'Resume'
* @param [options] The optional parameters
* @returns Promise<msRest.RestResponse>
*/
mitigate(jobName: string, resourceGroupName: string, customerResolutionCode: Models.CustomerResolutionCode, options?: msRest.RequestOptionsBase): Promise<msRest.RestResponse>;
/**
* @param jobName The name of the job Resource within the specified resource group. job names must
* be between 3 and 24 characters in length and use any alphanumeric and underscore only
* @param resourceGroupName The Resource Group Name
* @param customerResolutionCode Resolution code for the job. Possible values include: 'None',
* 'MoveToCleanUpDevice', 'Resume'
* @param callback The callback
*/
mitigate(jobName: string, resourceGroupName: string, customerResolutionCode: Models.CustomerResolutionCode, callback: msRest.ServiceCallback<void>): void;
/**
* @param jobName The name of the job Resource within the specified resource group. job names must
* be between 3 and 24 characters in length and use any alphanumeric and underscore only
* @param resourceGroupName The Resource Group Name
* @param customerResolutionCode Resolution code for the job. Possible values include: 'None',
* 'MoveToCleanUpDevice', 'Resume'
* @param options The optional parameters
* @param callback The callback
*/
mitigate(jobName: string, resourceGroupName: string, customerResolutionCode: Models.CustomerResolutionCode, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback<void>): void;
mitigate(jobName: string, resourceGroupName: string, customerResolutionCode: Models.CustomerResolutionCode, options?: msRest.RequestOptionsBase | msRest.ServiceCallback<void>, callback?: msRest.ServiceCallback<void>): Promise<msRest.RestResponse> {
return this.sendOperationRequest(
{
jobName,
resourceGroupName,
customerResolutionCode,
options
},
mitigateOperationSpec,
callback);
}
}

// Operation Specifications
const serializer = new msRest.Serializer(Mappers);
const mitigateOperationSpec: msRest.OperationSpec = {
httpMethod: "POST",
path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate",
urlParameters: [
Parameters.jobName,
Parameters.subscriptionId,
Parameters.resourceGroupName
],
queryParameters: [
Parameters.apiVersion
],
headerParameters: [
Parameters.acceptLanguage
],
requestBody: {
parameterPath: {
customerResolutionCode: "customerResolutionCode"
},
mapper: {
...Mappers.MitigateJobRequest,
required: true
}
},
responses: {
204: {},
default: {
bodyMapper: Mappers.ApiError
}
},
serializer
};

export {
DataBoxManagementClient,
Expand Down
15 changes: 7 additions & 8 deletions sdk/databox/arm-databox/src/dataBoxManagementClientContext.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
* 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
Expand All @@ -10,8 +9,8 @@

import * as Models from "./models";
import * as msRest from "@azure/ms-rest-js";
import { TokenCredential } from "@azure/core-auth";
import * as msRestAzure from "@azure/ms-rest-azure-js";
import { TokenCredential } from "@azure/core-auth";

const packageName = "@azure/arm-databox";
const packageVersion = "4.1.0";
Expand Down Expand Up @@ -43,25 +42,25 @@ export class DataBoxManagementClientContext extends msRestAzure.AzureServiceClie
if (!options) {
options = {};
}
if(!options.userAgent) {
if (!options.userAgent) {
const defaultUserAgent = msRestAzure.getDefaultUserAgentValue();
options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`;
}

super(credentials, options);

this.apiVersion = '2019-09-01';
this.apiVersion = '2021-05-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) {
if (options.acceptLanguage !== null && options.acceptLanguage !== undefined) {
this.acceptLanguage = options.acceptLanguage;
}
if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) {
if (options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) {
this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout;
}
}
Expand Down
Loading

0 comments on commit d475ac7

Please sign in to comment.