@azure/quantum-jobs
Version:
An isomorphic client library for Azure Quantum
1,310 lines (1,297 loc) • 41.6 kB
JavaScript
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var tslib = require('tslib');
var coreHttp = require('@azure/core-http');
/*
* 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.
*/
var JobDetailsList = {
type: {
name: "Composite",
className: "JobDetailsList",
modelProperties: {
value: {
serializedName: "value",
readOnly: true,
type: {
name: "Sequence",
element: {
type: {
name: "Composite",
className: "JobDetails"
}
}
}
},
count: {
serializedName: "count",
type: {
name: "Number"
}
},
nextLink: {
serializedName: "nextLink",
readOnly: true,
type: {
name: "String"
}
}
}
}
};
var JobDetails = {
type: {
name: "Composite",
className: "JobDetails",
modelProperties: {
id: {
serializedName: "id",
type: {
name: "String"
}
},
name: {
serializedName: "name",
type: {
name: "String"
}
},
containerUri: {
serializedName: "containerUri",
required: true,
type: {
name: "String"
}
},
inputDataUri: {
serializedName: "inputDataUri",
type: {
name: "String"
}
},
inputDataFormat: {
serializedName: "inputDataFormat",
required: true,
type: {
name: "String"
}
},
inputParams: {
serializedName: "inputParams",
type: {
name: "any"
}
},
providerId: {
serializedName: "providerId",
required: true,
type: {
name: "String"
}
},
target: {
serializedName: "target",
required: true,
type: {
name: "String"
}
},
metadata: {
serializedName: "metadata",
type: {
name: "Dictionary",
value: { type: { name: "String" } }
}
},
outputDataUri: {
serializedName: "outputDataUri",
type: {
name: "String"
}
},
outputDataFormat: {
serializedName: "outputDataFormat",
type: {
name: "String"
}
},
status: {
serializedName: "status",
readOnly: true,
type: {
name: "String"
}
},
creationTime: {
serializedName: "creationTime",
readOnly: true,
type: {
name: "DateTime"
}
},
beginExecutionTime: {
serializedName: "beginExecutionTime",
readOnly: true,
type: {
name: "DateTime"
}
},
endExecutionTime: {
serializedName: "endExecutionTime",
readOnly: true,
type: {
name: "DateTime"
}
},
cancellationTime: {
serializedName: "cancellationTime",
readOnly: true,
type: {
name: "DateTime"
}
},
errorData: {
serializedName: "errorData",
type: {
name: "Composite",
className: "ErrorData"
}
}
}
}
};
var ErrorData = {
type: {
name: "Composite",
className: "ErrorData",
modelProperties: {
code: {
serializedName: "code",
type: {
name: "String"
}
},
message: {
serializedName: "message",
type: {
name: "String"
}
}
}
}
};
var RestError = {
type: {
name: "Composite",
className: "RestError",
modelProperties: {
error: {
serializedName: "error",
type: {
name: "Composite",
className: "ErrorData"
}
}
}
}
};
var ProviderStatusList = {
type: {
name: "Composite",
className: "ProviderStatusList",
modelProperties: {
value: {
serializedName: "value",
readOnly: true,
type: {
name: "Sequence",
element: {
type: {
name: "Composite",
className: "ProviderStatus"
}
}
}
},
nextLink: {
serializedName: "nextLink",
readOnly: true,
type: {
name: "String"
}
}
}
}
};
var ProviderStatus = {
type: {
name: "Composite",
className: "ProviderStatus",
modelProperties: {
id: {
serializedName: "id",
readOnly: true,
type: {
name: "String"
}
},
currentAvailability: {
serializedName: "currentAvailability",
readOnly: true,
type: {
name: "String"
}
},
targets: {
serializedName: "targets",
readOnly: true,
type: {
name: "Sequence",
element: {
type: {
name: "Composite",
className: "TargetStatus"
}
}
}
}
}
}
};
var TargetStatus = {
type: {
name: "Composite",
className: "TargetStatus",
modelProperties: {
id: {
serializedName: "id",
readOnly: true,
type: {
name: "String"
}
},
currentAvailability: {
serializedName: "currentAvailability",
readOnly: true,
type: {
name: "String"
}
},
averageQueueTime: {
serializedName: "averageQueueTime",
readOnly: true,
type: {
name: "Number"
}
},
statusPage: {
serializedName: "statusPage",
readOnly: true,
type: {
name: "String"
}
}
}
}
};
var BlobDetails = {
type: {
name: "Composite",
className: "BlobDetails",
modelProperties: {
containerName: {
serializedName: "containerName",
required: true,
type: {
name: "String"
}
},
blobName: {
serializedName: "blobName",
type: {
name: "String"
}
}
}
}
};
var SasUriResponse = {
type: {
name: "Composite",
className: "SasUriResponse",
modelProperties: {
sasUri: {
serializedName: "sasUri",
type: {
name: "String"
}
}
}
}
};
var QuotaList = {
type: {
name: "Composite",
className: "QuotaList",
modelProperties: {
value: {
serializedName: "value",
readOnly: true,
type: {
name: "Sequence",
element: {
type: {
name: "Composite",
className: "Quota"
}
}
}
},
nextLink: {
serializedName: "nextLink",
readOnly: true,
type: {
name: "String"
}
}
}
}
};
var Quota = {
type: {
name: "Composite",
className: "Quota",
modelProperties: {
dimension: {
serializedName: "dimension",
type: {
name: "String"
}
},
scope: {
serializedName: "scope",
type: {
name: "String"
}
},
providerId: {
serializedName: "providerId",
type: {
name: "String"
}
},
utilization: {
serializedName: "utilization",
type: {
name: "Number"
}
},
holds: {
serializedName: "holds",
type: {
name: "Number"
}
},
limit: {
serializedName: "limit",
type: {
name: "Number"
}
},
period: {
serializedName: "period",
type: {
name: "String"
}
}
}
}
};
var Mappers = /*#__PURE__*/Object.freeze({
__proto__: null,
JobDetailsList: JobDetailsList,
JobDetails: JobDetails,
ErrorData: ErrorData,
RestError: RestError,
ProviderStatusList: ProviderStatusList,
ProviderStatus: ProviderStatus,
TargetStatus: TargetStatus,
BlobDetails: BlobDetails,
SasUriResponse: SasUriResponse,
QuotaList: QuotaList,
Quota: Quota
});
/*
* 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.
*/
var accept = {
parameterPath: "accept",
mapper: {
defaultValue: "application/json",
isConstant: true,
serializedName: "Accept",
type: {
name: "String"
}
}
};
var $host = {
parameterPath: "$host",
mapper: {
serializedName: "$host",
required: true,
type: {
name: "String"
}
},
skipEncoding: true
};
var subscriptionId = {
parameterPath: "subscriptionId",
mapper: {
serializedName: "subscriptionId",
required: true,
type: {
name: "String"
}
}
};
var resourceGroupName = {
parameterPath: "resourceGroupName",
mapper: {
serializedName: "resourceGroupName",
required: true,
type: {
name: "String"
}
}
};
var workspaceName = {
parameterPath: "workspaceName",
mapper: {
serializedName: "workspaceName",
required: true,
type: {
name: "String"
}
}
};
var jobId = {
parameterPath: "jobId",
mapper: {
serializedName: "jobId",
required: true,
type: {
name: "String"
}
}
};
var contentType = {
parameterPath: ["options", "contentType"],
mapper: {
defaultValue: "application/json",
isConstant: true,
serializedName: "Content-Type",
type: {
name: "String"
}
}
};
var job = {
parameterPath: "job",
mapper: JobDetails
};
var nextLink = {
parameterPath: "nextLink",
mapper: {
serializedName: "nextLink",
required: true,
type: {
name: "String"
}
},
skipEncoding: true
};
var blobDetails = {
parameterPath: "blobDetails",
mapper: BlobDetails
};
/*
* 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.
*/
/** Class representing a Jobs. */
var Jobs = /** @class */ (function () {
/**
* Initialize a new instance of the class Jobs class.
* @param client Reference to the service client
*/
function Jobs(client) {
this.client = client;
}
/**
* List jobs.
* @param options The options parameters.
*/
Jobs.prototype.list = function (options) {
var _a;
var _this = this;
var iter = this.listPagingAll(options);
return _a = {
next: function () {
return iter.next();
}
},
_a[Symbol.asyncIterator] = function () {
return this;
},
_a.byPage = function () {
return _this.listPagingPage(options);
},
_a;
};
Jobs.prototype.listPagingPage = function (options) {
return tslib.__asyncGenerator(this, arguments, function listPagingPage_1() {
var result, continuationToken;
return tslib.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, tslib.__await(this._list(options))];
case 1:
result = _a.sent();
return [4 /*yield*/, tslib.__await(result.value || [])];
case 2: return [4 /*yield*/, _a.sent()];
case 3:
_a.sent();
continuationToken = result.nextLink;
_a.label = 4;
case 4:
if (!continuationToken) return [3 /*break*/, 8];
return [4 /*yield*/, tslib.__await(this._listNext(continuationToken, options))];
case 5:
result = _a.sent();
continuationToken = result.nextLink;
return [4 /*yield*/, tslib.__await(result.value || [])];
case 6: return [4 /*yield*/, _a.sent()];
case 7:
_a.sent();
return [3 /*break*/, 4];
case 8: return [2 /*return*/];
}
});
});
};
Jobs.prototype.listPagingAll = function (options) {
return tslib.__asyncGenerator(this, arguments, function listPagingAll_1() {
var _a, _b, page, e_1_1;
var e_1, _c;
return tslib.__generator(this, function (_d) {
switch (_d.label) {
case 0:
_d.trys.push([0, 7, 8, 13]);
_a = tslib.__asyncValues(this.listPagingPage(options));
_d.label = 1;
case 1: return [4 /*yield*/, tslib.__await(_a.next())];
case 2:
if (!(_b = _d.sent(), !_b.done)) return [3 /*break*/, 6];
page = _b.value;
return [5 /*yield**/, tslib.__values(tslib.__asyncDelegator(tslib.__asyncValues(page)))];
case 3: return [4 /*yield*/, tslib.__await.apply(void 0, [_d.sent()])];
case 4:
_d.sent();
_d.label = 5;
case 5: return [3 /*break*/, 1];
case 6: return [3 /*break*/, 13];
case 7:
e_1_1 = _d.sent();
e_1 = { error: e_1_1 };
return [3 /*break*/, 13];
case 8:
_d.trys.push([8, , 11, 12]);
if (!(_b && !_b.done && (_c = _a.return))) return [3 /*break*/, 10];
return [4 /*yield*/, tslib.__await(_c.call(_a))];
case 9:
_d.sent();
_d.label = 10;
case 10: return [3 /*break*/, 12];
case 11:
if (e_1) throw e_1.error;
return [7 /*endfinally*/];
case 12: return [7 /*endfinally*/];
case 13: return [2 /*return*/];
}
});
});
};
/**
* List jobs.
* @param options The options parameters.
*/
Jobs.prototype._list = function (options) {
var operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, listOperationSpec);
};
/**
* Get job by id
* @param jobId Id of the job.
* @param options The options parameters.
*/
Jobs.prototype.get = function (jobId, options) {
var operationArguments = {
jobId: jobId,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, getOperationSpec);
};
/**
* Create a job.
* @param jobId Id of the job.
* @param job The complete metadata of the job to submit.
* @param options The options parameters.
*/
Jobs.prototype.create = function (jobId, job, options) {
var operationArguments = {
jobId: jobId,
job: job,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, createOperationSpec);
};
/**
* Cancel a job.
* @param jobId Id of the job.
* @param options The options parameters.
*/
Jobs.prototype.cancel = function (jobId, options) {
var operationArguments = {
jobId: jobId,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, cancelOperationSpec);
};
/**
* ListNext
* @param nextLink The nextLink from the previous successful call to the List method.
* @param options The options parameters.
*/
Jobs.prototype._listNext = function (nextLink, options) {
var operationArguments = {
nextLink: nextLink,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, listNextOperationSpec);
};
return Jobs;
}());
// Operation Specifications
var serializer = new coreHttp.Serializer(Mappers, /* isXml */ false);
var listOperationSpec = {
path: "/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/jobs",
httpMethod: "GET",
responses: {
200: {
bodyMapper: JobDetailsList
}
},
urlParameters: [
$host,
subscriptionId,
resourceGroupName,
workspaceName
],
headerParameters: [accept],
serializer: serializer
};
var getOperationSpec = {
path: "/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/jobs/{jobId}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: JobDetails
},
default: {
bodyMapper: RestError
}
},
urlParameters: [
$host,
subscriptionId,
resourceGroupName,
workspaceName,
jobId
],
headerParameters: [accept],
serializer: serializer
};
var createOperationSpec = {
path: "/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/jobs/{jobId}",
httpMethod: "PUT",
responses: {
200: {
bodyMapper: JobDetails
},
201: {
bodyMapper: JobDetails
},
default: {
bodyMapper: RestError
}
},
requestBody: job,
urlParameters: [
$host,
subscriptionId,
resourceGroupName,
workspaceName,
jobId
],
headerParameters: [accept, contentType],
mediaType: "json",
serializer: serializer
};
var cancelOperationSpec = {
path: "/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/jobs/{jobId}",
httpMethod: "DELETE",
responses: {
204: {},
default: {
bodyMapper: RestError
}
},
urlParameters: [
$host,
subscriptionId,
resourceGroupName,
workspaceName,
jobId
],
headerParameters: [accept],
serializer: serializer
};
var listNextOperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: JobDetailsList
}
},
urlParameters: [
$host,
subscriptionId,
resourceGroupName,
workspaceName,
nextLink
],
headerParameters: [accept],
serializer: serializer
};
/*
* 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.
*/
/** Class representing a Providers. */
var Providers = /** @class */ (function () {
/**
* Initialize a new instance of the class Providers class.
* @param client Reference to the service client
*/
function Providers(client) {
this.client = client;
}
/**
* Get provider status.
* @param options The options parameters.
*/
Providers.prototype.listStatus = function (options) {
var _a;
var _this = this;
var iter = this.getStatusPagingAll(options);
return _a = {
next: function () {
return iter.next();
}
},
_a[Symbol.asyncIterator] = function () {
return this;
},
_a.byPage = function () {
return _this.getStatusPagingPage(options);
},
_a;
};
Providers.prototype.getStatusPagingPage = function (options) {
return tslib.__asyncGenerator(this, arguments, function getStatusPagingPage_1() {
var result, continuationToken;
return tslib.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, tslib.__await(this._getStatus(options))];
case 1:
result = _a.sent();
return [4 /*yield*/, tslib.__await(result.value || [])];
case 2: return [4 /*yield*/, _a.sent()];
case 3:
_a.sent();
continuationToken = result.nextLink;
_a.label = 4;
case 4:
if (!continuationToken) return [3 /*break*/, 8];
return [4 /*yield*/, tslib.__await(this._getStatusNext(continuationToken, options))];
case 5:
result = _a.sent();
continuationToken = result.nextLink;
return [4 /*yield*/, tslib.__await(result.value || [])];
case 6: return [4 /*yield*/, _a.sent()];
case 7:
_a.sent();
return [3 /*break*/, 4];
case 8: return [2 /*return*/];
}
});
});
};
Providers.prototype.getStatusPagingAll = function (options) {
return tslib.__asyncGenerator(this, arguments, function getStatusPagingAll_1() {
var _a, _b, page, e_1_1;
var e_1, _c;
return tslib.__generator(this, function (_d) {
switch (_d.label) {
case 0:
_d.trys.push([0, 7, 8, 13]);
_a = tslib.__asyncValues(this.getStatusPagingPage(options));
_d.label = 1;
case 1: return [4 /*yield*/, tslib.__await(_a.next())];
case 2:
if (!(_b = _d.sent(), !_b.done)) return [3 /*break*/, 6];
page = _b.value;
return [5 /*yield**/, tslib.__values(tslib.__asyncDelegator(tslib.__asyncValues(page)))];
case 3: return [4 /*yield*/, tslib.__await.apply(void 0, [_d.sent()])];
case 4:
_d.sent();
_d.label = 5;
case 5: return [3 /*break*/, 1];
case 6: return [3 /*break*/, 13];
case 7:
e_1_1 = _d.sent();
e_1 = { error: e_1_1 };
return [3 /*break*/, 13];
case 8:
_d.trys.push([8, , 11, 12]);
if (!(_b && !_b.done && (_c = _a.return))) return [3 /*break*/, 10];
return [4 /*yield*/, tslib.__await(_c.call(_a))];
case 9:
_d.sent();
_d.label = 10;
case 10: return [3 /*break*/, 12];
case 11:
if (e_1) throw e_1.error;
return [7 /*endfinally*/];
case 12: return [7 /*endfinally*/];
case 13: return [2 /*return*/];
}
});
});
};
/**
* Get provider status.
* @param options The options parameters.
*/
Providers.prototype._getStatus = function (options) {
var operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, getStatusOperationSpec);
};
/**
* GetStatusNext
* @param nextLink The nextLink from the previous successful call to the GetStatus method.
* @param options The options parameters.
*/
Providers.prototype._getStatusNext = function (nextLink, options) {
var operationArguments = {
nextLink: nextLink,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, getStatusNextOperationSpec);
};
return Providers;
}());
// Operation Specifications
var serializer$1 = new coreHttp.Serializer(Mappers, /* isXml */ false);
var getStatusOperationSpec = {
path: "/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/providerStatus",
httpMethod: "GET",
responses: {
200: {
bodyMapper: ProviderStatusList
},
default: {
bodyMapper: RestError
}
},
urlParameters: [
$host,
subscriptionId,
resourceGroupName,
workspaceName
],
headerParameters: [accept],
serializer: serializer$1
};
var getStatusNextOperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: ProviderStatusList
},
default: {
bodyMapper: RestError
}
},
urlParameters: [
$host,
subscriptionId,
resourceGroupName,
workspaceName,
nextLink
],
headerParameters: [accept],
serializer: serializer$1
};
/*
* 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.
*/
/** Class representing a Storage. */
var Storage = /** @class */ (function () {
/**
* Initialize a new instance of the class Storage class.
* @param client Reference to the service client
*/
function Storage(client) {
this.client = client;
}
/**
* Gets a URL with SAS token for a container/blob in the storage account associated with the workspace.
* The SAS URL can be used to upload job input and/or download job output.
* @param blobDetails The details (name and container) of the blob to store or download data.
* @param options The options parameters.
*/
Storage.prototype.sasUri = function (blobDetails, options) {
var operationArguments = {
blobDetails: blobDetails,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, sasUriOperationSpec);
};
return Storage;
}());
// Operation Specifications
var serializer$2 = new coreHttp.Serializer(Mappers, /* isXml */ false);
var sasUriOperationSpec = {
path: "/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/storage/sasUri",
httpMethod: "POST",
responses: {
200: {
bodyMapper: SasUriResponse
},
default: {
bodyMapper: RestError
}
},
requestBody: blobDetails,
urlParameters: [
$host,
subscriptionId,
resourceGroupName,
workspaceName
],
headerParameters: [accept, contentType],
mediaType: "json",
serializer: serializer$2
};
/*
* 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.
*/
/** Class representing a Quotas. */
var Quotas = /** @class */ (function () {
/**
* Initialize a new instance of the class Quotas class.
* @param client Reference to the service client
*/
function Quotas(client) {
this.client = client;
}
/**
* List quotas for the given workspace.
* @param options The options parameters.
*/
Quotas.prototype.list = function (options) {
var _a;
var _this = this;
var iter = this.listPagingAll(options);
return _a = {
next: function () {
return iter.next();
}
},
_a[Symbol.asyncIterator] = function () {
return this;
},
_a.byPage = function () {
return _this.listPagingPage(options);
},
_a;
};
Quotas.prototype.listPagingPage = function (options) {
return tslib.__asyncGenerator(this, arguments, function listPagingPage_1() {
var result, continuationToken;
return tslib.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, tslib.__await(this._list(options))];
case 1:
result = _a.sent();
return [4 /*yield*/, tslib.__await(result.value || [])];
case 2: return [4 /*yield*/, _a.sent()];
case 3:
_a.sent();
continuationToken = result.nextLink;
_a.label = 4;
case 4:
if (!continuationToken) return [3 /*break*/, 8];
return [4 /*yield*/, tslib.__await(this._listNext(continuationToken, options))];
case 5:
result = _a.sent();
continuationToken = result.nextLink;
return [4 /*yield*/, tslib.__await(result.value || [])];
case 6: return [4 /*yield*/, _a.sent()];
case 7:
_a.sent();
return [3 /*break*/, 4];
case 8: return [2 /*return*/];
}
});
});
};
Quotas.prototype.listPagingAll = function (options) {
return tslib.__asyncGenerator(this, arguments, function listPagingAll_1() {
var _a, _b, page, e_1_1;
var e_1, _c;
return tslib.__generator(this, function (_d) {
switch (_d.label) {
case 0:
_d.trys.push([0, 7, 8, 13]);
_a = tslib.__asyncValues(this.listPagingPage(options));
_d.label = 1;
case 1: return [4 /*yield*/, tslib.__await(_a.next())];
case 2:
if (!(_b = _d.sent(), !_b.done)) return [3 /*break*/, 6];
page = _b.value;
return [5 /*yield**/, tslib.__values(tslib.__asyncDelegator(tslib.__asyncValues(page)))];
case 3: return [4 /*yield*/, tslib.__await.apply(void 0, [_d.sent()])];
case 4:
_d.sent();
_d.label = 5;
case 5: return [3 /*break*/, 1];
case 6: return [3 /*break*/, 13];
case 7:
e_1_1 = _d.sent();
e_1 = { error: e_1_1 };
return [3 /*break*/, 13];
case 8:
_d.trys.push([8, , 11, 12]);
if (!(_b && !_b.done && (_c = _a.return))) return [3 /*break*/, 10];
return [4 /*yield*/, tslib.__await(_c.call(_a))];
case 9:
_d.sent();
_d.label = 10;
case 10: return [3 /*break*/, 12];
case 11:
if (e_1) throw e_1.error;
return [7 /*endfinally*/];
case 12: return [7 /*endfinally*/];
case 13: return [2 /*return*/];
}
});
});
};
/**
* List quotas for the given workspace.
* @param options The options parameters.
*/
Quotas.prototype._list = function (options) {
var operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, listOperationSpec$1);
};
/**
* ListNext
* @param nextLink The nextLink from the previous successful call to the List method.
* @param options The options parameters.
*/
Quotas.prototype._listNext = function (nextLink, options) {
var operationArguments = {
nextLink: nextLink,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, listNextOperationSpec$1);
};
return Quotas;
}());
// Operation Specifications
var serializer$3 = new coreHttp.Serializer(Mappers, /* isXml */ false);
var listOperationSpec$1 = {
path: "/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/quotas",
httpMethod: "GET",
responses: {
200: {
bodyMapper: QuotaList
},
default: {
bodyMapper: RestError
}
},
urlParameters: [
$host,
subscriptionId,
resourceGroupName,
workspaceName
],
headerParameters: [accept],
serializer: serializer$3
};
var listNextOperationSpec$1 = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: QuotaList
},
default: {
bodyMapper: RestError
}
},
urlParameters: [
$host,
subscriptionId,
resourceGroupName,
workspaceName,
nextLink
],
headerParameters: [accept],
serializer: serializer$3
};
/*
* 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.
*/
var packageName = "@azure/quantum-jobs";
var packageVersion = "1.0.0-beta.1";
var QuantumJobClientContext = /** @class */ (function (_super) {
tslib.__extends(QuantumJobClientContext, _super);
/**
* Initializes a new instance of the QuantumJobClientContext class.
* @param credentials Subscription credentials which uniquely identify client subscription.
* @param subscriptionId The Azure subscription ID. This is a GUID-formatted string (e.g.
* 00000000-0000-0000-0000-000000000000)
* @param resourceGroupName Name of an Azure resource group.
* @param workspaceName Name of the workspace.
* @param options The parameter options
*/
function QuantumJobClientContext(credentials, subscriptionId, resourceGroupName, workspaceName, options) {
var _this = this;
if (credentials === undefined) {
throw new Error("'credentials' cannot be null");
}
if (subscriptionId === undefined) {
throw new Error("'subscriptionId' cannot be null");
}
if (resourceGroupName === undefined) {
throw new Error("'resourceGroupName' cannot be null");
}
if (workspaceName === undefined) {
throw new Error("'workspaceName' cannot be null");
}
// Initializing default values for options
if (!options) {
options = {};
}
if (!options.userAgent) {
var defaultUserAgent = coreHttp.getDefaultUserAgentValue();
options.userAgent = packageName + "/" + packageVersion + " " + defaultUserAgent;
}
_this = _super.call(this, credentials, options) || this;
_this.requestContentType = "application/json; charset=utf-8";
_this.baseUri = options.endpoint || "https://quantum.azure.com";
// Parameter assignments
_this.subscriptionId = subscriptionId;
_this.resourceGroupName = resourceGroupName;
_this.workspaceName = workspaceName;
// Assigning values to Constant parameters
_this.$host = options.$host || "https://quantum.azure.com";
return _this;
}
return QuantumJobClientContext;
}(coreHttp.ServiceClient));
/*
* 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.
*/
var QuantumJobClient = /** @class */ (function (_super) {
tslib.__extends(QuantumJobClient, _super);
/**
* Initializes a new instance of the QuantumJobClient class.
* @param credentials Subscription credentials which uniquely identify client subscription.
* @param subscriptionId The Azure subscription ID. This is a GUID-formatted string (e.g.
* 00000000-0000-0000-0000-000000000000)
* @param resourceGroupName Name of an Azure resource group.
* @param workspaceName Name of the workspace.
* @param options The parameter options
*/
function QuantumJobClient(credentials, subscriptionId, resourceGroupName, workspaceName, options) {
var _this = _super.call(this, credentials, subscriptionId, resourceGroupName, workspaceName, options) || this;
_this.jobs = new Jobs(_this);
_this.providers = new Providers(_this);
_this.storage = new Storage(_this);
_this.quotas = new Quotas(_this);
return _this;
}
return QuantumJobClient;
}(QuantumJobClientContext));
exports.Jobs = Jobs;
exports.Providers = Providers;
exports.QuantumJobClient = QuantumJobClient;
exports.QuantumJobClientContext = QuantumJobClientContext;
exports.Quotas = Quotas;
exports.Storage = Storage;
//# sourceMappingURL=index.js.map