Support Incremental Codegen for Cli Extension Repo (#519)

This commit is contained in:
Liang Wang 2020-08-26 11:11:44 +08:00 коммит произвёл GitHub
Родитель 8967331adb
Коммит 575f2bb53e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
173 изменённых файлов: 13209 добавлений и 203 удалений

Просмотреть файл

@ -55,6 +55,7 @@
"@azure-tools/linq": "^3.1.232",
"autorest": "^3.0.6187",
"await-exec": "^0.1.2",
"compare-versions": "^3.6.0",
"dir-compare": "^2.2.0",
"js-yaml": "^3.13.1",
"node-yaml": "^3.2.0"

Просмотреть файл

@ -28,39 +28,37 @@ import { GenerateAzureCliValidators } from "./TemplateAzureCliValidators";
export class AzExtensionFullGenerator extends AzGeneratorBase {
constructor(model: CodeModelAz, isDebugMode: boolean) {
super(model, isDebugMode);
this.path = "azext_" + this.model.Extension_NameUnderscored + "/";
this.azDirectory = "azext_" + this.model.Extension_NameUnderscored + "/";
}
public async generateAll(): Promise<void> {
this.files[this.azDirectory + "generated/_params.py"] = GenerateAzureCliParams(this.model, this.isDebugMode);
this.files[this.azDirectory + "generated/commands.py"] = GenerateAzureCliCommands(this.model);
this.files[this.azDirectory + "generated/custom.py"] = GenerateAzureCliCustom(this.model);
this.files[this.azDirectory + "generated/_client_factory.py"] = GenerateAzureCliClientFactory(this.model);
this.files[this.azDirectory + "generated/_validators.py"] = GenerateAzureCliValidators(this.model);
this.files[this.azDirectory + "generated/action.py"] = GenerateAzureCliActions(this.model);
this.files[this.azDirectory + "generated/__init__.py"] = GenerateNamespaceInit(this.model);
public generateAll(): void {
this.files[this.path + "generated/_params.py"] = GenerateAzureCliParams(this.model, this.isDebugMode);
this.files[this.path + "generated/commands.py"] = GenerateAzureCliCommands(this.model);
this.files[this.path + "generated/custom.py"] = GenerateAzureCliCustom(this.model);
this.files[this.path + "generated/_client_factory.py"] = GenerateAzureCliClientFactory(this.model);
this.files[this.path + "generated/_validators.py"] = GenerateAzureCliValidators(this.model);
this.files[this.path + "generated/action.py"] = GenerateAzureCliActions(this.model);
this.files[this.path + "generated/__init__.py"] = GenerateNamespaceInit(this.model);
this.files[this.path + "tests/__init__.py"] = GenerateAzureCliTestInit(this.model);
this.files[this.path + "tests/latest/test_" + this.model.Extension_NameUnderscored + "_scenario.py"] = GenerateAzureCliTestScenario(this.model);
this.files[this.azDirectory + "tests/__init__.py"] = GenerateAzureCliTestInit(this.model);
this.files[this.azDirectory + "tests/latest/test_" + this.model.Extension_NameUnderscored + "_scenario.py"] = GenerateAzureCliTestScenario(this.model);
if (NeedPreparer()) {
this.files[this.path + "tests/latest/preparers.py"] = GenerateAzureCliTestPrepare(this.model);
this.files[this.azDirectory + "tests/latest/preparers.py"] = GenerateAzureCliTestPrepare(this.model);
};
this.files[this.path + "tests/latest/__init__.py"] = GenerateNamespaceInit(this.model);
this.files[this.azDirectory + "tests/latest/__init__.py"] = GenerateNamespaceInit(this.model);
this.files[this.path + "generated/_help.py"] = GenerateAzureCliHelp(this.model, this.isDebugMode);
this.files[this.azDirectory + "generated/_help.py"] = GenerateAzureCliHelp(this.model, this.isDebugMode);
this.files[this.path + "manual/__init__.py"] = GenerateNamespaceInit(this.model);
this.files[this.azDirectory + "manual/__init__.py"] = GenerateNamespaceInit(this.model);
this.files[this.path + "vendored_sdks/__init__.py"] = GenerateNamespaceInit(this.model);
this.files[this.azDirectory + "vendored_sdks/__init__.py"] = GenerateNamespaceInit(this.model);
this.files[this.path + "action.py"] = GenerateTopLevelImport(this.model, "action");
this.files[this.path + "custom.py"] = GenerateTopLevelImport(this.model, "custom");
this.files[this.path + "__init__.py"] = GenerateAzureCliInit(this.model);
this.files[this.path + "azext_metadata.json"] = GenerateAzureCliAzextMetadata(this.model);
this.files[this.azDirectory + "action.py"] = GenerateTopLevelImport(this.model, "action");
this.files[this.azDirectory + "custom.py"] = GenerateTopLevelImport(this.model, "custom");
this.files[this.azDirectory + "__init__.py"] = GenerateAzureCliInit(this.model);
this.files[this.azDirectory + "azext_metadata.json"] = GenerateAzureCliAzextMetadata(this.model);
this.files["report.md"] = GenerateAzureCliReport(this.model);
this.files["HISTORY.rst"] = GenerateAzureCliHistory(this.model);

Просмотреть файл

@ -2,6 +2,9 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as fs from 'fs';
import * as path from 'path';
import { PathConstants } from "../models";
import { AzGeneratorBase } from "./AzGeneratorBase";
import { CodeModelAz } from "./CodeModelAz";
import { GenerateAzureCliActions } from "./TemplateAzureCliActions";
@ -14,40 +17,63 @@ import { GenerateAzureCliParams } from "./TemplateAzureCliParams";
import { GenerateAzureCliTestPrepare } from "./TemplateAzureCliTestPrepare";
import { GenerateAzureCliTestScenario, NeedPreparer } from "./TemplateAzureCliTestScenario";
import { GenerateAzureCliValidators } from "./TemplateAzureCliValidators";
import { CliTopCustom } from "./templates/CliTopCustom";
import { CliTopHelp } from "./templates/CliTopHelp";
import { CliTopInit } from "./templates/CliTopInit";
import { CliTopMetadata } from "./templates/CliTopMetadata";
import { CliSetupPy } from "./templates/CliSetupPy";
export class AzExtensionIncrementalGenerator extends AzGeneratorBase {
constructor(model: CodeModelAz, isDebugMode: boolean) {
super(model, isDebugMode);
this.path = "azext_" + this.model.Extension_NameUnderscored + "/";
this.azDirectory = "azext_" + this.model.Extension_NameUnderscored;
}
public generateAll(): void {
this.files[this.path + "generated/_params.py"] = GenerateAzureCliParams(this.model, this.isDebugMode);
this.files[this.path + "generated/commands.py"] = GenerateAzureCliCommands(this.model);
this.files[this.path + "generated/custom.py"] = GenerateAzureCliCustom(this.model);
this.files[this.path + "generated/_client_factory.py"] = GenerateAzureCliClientFactory(this.model);
this.files[this.path + "generated/_validators.py"] = GenerateAzureCliValidators(this.model);
this.files[this.path + "generated/action.py"] = GenerateAzureCliActions(this.model);
this.files[this.path + "generated/__init__.py"] = GenerateNamespaceInit(this.model);
public async generateAll(): Promise<void> {
this.files[path.join(this.azDirectory, PathConstants.generatedFolder, PathConstants.paramsFile)] = GenerateAzureCliParams(this.model, this.isDebugMode);
this.files[path.join(this.azDirectory, PathConstants.generatedFolder, PathConstants.commandsFile)] = GenerateAzureCliCommands(this.model);
this.files[path.join(this.azDirectory, PathConstants.generatedFolder, PathConstants.customFile)] = GenerateAzureCliCustom(this.model);
this.files[path.join(this.azDirectory, PathConstants.generatedFolder, PathConstants.clientFactoryFile)] = GenerateAzureCliClientFactory(this.model);
this.files[path.join(this.azDirectory, PathConstants.generatedFolder, PathConstants.validatorsFile)] = GenerateAzureCliValidators(this.model);
this.files[path.join(this.azDirectory, PathConstants.generatedFolder, PathConstants.actionFile)] = GenerateAzureCliActions(this.model);
this.files[path.join(this.azDirectory, PathConstants.generatedFolder, PathConstants.initFile)] = GenerateNamespaceInit(this.model);
this.files[this.path + "tests/latest/test_" + this.model.Extension_NameUnderscored + "_scenario.py"] = GenerateAzureCliTestScenario(this.model);
this.files[path.join(this.azDirectory, PathConstants.testFolder, PathConstants.latestFolder, "test_" + this.model.Extension_NameUnderscored + "_scenario_incrementalGenerated.py")] = GenerateAzureCliTestScenario(this.model);
if (NeedPreparer()) {
this.files[this.path + "tests/latest/preparers.py"] = GenerateAzureCliTestPrepare(this.model);
this.files[path.join(this.azDirectory, PathConstants.testFolder, PathConstants.latestFolder, PathConstants.preparersFile)] = GenerateAzureCliTestPrepare(this.model);
};
this.files[this.path + "generated/_help.py"] = GenerateAzureCliHelp(this.model, this.isDebugMode);
this.files[path.join(this.azDirectory, PathConstants.generatedFolder, PathConstants.helpFile)] = GenerateAzureCliHelp(this.model, this.isDebugMode);
this.files[this.path + "manual/__init__.py"] = GenerateNamespaceInit(this.model);
this.files[path.join(this.azDirectory, PathConstants.manualFolder, PathConstants.initFile)] = GenerateNamespaceInit(this.model);
this.files[this.path + "vendored_sdks/__init__.py"] = GenerateNamespaceInit(this.model);
this.files[path.join(this.azDirectory, PathConstants.vendoredskdsFolder, PathConstants.initFile)] = GenerateNamespaceInit(this.model);
// Add Import and run method from generated folder (Init)
const cliTopInitGenerator = new CliTopInit(this.model, this.isDebugMode);
const cliTopInitBase = fs.readFileSync(path.join(this.model.CliOutputFolder, cliTopInitGenerator.relativePath)).toString();
this.files[cliTopInitGenerator.relativePath] = cliTopInitGenerator.incrementalGeneration(cliTopInitBase);
// Add Import from generated folder (Custom)
const cliTopCustomGenerator = new CliTopCustom(this.model, this.isDebugMode);
const cliTopCustomBase = fs.readFileSync(path.join(this.model.CliOutputFolder, cliTopCustomGenerator.relativePath)).toString();
this.files[cliTopCustomGenerator.relativePath] = cliTopCustomGenerator.incrementalGeneration(cliTopCustomBase);
// Add Import from generated folder (Help)
// Update version in HISTORY.rst
// Update version in setup.py
const cliTopHelpGenerator = new CliTopHelp(this.model, this.isDebugMode);
const cliTopHelpBase = fs.readFileSync(path.join(this.model.CliOutputFolder, cliTopHelpGenerator.relativePath)).toString();
this.files[cliTopHelpGenerator.relativePath] = cliTopHelpGenerator.incrementalGeneration(cliTopHelpBase);
// Upgrade version of azext_metadata
const cliTopMetadataGenerator = new CliTopMetadata(this.model, this.isDebugMode);
const cliTopMetadataBase = fs.readFileSync(path.join(this.model.CliOutputFolder, cliTopMetadataGenerator.relativePath)).toString();
this.files[cliTopMetadataGenerator.relativePath] = cliTopMetadataGenerator.incrementalGeneration(cliTopMetadataBase);
const cliSetupPyGenerator = new CliSetupPy(this.model, this.isDebugMode);
const cliSetupPyBase = fs.readFileSync(path.join(this.model.CliOutputFolder, cliSetupPyGenerator.relativePath)).toString();
this.files[cliSetupPyGenerator.relativePath] = cliSetupPyGenerator.incrementalGeneration(cliSetupPyBase);
}
}

Просмотреть файл

@ -8,14 +8,14 @@ import { CodeModelAz } from "./CodeModelAz";
export abstract class AzGeneratorBase {
model: CodeModelAz;
files: any = {};
path: string;
azDirectory: string;
isDebugMode: boolean;
constructor(model: CodeModelAz, isDebugMode: boolean) {
this.model = model;
this.path = "";
this.azDirectory = "";
this.isDebugMode = isDebugMode;
}
public abstract generateAll(): void;
public abstract async generateAll(): Promise<void>;
}

Просмотреть файл

@ -3,15 +3,22 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { GenerationMode } from "../models";
import { AzExtensionFullGenerator } from "./AzExtensionFullGenerator";
import { AzExtensionIncrementalGenerator } from "./AzExtensionIncrementalGenerator";
import { AzGeneratorBase } from "./AzGeneratorBase";
import { CodeModelAz } from "./CodeModelAz";
import { CodeModelCliImpl } from "./CodeModelAzImpl";
export class AzGeneratorFactory {
static async createAzGenerator(model: CodeModelAz, isDebugMode: boolean): Promise<AzGeneratorBase> {
static async createAzGenerator(model: CodeModelCliImpl, isDebugMode: boolean): Promise<AzGeneratorBase> {
await model.init();
model.GenerateTestInit();
return new AzExtensionFullGenerator(model, isDebugMode);
if (model.CliGenerationMode == GenerationMode.Full) {
return new AzExtensionFullGenerator(model, isDebugMode);
}
else {
return new AzExtensionIncrementalGenerator(model, isDebugMode);
}
}
}

Просмотреть файл

@ -0,0 +1,58 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as fs from 'fs';
import * as path from 'path';
import { PathConstants } from "../models";
import { AzGeneratorBase } from "./AzGeneratorBase";
import { CodeModelAz } from "./CodeModelAz";
import { GenerateAzureCliActions } from "./TemplateAzureCliActions";
import { GenerateAzureCliClientFactory } from "./TemplateAzureCliClientFactory";
import { GenerateAzureCliCommands } from "./TemplateAzureCliCommands";
import { GenerateAzureCliCustom } from "./TemplateAzureCliCustom";
import { GenerateAzureCliHelp } from "./TemplateAzureCliHelp";
import { GenerateNamespaceInit } from "./TemplateAzureCliNamespaceInit";
import { GenerateAzureCliParams } from "./TemplateAzureCliParams";
import { GenerateAzureCliTestPrepare } from "./TemplateAzureCliTestPrepare";
import { GenerateAzureCliTestScenario, NeedPreparer } from "./TemplateAzureCliTestScenario";
import { GenerateAzureCliValidators } from "./TemplateAzureCliValidators";
import { CliTopCustom } from "./templates/CliTopCustom";
import { CliTopHelp } from "./templates/CliTopHelp";
import { CliTopInit } from "./templates/CliTopInit";
import { CliTopMetadata } from "./templates/CliTopMetadata";
import { CliSetupPy } from "./templates/CliSetupPy";
export class AzMainIncrementalGenerator extends AzGeneratorBase {
constructor(model: CodeModelAz, isDebugMode: boolean) {
super(model, isDebugMode);
this.azDirectory = "azext_" + this.model.Extension_NameUnderscored;
}
public async generateAll(): Promise<void> {
// generated folder
// test folder
// manual folder
// Add Import and run method from generated folder (Init)
const cliTopInitGenerator = new CliTopInit(this.model, this.isDebugMode);
const cliTopInitBase = fs.readFileSync(path.join(this.model.CliOutputFolder, cliTopInitGenerator.relativePath)).toString();
this.files[cliTopInitGenerator.relativePath] = cliTopInitGenerator.incrementalGeneration(cliTopInitBase);
// Add Import from generated folder (Custom)
const cliTopCustomGenerator = new CliTopCustom(this.model, this.isDebugMode);
const cliTopCustomBase = fs.readFileSync(path.join(this.model.CliOutputFolder, cliTopCustomGenerator.relativePath)).toString();
this.files[cliTopCustomGenerator.relativePath] = cliTopCustomGenerator.incrementalGeneration(cliTopCustomBase);
// Add Import from generated folder (Help)
const cliTopHelpGenerator = new CliTopHelp(this.model, this.isDebugMode);
const cliTopHelpBase = fs.readFileSync(path.join(this.model.CliOutputFolder, cliTopHelpGenerator.relativePath)).toString();
this.files[cliTopHelpGenerator.relativePath] = cliTopHelpGenerator.incrementalGeneration(cliTopHelpBase);
// update sdk version in requirements and setuppy
// update sharedpy for multuple api
}
}

Просмотреть файл

@ -1,4 +1,5 @@
import { Operation, OperationGroup, Parameter, Property } from "@azure-tools/codemodel";
import { GenerationMode } from "../models";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
@ -57,6 +58,8 @@ export interface CodeModelAz {
init(): any;
SelectFirstExtension(): boolean;
SelectNextExtension(): boolean;
CliGenerationMode: GenerationMode;
CliOutputFolder: string;
Extension_Name: string;
Extension_NameUnderscored: string;
@ -65,7 +68,7 @@ export interface CodeModelAz {
Extension_ClientSubscriptionBound: boolean;
Extension_ClientBaseUrlBound: boolean;
Extension_ClientAuthenticationPolicy: string;
Extension_Mode: string;
Extension_Mode: string;
SelectFirstCommandGroup(): boolean;
SelectNextCommandGroup(): boolean;

Просмотреть файл

@ -3,19 +3,19 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { CodeModelAz, CommandExample, ExampleParam, MethodParam } from "./CodeModelAz";
import { CodeModel, SchemaType, Schema, ParameterLocation, Operation, Value, Parameter, VirtualParameter, Property, Request, OperationGroup } from '@azure-tools/codemodel';
import { serialize, deserialize, EnglishPluralizationService, pascalCase } from "@azure-tools/codegen";
import { Session, startSession, Host, Channel } from "@azure-tools/autorest-extension-base";
import { ToSnakeCase, deepCopy, ToJsonString, Capitalize, ToCamelCase, EscapeString, parseResourceId } from '../../utils/helper';
import { Channel, Session } from "@azure-tools/autorest-extension-base";
import { EnglishPluralizationService, pascalCase } from "@azure-tools/codegen";
import { CodeModel, Operation, OperationGroup, Parameter, ParameterLocation, Property, Request, Schema, SchemaType } from '@azure-tools/codemodel';
import { values } from "@azure-tools/linq";
import { azOptions, GenerateDefaultTestScenario, ResourcePool, GenerateDefaultTestScenarioByDependency, PrintTestScenario } from './ScenarioTool'
import { timingSafeEqual } from "crypto";
import { isNullOrUndefined, isArray } from "util";
import { isArray, isNullOrUndefined } from "util";
import { Capitalize, deepCopy, parseResourceId, ToCamelCase, ToJsonString, ToSnakeCase } from '../../utils/helper';
import { GenerationMode } from "../models";
import { CodeModelAz, CommandExample, ExampleParam, MethodParam } from "./CodeModelAz";
import { azOptions, GenerateDefaultTestScenario, GenerateDefaultTestScenarioByDependency, PrintTestScenario, ResourcePool } from './ScenarioTool';
class ActionParam {
public constructor(public groupOpActionName: string, public groupActionName: string, public actionName: string, public action: Parameter) {}
public constructor(public groupOpActionName: string, public groupActionName: string, public actionName: string, public action: Parameter) { }
}
export class CodeModelCliImpl implements CodeModelAz {
@ -42,6 +42,8 @@ export class CodeModelCliImpl implements CodeModelAz {
private _clientSubscriptionBound: boolean;
private _clientBaseUrlBound: boolean;
private _clientAuthenticationPolicy: string;
private _generationMode: GenerationMode = GenerationMode.Full;
private _outputPath: string;
private _cliCoreLib: string;
@ -80,9 +82,9 @@ export class CodeModelCliImpl implements CodeModelAz {
private sortOperationByAzCommand() {
for (let [idx, operationGroup] of this.codeModel.operationGroups.entries()) {
operationGroup.operations.sort(function(a, b) {
operationGroup.operations.sort(function (a, b) {
function getOrder(op: string) {
if(op.indexOf(" ") > -1) {
if (op.indexOf(" ") > -1) {
op = op.split(" ").last;
}
let opOrder = ["list", "show", "create", "update", "delete"];
@ -94,34 +96,34 @@ export class CodeModelCliImpl implements CodeModelAz {
}
function requiredParamLength(parameters) {
let ret = 0;
for(var i = 0; i < parameters.length; ++i){
for (var i = 0; i < parameters.length; ++i) {
if (parameters[i].required) ret++;
}
return ret;
}
let oa = getOrder(a.language['az']['name']);
let ob = getOrder(b.language['az']['name']);
if(oa < ob) {
if (oa < ob) {
return -1;
} else if(oa > ob) {
} else if (oa > ob) {
return 1;
} else {
let la = a.language['az']['name'];
let lb = b.language['az']['name'];
if(la != lb) {
if (la != lb) {
return la.localeCompare(lb);
}
let requiredLenA = requiredParamLength(a.parameters);
let requiredLenB = requiredParamLength(b.parameters);
if (requiredLenA!=requiredLenB) return requiredLenA > requiredLenB? -1: 1;
return a.parameters.length > b.parameters.length? -1: 1;
if (requiredLenA != requiredLenB) return requiredLenA > requiredLenB ? -1 : 1;
return a.parameters.length > b.parameters.length ? -1 : 1;
}
});
this.codeModel.operationGroups[idx] = operationGroup;
}
}
public get RandomizeNames(): boolean {
if (this.options?.['randomize-names']) return true;
return false;
@ -173,9 +175,9 @@ export class CodeModelCliImpl implements CodeModelAz {
let parameters = this.MethodParameter;
let defaultName = parameters.language['cli']['cliKey'];
let defaultToMatch = '{' + defaultName + '}';
if(!isNullOrUndefined(id_groups)) {
for(let k of id_groups.entries()) {
if(k[1] == defaultToMatch && defaultName != 'resourceGroupName') {
if (!isNullOrUndefined(id_groups)) {
for (let k of id_groups.entries()) {
if (k[1] == defaultToMatch && defaultName != 'resourceGroupName') {
this.MethodParameter.language['az']['id_part'] = k[0];
}
}
@ -202,9 +204,9 @@ export class CodeModelCliImpl implements CodeModelAz {
let parameters = this.MethodParameter;
let defaultName = parameters.language['cli']['cliKey'];
let defaultToMatch = '{' + defaultName + '}';
if(!isNullOrUndefined(id_groups)) {
for(let k of id_groups.entries()) {
if(k[1] == defaultToMatch && defaultName != 'resourceGroupName') {
if (!isNullOrUndefined(id_groups)) {
for (let k of id_groups.entries()) {
if (k[1] == defaultToMatch && defaultName != 'resourceGroupName') {
this.MethodParameter.language['az']['id_part'] = k[0];
}
}
@ -246,15 +248,15 @@ export class CodeModelCliImpl implements CodeModelAz {
if (this.Parameter_IsPolyOfSimple(this.MethodParameter)) {
let polyBaseParam = this.MethodParameter;
let allChildParam: Array<Parameter> = [];
for(let child of this.MethodParameter.schema['children'].all) {
for (let child of this.MethodParameter.schema['children'].all) {
let childParam = new Parameter(child.language.default.name, child.language.default.description, child, child.language);
childParam.language = child.language
childParam['polyBaseParam'] = polyBaseParam;
allChildParam.push(childParam);
}
let addResult = this.MethodParameters_AddPolySubClass(this.MethodParameter, allChildParam);
if(!addResult) {
this.session.message({Channel:Channel.Warning, Text: "dealingSimplePolymorphisme error! baseClass: " + this.MethodParameter_MapsTo});
if (!addResult) {
this.session.message({ Channel: Channel.Warning, Text: "dealingSimplePolymorphisme error! baseClass: " + this.MethodParameter_MapsTo });
}
}
} while (this.SelectNextMethodParameter());
@ -291,7 +293,7 @@ export class CodeModelCliImpl implements CodeModelAz {
let paramFlattenedName = this.Parameter_MapsTo(param);
let names = this.Method_NameAz.split(' ');
if (flattenedNames && flattenedNames.length > 0) {
for(let item of flattenedNames) {
for (let item of flattenedNames) {
mapName.push(ToSnakeCase(item));
}
mapName.reverse();
@ -300,7 +302,7 @@ export class CodeModelCliImpl implements CodeModelAz {
} else if (names.length > 1 && mapName[mapName.length - 1] == names[0].replace(/-/g, '_')) {
mapName.pop();
}
if(mapName.length > 0) {
if (mapName.length > 0) {
paramFlattenedName = mapName.reverse().join("_");
}
} else if (names.length > 1) {
@ -329,7 +331,7 @@ export class CodeModelCliImpl implements CodeModelAz {
}
if (pythonReserveWord.indexOf(paramFlattenedName) > -1) {
paramFlattenedName += "_";
}
}
if (pythonReserveWord.indexOf(preParamFlattenedName) > -1) {
preParamFlattenedName += "_";
}
@ -358,7 +360,7 @@ export class CodeModelCliImpl implements CodeModelAz {
continue;
}
if (this.MethodParameter_IsList && this.MethodParameter_IsListOfSimple && !this.MethodParameter_IsSimpleArray) {
let groupOpParamName: string = "Add" + Capitalize(ToCamelCase(this.Command_FunctionName + "_" + this.MethodParameter_MapsTo));
let groupOpParamName: string = "Add" + Capitalize(ToCamelCase(this.Command_FunctionName + "_" + this.MethodParameter_MapsTo));
let groupParamName: string = "Add" + Capitalize(ToCamelCase(this.CommandGroup_Key + "_" + this.MethodParameter_MapsTo));
let actionName: string = "Add" + Capitalize(ToCamelCase(this.MethodParameter_MapsTo));
let action = new ActionParam(groupOpParamName, groupParamName, actionName, param);
@ -378,11 +380,11 @@ export class CodeModelCliImpl implements CodeModelAz {
this.paramActionNameReference.set(param.schema, actionUniqueName);
nameActionReference.set(preActionUniqueName, preAction);
nameActionReference.set(actionUniqueName, action);
} else if(!this.paramActionNameReference.has(originParam.schema)) {
} else if (!this.paramActionNameReference.has(originParam.schema)) {
nameActionReference.set(actionName, action);
this.paramActionNameReference.set(param.schema, actionName);
}
}
}
} while (this.SelectNextMethodParameter())
}
} while (this.SelectNextMethod())
@ -455,11 +457,11 @@ export class CodeModelCliImpl implements CodeModelAz {
public get Extension_Name() {
return this.extensionName;
}
public get Extension_Mode() {
return this.codeModel.info['extensionMode'];
}
public get Extension_NameUnderscored() {
return this.extensionName.replace(/-/g, '_');
}
@ -484,6 +486,22 @@ export class CodeModelCliImpl implements CodeModelAz {
return this._clientAuthenticationPolicy;
}
public get CliGenerationMode(): GenerationMode {
return this._generationMode;
}
public set CliGenerationMode(value: GenerationMode) {
this._generationMode = value;
}
public get CliOutputFolder(): string {
return this._outputPath;
}
public set CliOutputFolder(value: string) {
this._outputPath = value;
}
//=================================================================================================================
// Command Groups
//
@ -707,19 +725,19 @@ export class CodeModelCliImpl implements CodeModelAz {
public get Command_GetOriginalOperation(): any {
let polyOriginal = this.Command.extensions?.['cli-poly-as-resource-original-operation'];
if(!isNullOrUndefined(polyOriginal) && !isNullOrUndefined(polyOriginal.extensions['cli-split-operation-original-operation'])) {
if (!isNullOrUndefined(polyOriginal) && !isNullOrUndefined(polyOriginal.extensions['cli-split-operation-original-operation'])) {
let splitOriginal = polyOriginal.extensions['cli-split-operation-original-operation'];
return splitOriginal;
}
let splittedOriginal = this.Command.extensions['cli-split-operation-original-operation'];
if(!isNullOrUndefined(splittedOriginal)) {
if (!isNullOrUndefined(splittedOriginal)) {
return splittedOriginal;
}
return polyOriginal;
}
public get Command_NeedGeneric(): boolean {
if(this.Command.language['az']['isSplitUpdate'] && !isNullOrUndefined(this.Command_GenericSetterParameter(this.Command_GetOriginalOperation))) {
if (this.Command.language['az']['isSplitUpdate'] && !isNullOrUndefined(this.Command_GenericSetterParameter(this.Command_GetOriginalOperation))) {
return true;
}
return false;
@ -731,7 +749,7 @@ export class CodeModelCliImpl implements CodeModelAz {
public get Command_SubGroupName(): string {
let subCommandGroupName = this.Command.language['az']['subCommandGroup'];
return isNullOrUndefined(subCommandGroupName)? "": subCommandGroupName;
return isNullOrUndefined(subCommandGroupName) ? "" : subCommandGroupName;
}
//=================================================================================================================
// Methods / Operations associated with the command.
@ -805,14 +823,14 @@ export class CodeModelCliImpl implements CodeModelAz {
} else {
let curIndex = this.currentMethodIndex + 1;
let hasNext = false;
while(curIndex <= this.currentOperationIndex) {
if(!this.Operation_IsHidden(this.CommandGroup.operations[curIndex])) {
while (curIndex <= this.currentOperationIndex) {
if (!this.Operation_IsHidden(this.CommandGroup.operations[curIndex])) {
hasNext = true;
break;
}
curIndex++;
}
return hasNext? false: true;
return hasNext ? false : true;
}
}
@ -830,7 +848,7 @@ export class CodeModelCliImpl implements CodeModelAz {
public get Method_NameCli(): string {
return this.Method.language['cli'].name;
}
}
public get Method_CliKey(): string {
return this.Method.language['cli']?.cliKey;
}
@ -856,7 +874,7 @@ export class CodeModelCliImpl implements CodeModelAz {
}
public get Method_NeedGeneric(): boolean {
if(this.Method.language['az']['isSplitUpdate'] && !isNullOrUndefined(this.Method_GenericSetterParameter(this.Method_GetOriginalOperation))) {
if (this.Method.language['az']['isSplitUpdate'] && !isNullOrUndefined(this.Method_GenericSetterParameter(this.Method_GetOriginalOperation))) {
return true;
}
return false;
@ -868,12 +886,12 @@ export class CodeModelCliImpl implements CodeModelAz {
public get Method_GetOriginalOperation(): any {
let polyOriginal = this.Method.extensions?.['cli-poly-as-resource-original-operation'];
if(!isNullOrUndefined(polyOriginal) && !isNullOrUndefined(polyOriginal.extensions?.['cli-split-operation-original-operation'])) {
if (!isNullOrUndefined(polyOriginal) && !isNullOrUndefined(polyOriginal.extensions?.['cli-split-operation-original-operation'])) {
let splitOriginal = polyOriginal.extensions?.['cli-split-operation-original-operation'];
return splitOriginal;
}
let splittedOriginal = this.Method.extensions?.['cli-split-operation-original-operation'];
if(!isNullOrUndefined(splittedOriginal)) {
if (!isNullOrUndefined(splittedOriginal)) {
return splittedOriginal;
}
return polyOriginal;
@ -977,7 +995,7 @@ export class CodeModelCliImpl implements CodeModelAz {
let submethodparameters = [];
if (this.Parameter_Type(param) == SchemaType.Array || this.Parameter_Type(param) == SchemaType.Dictionary) {
if ((param['schema'])['elementType'].type == SchemaType.Object) {
if(!isNullOrUndefined(param['schema']?.['elementType']?.properties)) {
if (!isNullOrUndefined(param['schema']?.['elementType']?.properties)) {
submethodparameters = param['schema']?.['elementType']?.properties;
}
for (let parent of values(param['schema']?.['elementType']?.['parents']?.all)) {
@ -998,7 +1016,7 @@ export class CodeModelCliImpl implements CodeModelAz {
submethodparameters = submethodparameters.concat(parent['properties'])
}
}
if(submethodparameters.length == 0) {
if (submethodparameters.length == 0) {
return null;
}
return submethodparameters;
@ -1010,7 +1028,7 @@ export class CodeModelCliImpl implements CodeModelAz {
let lastsub = this.substack.last;
this.submethodparameters = lastsub[0];
this.currentSubOptionIndex = lastsub[1];
this.substack.pop();
this.substack.pop();
} else {
this.submethodparameters = null;
this.currentSubOptionIndex = -1;
@ -1021,14 +1039,14 @@ export class CodeModelCliImpl implements CodeModelAz {
}
public Parameter_SetAzNameMapsTo(newName: string, param: Parameter = this.MethodParameter): void {
if(!isNullOrUndefined(param['nameBaseParam'])) {
if (!isNullOrUndefined(param['nameBaseParam'])) {
param['nameBaseParam']['subParams'][this.Method.language['cli']['name']] = newName;
}
param.language['az']['mapsto'] = newName;
}
public Schema_ActionName(schema: Schema = this.MethodParameter.schema) {
if(this.paramActionNameReference.has(schema)) {
if (this.paramActionNameReference.has(schema)) {
return this.paramActionNameReference.get(schema);
}
return null;
@ -1071,7 +1089,7 @@ export class CodeModelCliImpl implements CodeModelAz {
}
public Parameter_SubMapsTo(subMethodName: string, param: Parameter = this.MethodParameter) {
if(!isNullOrUndefined(param?.['subParams']?.[subMethodName])) {
if (!isNullOrUndefined(param?.['subParams']?.[subMethodName])) {
return param['subParams'][subMethodName];
}
return this.Parameter_MapsTo(param);
@ -1169,9 +1187,9 @@ export class CodeModelCliImpl implements CodeModelAz {
return false;
}
}
for(let parent of values(p['schema']?.['elementType']?.['parents']?.all)) {
for(let pp of values(parent['properties'])) {
if(this.isComplexSchema(pp['schema'].type)) {
for (let parent of values(p['schema']?.['elementType']?.['parents']?.all)) {
for (let pp of values(parent['properties'])) {
if (this.isComplexSchema(pp['schema'].type)) {
return false;
}
}
@ -1200,15 +1218,15 @@ export class CodeModelCliImpl implements CodeModelAz {
return false;
}
}
for(let parent of values(p['schema']?.['elementType']?.['parents']?.all)) {
for(let pp of values(parent['properties'])) {
if(this.isComplexSchema(pp['schema'].type)) {
for (let parent of values(p['schema']?.['elementType']?.['parents']?.all)) {
for (let pp of values(parent['properties'])) {
if (this.isComplexSchema(pp['schema'].type)) {
return false;
}
}
}
}
else if(this.isComplexSchema(p['schema'].type)) {
else if (this.isComplexSchema(p['schema'].type)) {
// objects.objects
return false;
}
@ -1231,12 +1249,12 @@ export class CodeModelCliImpl implements CodeModelAz {
return false;
}
}
for(let parent of values(p['schema']?.['elementType']?.['parents']?.all)) {
for(let pp of values(parent['properties'])) {
for (let parent of values(p['schema']?.['elementType']?.['parents']?.all)) {
for (let pp of values(parent['properties'])) {
if (pp['readOnly']) {
continue;
}
if(this.isComplexSchema(pp['schema'].type)) {
if (this.isComplexSchema(pp['schema'].type)) {
return false;
}
}
@ -1246,7 +1264,7 @@ export class CodeModelCliImpl implements CodeModelAz {
// dicts.objects or dicts.dictionaries
return false;
}
return true;
return true;
}
else if (this.MethodParameter_Type == SchemaType.Any) {
return false;
@ -1255,13 +1273,13 @@ export class CodeModelCliImpl implements CodeModelAz {
}
public Parameter_IsPolyOfSimple(param: Parameter = this.MethodParameter): boolean {
if(!isNullOrUndefined(param['isPolyOfSimple'])) {
if (!isNullOrUndefined(param['isPolyOfSimple'])) {
return param['isPolyOfSimple'];
}
if (param?.schema?.type == SchemaType.Object && !isNullOrUndefined(param.schema['children']) && !isNullOrUndefined(param.schema['discriminator'])) {
let isSimplePoly = true;
for(let child of param.schema['children'].all) {
if(this.Schema_IsList(child) && this.Schema_IsListOfSimple(child)) {
for (let child of param.schema['children'].all) {
if (this.Schema_IsList(child) && this.Schema_IsListOfSimple(child)) {
continue;
}
isSimplePoly = false;
@ -1372,8 +1390,7 @@ export class CodeModelCliImpl implements CodeModelAz {
let shouldHidden = undefined;
let defaultValue = undefined;
let hasDefault = false;
if (this.EnterSubMethodParameters(parameter))
{
if (this.EnterSubMethodParameters(parameter)) {
shouldHidden = true;
defaultValue = "{";
if (this.SelectFirstMethodParameter()) {
@ -1431,7 +1448,7 @@ export class CodeModelCliImpl implements CodeModelAz {
return this.Parameter_DefaultValue(this.MethodParameter);
}
public Parameter_DefaultValue(parameter: Parameter): string | undefined{
public Parameter_DefaultValue(parameter: Parameter): string | undefined {
if (!parameter.language['az'].hasOwnProperty('default-value')) {
if (parameter?.language?.['cli']?.hasOwnProperty('default-value')) {
parameter.language['az']['default-value'] = parameter.language['cli']['default-value'];
@ -1456,9 +1473,9 @@ export class CodeModelCliImpl implements CodeModelAz {
}
public Parameter_InGlobal(parameter: Parameter): boolean {
if(this.codeModel.globalParameters.indexOf(parameter) > -1) {
if (this.codeModel.globalParameters.indexOf(parameter) > -1) {
return true;
}
}
return false;
}
@ -1588,7 +1605,7 @@ export class CodeModelCliImpl implements CodeModelAz {
submethodparameters = this.submethodparameters;
this.ExitSubMethodParameters();
}
method_param_list.push(new MethodParam(this.MethodParameter, this.Parameter_IsList(this.MethodParameter), this.MethodParameter_IsListOfSimple || this.MethodParameter_IsSimpleArray, submethodparameters, this.currentParameterIndex>=this.Method.parameters.length));
method_param_list.push(new MethodParam(this.MethodParameter, this.Parameter_IsList(this.MethodParameter), this.MethodParameter_IsListOfSimple || this.MethodParameter_IsSimpleArray, submethodparameters, this.currentParameterIndex >= this.Method.parameters.length));
}
} while (this.SelectNextMethodParameter());
}
@ -1605,7 +1622,7 @@ export class CodeModelCliImpl implements CodeModelAz {
}
private isDiscriminator(param: any): boolean {
return (this.Command_GetOriginalOperation && param?.targetProperty?.['isDiscriminator'] )? true: false;
return (this.Command_GetOriginalOperation && param?.targetProperty?.['isDiscriminator']) ? true : false;
}
private AddExampleParameter(methodParam: MethodParam, example_param: ExampleParam[], value: any, polySubParam: MethodParam): boolean {
@ -1808,7 +1825,7 @@ export class CodeModelCliImpl implements CodeModelAz {
match = false;
};
}
if (methodParam.inBody && ancestors_.length != 1 || !methodParam.inBody && ancestors_.length >0) {
if (methodParam.inBody && ancestors_.length != 1 || !methodParam.inBody && ancestors_.length > 0) {
match = false;
}
if (match) {
@ -1855,7 +1872,7 @@ export class CodeModelCliImpl implements CodeModelAz {
if (cliKey) {
let names = cliKey.split('#');
if (names && names.length > 1) {
return names[names.length-1];
return names[names.length - 1];
}
}
return '';
@ -1907,15 +1924,14 @@ export class CodeModelCliImpl implements CodeModelAz {
example.Method_IsLongRun = this.Method.extensions?.['x-ms-long-running-operation'] ? true : false;
if (this.Method_GetSplitOriginalOperation) {
//filter example by name for generic createorupdate
if(this.Command_MethodName.toLowerCase()=="update" && !id.toLowerCase().endsWith("_update"))
if (this.Command_MethodName.toLowerCase() == "update" && !id.toLowerCase().endsWith("_update"))
return;
if(this.Command_MethodName.toLowerCase()!="update" && id.toLowerCase().endsWith("_update"))
if (this.Command_MethodName.toLowerCase() != "update" && id.toLowerCase().endsWith("_update"))
return;
}
if (this.filterExampleByPoly(example_obj, example)) {
for (let i=0;i<example.Parameters.length; i++) {
if (this.isDiscriminator(example.Parameters[i].methodParam.value) )
{
for (let i = 0; i < example.Parameters.length; i++) {
if (this.isDiscriminator(example.Parameters[i].methodParam.value)) {
example.Parameters.splice(i, 1);
i--;
}
@ -1947,7 +1963,7 @@ export class CodeModelCliImpl implements CodeModelAz {
}
parameters.push(param.name + " " + slp);
if (["--resource-group", "-g"].indexOf(param.name) >=0) {
if (["--resource-group", "-g"].indexOf(param.name) >= 0) {
hasRG = true;
}
}
@ -1987,7 +2003,7 @@ export class CodeModelCliImpl implements CodeModelAz {
if (this.resource_pool.isResource(paramKey) == example.ResourceClassName) foundResource = true;
}
}
return foundResource? parameters: [];
return foundResource ? parameters : [];
}
public GetPreparerEntities(): any[] {
@ -2015,7 +2031,7 @@ export class CodeModelCliImpl implements CodeModelAz {
let ret: string[][] = [];
this.GetAllExamples(id, (example) => {
let waitCmd = this.GetExampleWait(example);
if (waitCmd.length>0) ret.push(waitCmd);
if (waitCmd.length > 0) ret.push(waitCmd);
});
return ret;
}
@ -2165,17 +2181,17 @@ export class CodeModelCliImpl implements CodeModelAz {
return 0;
};
let scenarioExamples: Map<string, CommandExample> = new Map<string, CommandExample>();
let commandExamples = this.GetAllExamples();
for (let i=0; i<this._testScenario.length; i++) {
for (let i = 0; i < this._testScenario.length; i++) {
for (let commandExample of commandExamples) {
if (this.matchExample(commandExample, this._testScenario[i]['name'])) {
scenarioExamples.set(this._testScenario[i]['name'], commandExample);
break;
}
}
}
let i = 0;
@ -2219,14 +2235,14 @@ export class CodeModelCliImpl implements CodeModelAz {
}
private matchExample(example: CommandExample, id: string) {
if (!id) return false;
if (!id) return false;
return example.Id.toLowerCase() == id.toLowerCase() || example.Id.toLowerCase().endsWith(`/${id.toLowerCase()}`);
}
public GetAllExamples(id?: string, callback?: (example) => void): CommandExample[] {
let ret: CommandExample[] = [];
let found = false;
this.GetAllMethods(null, () => {
if (found) return;
if (found) return;
for (let example of this.GetExamples()) {
if (id && !this.matchExample(example, id)) continue;
if (callback) {

Просмотреть файл

@ -3,18 +3,18 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
class FromImport
{
import { GenerationMode } from "../models";
class FromImport {
public constructor(from: string, imports: string[]) {
this.from = from;
this.imports = imports;
}
public from: string;
public imports: string[];
public imports: string[];
}
export class HeaderGenerator
{
export class HeaderGenerator {
public constructor() {
this.disableLineTooLong = false;
this.disableTooManyLines = false;
@ -24,10 +24,25 @@ export class HeaderGenerator
this.disableProtectedAccess = false;
this.disableWildcardImport = false;
this.disableUnusedWildcardImport = false;
this.generationMode = GenerationMode.Full;
this.fromImports = [];
this.imports = [];
}
public static GetCliGenerationMode(header: string): GenerationMode {
if (header) {
if (String(header).indexOf("# Code generated by Microsoft (R) AutoRest Code Generator.") != -1) {
if (String(header).indexOf("# Generation mode: Incremental") != -1) {
return GenerationMode.Incremental;
}
return GenerationMode.Full;
}
return GenerationMode.Manual;
}
return GenerationMode.Full;
}
public addFromImport(from: string, imports: string[]) {
this.fromImports.push(new FromImport(from, imports));
}
@ -51,6 +66,15 @@ export class HeaderGenerator
output.push("# Code generated by Microsoft (R) AutoRest Code Generator.");
output.push("# Changes may cause incorrect behavior and will be lost if the code is");
output.push("# regenerated.");
if (this.generationMode == GenerationMode.Full) {
// output.push("# GenerationMode: Full");
}
else {
output.push("#");
output.push("# Generation mode: Incremental");
}
output.push("# --------------------------------------------------------------------------");
// disable required pylint stuff
@ -101,7 +125,7 @@ export class HeaderGenerator
}
output.push(")");
}
}
}
});
}
@ -117,6 +141,7 @@ export class HeaderGenerator
public disableWildcardImport: boolean;
public disableUnusedWildcardImport: boolean;
public codingUtf8: boolean;
public generationMode: GenerationMode;
private fromImports: FromImport[];
private imports: string[];
}

Просмотреть файл

@ -1,10 +1,12 @@
import { Channel, Host, startSession } from '@azure-tools/autorest-extension-base';
import { CodeModel, codeModelSchema } from '@azure-tools/codemodel';
import { EOL } from "os";
import * as path from 'path';
import { isNullOrUndefined } from 'util';
import { GenerationMode } from "../models";
import { ArgumentConstants, GenerationMode, PathConstants } from "../models";
import { AzGeneratorFactory } from "./AzGeneratorFactory";
import { CodeModelCliImpl } from "./CodeModelAzImpl";
import { HeaderGenerator } from './Header';
export async function processRequest(host: Host) {
const debug = await host.GetValue('debug') || false;
@ -16,34 +18,13 @@ export async function processRequest(host: Host) {
model.CliCoreLib = cliCoreLib;
}
// Read the argument of generation-mode, detect if needed
let generationMode = await host.GetValue('generation-mode') || "auto";
host.Message({ Channel: Channel.Information, Text: "Input generation-mode is: " + generationMode });
if (String(generationMode).toLowerCase() == "full") {
session.model.language['az']['generation-mode'] = GenerationMode.Full;
}
else if (String(generationMode).toLowerCase() == "incremental") {
session.model.language['az']['generation-mode'] = GenerationMode.Incremental;
}
else {
// Handel Auto
let options = await session.getValue('az');
let extensionName = options['extensions'];
let usingCodeGenBefore = await isExistingCliByCodegen(host, extensionName);
if (usingCodeGenBefore == true) {
host.Message({ Channel: Channel.Information, Text: "Existing Cli is genreated by code gen before." });
session.model.language['az']['generation-mode'] = GenerationMode.Full;
}
else {
host.Message({ Channel: Channel.Information, Text: "Existing Cli is genreated by manual before." });
session.model.language['az']['generation-mode'] = GenerationMode.Incremental;
}
}
host.Message({ Channel: Channel.Information, Text: "generation-mode in code model is: " + GenerationMode[session.model.language['az']['generation-mode']] });
// Read existing file generation-mode
let options = await session.getValue('az');
model.CliGenerationMode = await autoDetectGenerationMode(host, options['extensions']);
model.CliOutputFolder = await host.GetValue("output-folder");
let generator = await AzGeneratorFactory.createAzGenerator(model, debug);
generator.generateAll();
await generator.generateAll();
let files = generator.files;
if (model.SelectFirstExtension()) {
@ -74,15 +55,36 @@ export async function processRequest(host: Host) {
}
}
async function isExistingCliByCodegen(host: Host, name: String): Promise<Boolean> {
async function autoDetectGenerationMode(host: Host, name: String): Promise<GenerationMode> {
// Verify the __init__.py in generated folder
let az_name = "azext_" + name.replace("-", "_");
let path = az_name + "/__init__.py";
let exist = await host.ReadFile(path);
if (exist) {
if (String(exist).indexOf("# Code generated by Microsoft (R) AutoRest Code Generator.") != -1) {
return true;
if (isNullOrUndefined(name)) {
throw new Error("name should not be null");
}
let azName = "azext_" + name.replace("-", "_");
let relativePath = path.join(azName, PathConstants.initFile);
let rootInit = await host.ReadFile(relativePath);
let existingMode = HeaderGenerator.GetCliGenerationMode(rootInit);
let result: GenerationMode;
host.Message({ Channel: Channel.Information, Text: "Existing Cli code generation-mode is: " + GenerationMode[existingMode] });
// Read the argument of generation-mode, detect if needed
let generationMode = await host.GetValue(ArgumentConstants.generationMode) || "auto";
host.Message({ Channel: Channel.Information, Text: "Input generation-mode is: " + generationMode });
if (String(generationMode).toLowerCase() == "full") {
result = GenerationMode.Full;
}
else if (String(generationMode).toLowerCase() == "incremental") {
result = GenerationMode.Incremental;
}
else {
if (existingMode == GenerationMode.Full) {
result = GenerationMode.Full;
}
else {
result = GenerationMode.Incremental;
}
}
return false;
host.Message({ Channel: Channel.Information, Text: "generation-mode in code model is: " + GenerationMode[result] });
return result;
}

Просмотреть файл

@ -0,0 +1,65 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { EOL } from 'os';
import { isNullOrUndefined } from "util";
import { CodeGenConstants, GenerationMode, PathConstants } from "../../models";
import { CodeModelAz } from "../CodeModelAz";
import { HeaderGenerator } from "../Header";
import { GenerateAzureCliSetupPy } from "../TemplateAzureCliSetupPy";
import { TemplateBase } from "./TemplateBase";
import compareVersions = require('compare-versions');
export class CliSetupPy extends TemplateBase {
constructor(model: CodeModelAz, isDebugMode: boolean) {
super(model, isDebugMode);
this.relativePath = PathConstants.setupPyFile;
}
public fullGeneration(): string[] {
return GenerateAzureCliSetupPy(this.model);
}
public incrementalGeneration(base: string): string[] {
if (isNullOrUndefined(base) || base.length == 0) {
return this.fullGeneration();
}
else {
let existingMode: GenerationMode = HeaderGenerator.GetCliGenerationMode(base);
if (existingMode == GenerationMode.Full) {
throw new Error("GenerationMode Error: Should not set Incremental mode on existing Full generation RP.");
}
else {
const rst = compareVersions(CodeGenConstants.minCliCoreVersion, "2.3.1");
if (rst == 0 || rst == 1) {
const baseSplit: string[] = base.split(EOL);
const headerGenerator: HeaderGenerator = new HeaderGenerator();
headerGenerator.generationMode = GenerationMode.Incremental;
let output: string[] = headerGenerator.getLines();
let firstNoneCommentLineIdx: number = -1;
let skipcomment: number = 2;
for (let i: number = 0; i < baseSplit.length; ++i) {
if (baseSplit[i].startsWith("# ----")) {
skipcomment--;
if (skipcomment == 0) {
firstNoneCommentLineIdx = i;
break;
}
}
}
if (firstNoneCommentLineIdx != -1) {
for (let i: number = firstNoneCommentLineIdx + 1; i < baseSplit.length; ++i) {
if (!(baseSplit[i].endsWith("'Programming Language :: Python :: 2',")
|| baseSplit[i].endsWith("'Programming Language :: Python :: 2.7',"))) {
output.push(baseSplit[i]);
}
}
}
return output;
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,78 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { EOL } from 'os';
import * as path from 'path';
import { isNullOrUndefined } from "util";
import { getIndentString } from "../../../utils/helper";
import { GenerationMode, PathConstants } from "../../models";
import { CodeModelAz } from "../CodeModelAz";
import { HeaderGenerator } from "../Header";
import { GenerateTopLevelImport } from "../TemplateAzureCliTopLevelImport";
import { TemplateBase } from "./TemplateBase";
export class CliTopCustom extends TemplateBase {
constructor(model: CodeModelAz, isDebugMode: boolean) {
super(model, isDebugMode);
this.relativePath = path.join("azext_" + this.model.Extension_NameUnderscored, PathConstants.customFile);
}
public fullGeneration(): string[] {
return GenerateTopLevelImport(this.model, "custom");
}
public incrementalGeneration(base: string): string[] {
if (isNullOrUndefined(base) || base.length == 0) {
// No base version
return this.fullGeneration();
}
else {
const existingMode: GenerationMode = HeaderGenerator.GetCliGenerationMode(base);
if (existingMode == GenerationMode.Full) {
throw new Error("GenerationMode Error: Should not set Incremental mode on existing Full generation RP.");
}
else if (existingMode == GenerationMode.Incremental) {
// No need more incremental change
return base.split(EOL);
}
else {
// Change base on the manual
const headerGenerator: HeaderGenerator = new HeaderGenerator();
headerGenerator.generationMode = GenerationMode.Incremental;
let output: string[] = headerGenerator.getLines();
// Add loading code block
output.push("");
output = output.concat(this.loadGeneratedCustom(0));
const baseSplit: string[] = base.split(EOL);
// Pass start comment
let firstNoneCommentLineIdx: number = -1;
for (let i: number = 0; i < baseSplit.length; ++i) {
if (!baseSplit[i].startsWith("#")) {
firstNoneCommentLineIdx = i;
break;
}
}
if (firstNoneCommentLineIdx != -1) {
output = output.concat(baseSplit.slice(firstNoneCommentLineIdx));
}
return output;
}
}
}
private loadGeneratedCustom(indent: number): string[] {
let output: string[] = [];
let indentStr: string = getIndentString(indent);
output.push(indentStr + "try:");
output.push(indentStr + " from .generated.custom import * # noqa: F403");
output.push(indentStr + " from .manual.custom import * # noqa: F403");
output.push(indentStr + "except ImportError:");
output.push(indentStr + " pass");
return output;
}
}

Просмотреть файл

@ -0,0 +1,77 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { EOL } from 'os';
import * as path from 'path';
import { isNullOrUndefined } from "util";
import { getIndentString } from "../../../utils/helper";
import { GenerationMode, PathConstants } from "../../models";
import { CodeModelAz } from "../CodeModelAz";
import { HeaderGenerator } from "../Header";
import { TemplateBase } from "./TemplateBase";
export class CliTopHelp extends TemplateBase {
constructor(model: CodeModelAz, isDebugMode: boolean) {
super(model, isDebugMode);
this.relativePath = path.join("azext_" + this.model.Extension_NameUnderscored, PathConstants.helpFile);
}
public fullGeneration(): string[] {
// Nothing need to do
return null;
}
public incrementalGeneration(base: string): string[] {
if (isNullOrUndefined(base) || base.length == 0) {
// No base version
return this.fullGeneration();
}
else {
const existingMode: GenerationMode = HeaderGenerator.GetCliGenerationMode(base);
if (existingMode == GenerationMode.Full) {
throw new Error("GenerationMode Error: Should not set Incremental mode on existing Full generation RP.");
}
else if (existingMode == GenerationMode.Incremental) {
// No need more incremental change
return base.split(EOL);
}
else {
// Change base on the manual
const headerGenerator: HeaderGenerator = new HeaderGenerator();
headerGenerator.generationMode = GenerationMode.Incremental;
let output: string[] = headerGenerator.getLines();
// Add loading code block
output.push("");
output = output.concat(this.loadGeneratedHelp(0));
// Pass start comment
const baseSplit: string[] = base.split(EOL);
let firstNoneCommentLineIdx: number = -1;
for (let i: number = 0; i < baseSplit.length; ++i) {
if (!baseSplit[i].startsWith("#")) {
firstNoneCommentLineIdx = i;
break;
}
}
if (firstNoneCommentLineIdx != -1) {
output = output.concat(baseSplit.slice(firstNoneCommentLineIdx));
}
return output;
}
}
}
private loadGeneratedHelp(indent: number): string[] {
let output: string[] = [];
let indentStr: string = getIndentString(indent);
output.push(indentStr + "try:");
output.push(indentStr + " from .generated._help import helps # pylint: disable=reimported");
output.push(indentStr + " from .manual._help import helps # pylint: disable=reimported");
output.push(indentStr + "except ImportError:");
output.push(indentStr + " pass");
return output;
}
}

Просмотреть файл

@ -0,0 +1,114 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { EOL } from 'os';
import * as path from 'path';
import { isNullOrUndefined } from "util";
import { getIndentString } from "../../../utils/helper";
import { GenerationMode, PathConstants } from "../../models";
import { CodeModelAz } from "../CodeModelAz";
import { HeaderGenerator } from "../Header";
import { GenerateAzureCliInit } from "../TemplateAzureCliInit";
import { TemplateBase } from "./TemplateBase";
export class CliTopInit extends TemplateBase {
constructor(model: CodeModelAz, isDebugMode: boolean) {
super(model, isDebugMode);
this.relativePath = path.join("azext_" + this.model.Extension_NameUnderscored, PathConstants.initFile);
}
public fullGeneration(): string[] {
return GenerateAzureCliInit(this.model);
}
public incrementalGeneration(base: string): string[] {
if (isNullOrUndefined(base) || base.length == 0) {
// No base version
return this.fullGeneration();
}
else {
const existingMode: GenerationMode = HeaderGenerator.GetCliGenerationMode(base);
if (existingMode == GenerationMode.Full) {
throw new Error("GenerationMode Error: Should not set Incremental mode on existing Full generation RP.");
}
else if (existingMode == GenerationMode.Incremental) {
// No need more incremental change
return base.split(EOL);
}
else {
// Change base on the manual
const headerGenerator: HeaderGenerator = new HeaderGenerator();
headerGenerator.generationMode = GenerationMode.Incremental;
let output: string[] = headerGenerator.getLines();
// Pass start comment
const baseSplit: string[] = base.split(EOL);
let firstNoneCommentLineIdx: number = -1;
for (let i: number = 0; i < baseSplit.length; ++i) {
if (!baseSplit[i].startsWith("#")) {
firstNoneCommentLineIdx = i;
break;
}
}
if (firstNoneCommentLineIdx != -1) {
output = output.concat(baseSplit.slice(firstNoneCommentLineIdx));
}
let loadtableIndex: number = -1;
let loadargIndex: number = -1;
for (let i = 0; i < output.length; ++i) {
if (output[i].indexOf("load_command_table") != -1) {
loadtableIndex = i;
}
if (output[i].indexOf("load_arguments") != -1) {
loadargIndex = i;
}
}
if (loadargIndex != -1) {
let indent: number = output[loadargIndex].indexOf("l");
let insertLines: string[] = this.loadGeneratedArguments(indent);
output.splice(loadargIndex + 1, 0, ...insertLines);
}
if (loadtableIndex != -1) {
let indent: number = output[loadtableIndex].indexOf("l");
let insertLines: string[] = this.loadGeneratedCommands(indent);
output.splice(loadtableIndex + 1, 0, ...insertLines);
}
return output;
}
}
}
private loadGeneratedArguments(indent: number): string[] {
let output: string[] = [];
let indentStr: string = getIndentString(indent);
output.push(indentStr + "try:");
output.push(indentStr + " from .generated._params import load_arguments as load_arguments_generated");
output.push(indentStr + " load_arguments_generated(self, command)");
output.push(indentStr + " from .manual._params import load_arguments as load_arguments_manual");
output.push(indentStr + " load_arguments_manual(self, command)");
output.push(indentStr + "except ImportError:");
output.push(indentStr + " pass");
return output;
}
private loadGeneratedCommands(indent: number): string[] {
let output: string[] = [];
let indentStr: string = getIndentString(indent);
output.push(indentStr + "try:");
output.push(indentStr + " from .generated.commands import load_command_table as load_command_table_generated");
output.push(indentStr + " load_command_table_generated(self, args)");
output.push(indentStr + " from .manual.commands import load_command_table as load_command_table_manual");
output.push(indentStr + " load_command_table_manual(self, args)");
output.push(indentStr + "except ImportError:");
output.push(indentStr + " pass");
return output;
}
}

Просмотреть файл

@ -0,0 +1,34 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { EOL } from 'os';
import * as path from 'path';
import { isNullOrUndefined } from "util";
import { AzextMetadata, PathConstants, CodeGenConstants } from "../../models";
import { CodeModelAz } from "../CodeModelAz";
import { GenerateAzureCliAzextMetadata } from "../TemplateAzureCliAzextMetadata";
import { TemplateBase } from "./TemplateBase";
export class CliTopMetadata extends TemplateBase {
constructor(model: CodeModelAz, isDebugMode: boolean) {
super(model, isDebugMode);
this.relativePath = path.join("azext_" + this.model.Extension_NameUnderscored, PathConstants.metadataFile);
}
public fullGeneration(): string[] {
return GenerateAzureCliAzextMetadata(this.model);
}
public incrementalGeneration(base: string): string[] {
if (isNullOrUndefined(base) || base.length == 0) {
return this.fullGeneration();
}
else {
let t: AzextMetadata = JSON.parse(base);
t["azext.minCliCoreVersion"] = CodeGenConstants.minCliCoreVersion;
let output: string[] = JSON.stringify(t, null, " ").split(EOL);
return output;
}
}
}

Просмотреть файл

@ -0,0 +1,22 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { CodeModelAz } from "../CodeModelAz";
export abstract class TemplateBase {
protected model: CodeModelAz;
protected isDebugMode: boolean;
public relativePath: string;
constructor(model: CodeModelAz, isDebugMode: boolean) {
this.model = model;
this.isDebugMode = isDebugMode;
this.relativePath = "";
}
public abstract fullGeneration(): string[];
public abstract incrementalGeneration(base: string): string[];
}

Просмотреть файл

@ -4,6 +4,40 @@
*--------------------------------------------------------------------------------------------*/
export enum GenerationMode {
Manual,
Full,
Incremental
}
export class PathConstants {
public static readonly generatedFolder: string = "generated";
public static readonly testFolder: string = "tests";
public static readonly manualFolder: string = "manual";
public static readonly vendoredskdsFolder: string = "vendored_sdks";
public static readonly latestFolder: string = "latest";
public static readonly paramsFile: string = "_params.py";
public static readonly commandsFile: string = "commands.py";
public static readonly customFile: string = "custom.py";
public static readonly clientFactoryFile: string = "_client_factory.py";
public static readonly validatorsFile: string = "_validators.py";
public static readonly actionFile: string = "action.py";
public static readonly initFile: string = "__init__.py";
public static readonly helpFile: string = "_help.py";
public static readonly preparersFile: string = "preparers.py";
public static readonly metadataFile: string = "azext_metadata.json";
public static readonly setupPyFile: string = "setup.py";
}
export class ArgumentConstants {
public static readonly generationMode: string = "generation-mode";
}
export class CodeGenConstants {
public static readonly minCliCoreVersion = "2.11.0";
}
export interface AzextMetadata {
"azext.minCliCoreVersion": string;
"azext.isPreview": boolean;
"azext.isExperimental": boolean;
}

Просмотреть файл

@ -1,14 +1,16 @@
import { suite, test, slow, timeout } from 'mocha-typescript';
import * as assert from 'assert';
import { readFile, writeFile, readdir, mkdir } from "@azure-tools/async-io";
import { exec } from 'child_process';
import * as fs from 'fs';
import { slow, suite, test, timeout } from 'mocha-typescript';
import * as path from 'path';
import { copyRecursiveSync, deleteFolderRecursive } from "../utils/helper";
require('source-map-support').install();
@suite class Process {
private incrementalTestRPs: string[] = ["mixed-reality"];
private noNeedTestRPs: string[] = ["testserver"];
async runAz(directory: string, each: string) {
let cmd = `${__dirname}/../../` + "node_modules/.bin/autorest --version=3.0.6271 --az --use=" + `${__dirname}/../../` + " " + directory + "/configuration/readme.md --azure-cli-extension-folder=" + directory + "/tmpoutput/";
console.log(cmd);
@ -41,16 +43,23 @@ require('source-map-support').install();
});
}
@test(slow(600000), timeout(1500000)) async acceptanceSuite() {
const dir = `${__dirname}/../../src/test/scenarios/`;
const folders = await readdir(dir);
const folders = fs.readdirSync(dir);
let result = true;
let msg = "";
let finalResult = true;
for (const each of folders) {
if (each != "testserver") {
if (this.noNeedTestRPs.indexOf(each) == -1) { // Not run test server now
console.log(`Processing: ${each}`);
// Remove tmpoutput
deleteFolderRecursive(path.join(dir, each, "tmpoutput"));
fs.mkdirSync(path.join(dir, each, "tmpoutput"));
if (this.incrementalTestRPs.indexOf(each) > -1) { // Handle for incremental
copyRecursiveSync(path.join(dir, each, "basecli", "src"), path.join(dir, each, "tmpoutput", "src"));
}
try {
await this.runAz(dir + each, each).then(res => {
if (res == false) {

Просмотреть файл

@ -0,0 +1,13 @@
# Azure CLI Mixed Reality Extension #
This is the extension of azure cli which provides commands to manage resources of Mixed Reality cloud service.
## How to use ##
First, install the extension:
```
az extension add --name mixed-reality
```
Then, call it as you would any other az command:
```
az spatial-anchors-account -h
```

Просмотреть файл

@ -0,0 +1,28 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
from azure.cli.core import AzCommandsLoader
import azext_mixed_reality._help # pylint: disable=unused-import
class MixedRealityCommandsLoader(AzCommandsLoader):
def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
custom_command_type = CliCommandType(operations_tmpl='azext_mixed_reality.custom#{}')
super(MixedRealityCommandsLoader, self).__init__(cli_ctx=cli_ctx, custom_command_type=custom_command_type) # pylint: disable=line-too-long
def load_command_table(self, args):
from .commands import load_command_table
load_command_table(self, args)
return self.command_table
def load_arguments(self, command):
from ._params import load_arguments
load_arguments(self, command)
COMMAND_LOADER_CLS = MixedRealityCommandsLoader

Просмотреть файл

@ -0,0 +1,14 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
def mixed_reality_client_factory(cli_ctx):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from azext_mixed_reality.vendored_sdks.mixedreality.mixed_reality_client import MixedRealityClient
return get_mgmt_service_client(cli_ctx, MixedRealityClient, subscription_bound=True)
def spatial_anchors_account_factory(cli_ctx, _):
return mixed_reality_client_factory(cli_ctx).spatial_anchors_accounts

Просмотреть файл

@ -0,0 +1,70 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
from knack.help_files import helps
helps['spatial-anchors-account'] = """
type: group
short-summary: Manage Spatial Anchors Accounts.
"""
helps['spatial-anchors-account list'] = """
type: command
short-summary: List Spatial Anchors Accounts.
examples:
- name: List all Spatial Anchors Accounts in Resource Group 'example'.
text: az spatial-anchors-account list -g example
- name: List all Spatial Anchors Accounts in current Subscription.
text: az spatial-anchors-account list
"""
helps['spatial-anchors-account create'] = """
type: command
short-summary: Create a Spatial Anchors Account.
examples:
- name: Create a Spatial Anchors Account.
text: az spatial-anchors-account create -g example -n example -l eastus2
- name: Create a Spatial Anchors Account without Location specified.
text: az spatial-anchors-account create -g example -n example
"""
helps['spatial-anchors-account show'] = """
type: command
short-summary: Show a Spatial Anchors Account.
examples:
- name: Show properties of a Spatial Anchors Account.
text: az spatial-anchors-account show -g example -n example
"""
helps['spatial-anchors-account delete'] = """
type: command
short-summary: Delete a Spatial Anchors Account.
examples:
- name: Delete of a Spatial Anchors Account.
text: az spatial-anchors-account delete -g example -n example
"""
helps['spatial-anchors-account key'] = """
type: group
short-summary: Manage developer keys of a Spatial Anchors Account.
"""
helps['spatial-anchors-account key show'] = """
type: command
short-summary: Show keys of a Spatial Anchors Account.
examples:
- name: Show primary key and secondary key of a Spatial Anchors Account.
text: az spatial-anchors-account key show -g example -n example
"""
helps['spatial-anchors-account key renew'] = """
type: command
short-summary: Renew one of the keys of a Spatial Anchors Account.
examples:
- name: Renew primary key of a Spatial Anchors Account.
text: az spatial-anchors-account key renew -g example -n example -k primary
- name: Renew secondary key of a Spatial Anchors Account.
text: az spatial-anchors-account key renew -g example -n example -k secondary
"""

Просмотреть файл

@ -0,0 +1,42 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
from knack.arguments import CLIArgumentType
from azure.cli.core.commands.validators import get_default_location_from_resource_group
from azure.cli.core.commands.parameters import (
resource_group_name_type,
get_resource_name_completion_list,
get_location_type,
get_enum_type,
tags_type,
name_type
)
spatial_anchors_account_name_type = CLIArgumentType(
help='Name of the Spatial Anchors Account',
arg_type=name_type,
id_part='name',
completer=get_resource_name_completion_list('Microsoft.MixedReality/spatialAnchorsAccounts')
)
spatial_anchors_account_key_type = CLIArgumentType(
help='Key to be regenerated.',
arg_type=get_enum_type(['primary', 'secondary']),
options_list=['--key', '-k'],
)
def load_arguments(self, _):
with self.argument_context('spatial-anchors-account') as c:
c.argument('resource_group_name', arg_type=resource_group_name_type)
c.argument('spatial_anchors_account_name', arg_type=spatial_anchors_account_name_type)
with self.argument_context('spatial-anchors-account create') as c:
c.argument('location', arg_type=get_location_type(self.cli_ctx), validator=get_default_location_from_resource_group) # pylint: disable=line-too-long
c.argument('tags', arg_type=tags_type)
with self.argument_context('spatial-anchors-account key renew') as c:
c.argument('key', arg_type=spatial_anchors_account_key_type)

Просмотреть файл

@ -0,0 +1,4 @@
{
"azext.minCliCoreVersion": "2.0.30",
"azext.isPreview": true
}

Просмотреть файл

@ -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.
# --------------------------------------------------------------------------------------------
from azure.cli.core.commands import CliCommandType
from azext_mixed_reality._client_factory import spatial_anchors_account_factory
def load_command_table(self, _):
command_type = CliCommandType(
operations_tmpl='azext_mixed_reality.vendored_sdks.mixedreality.operations.spatial_anchors_accounts_operations#SpatialAnchorsAccountsOperations.{}' # pylint: disable=line-too-long
)
with self.command_group('spatial-anchors-account', command_type, client_factory=spatial_anchors_account_factory) as g: # pylint: disable=line-too-long
g.custom_command('create', 'create_spatial_anchors_account')
g.show_command('show', 'get')
g.custom_command('list', 'list_spatial_anchors_accounts')
g.command('delete', 'delete')
with self.command_group('spatial-anchors-account key', command_type, client_factory=spatial_anchors_account_factory) as g: # pylint: disable=line-too-long
g.show_command('show', 'get_keys')
g.custom_command('renew', 'renew_key')

Просмотреть файл

@ -0,0 +1,32 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
def create_spatial_anchors_account(
client,
resource_group_name, spatial_anchors_account_name, location=None, tags=None,
custom_headers=None, raw=False, **operation_config):
return client.create(
resource_group_name, spatial_anchors_account_name, location, tags,
custom_headers, raw, **operation_config)
def list_spatial_anchors_accounts(
client,
resource_group_name=None,
custom_headers=None, raw=False, **operation_config):
if resource_group_name:
return client.list_by_resource_group(resource_group_name, custom_headers, raw, **operation_config)
return client.list_by_subscription(custom_headers, raw, **operation_config)
def renew_key(
client,
resource_group_name, spatial_anchors_account_name, key,
custom_headers=None, raw=False, **operation_config):
serial = ['primary', 'secondary'].index(key) + 1
return client.regenerate_keys(
resource_group_name, spatial_anchors_account_name, serial,
custom_headers, raw, **operation_config)

Просмотреть файл

@ -0,0 +1,4 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

Просмотреть файл

@ -0,0 +1,4 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

Просмотреть файл

@ -0,0 +1,59 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
from azure.cli.testsdk import (ScenarioTest, ResourceGroupPreparer)
from knack.util import CLIError
class SpatialAnchorsAccountScenarioTest(ScenarioTest):
@ResourceGroupPreparer(location='eastus2', parameter_name_for_location='location')
def test_spatial_anchors_account_scenario(self, resource_group, location):
self.kwargs.update({
'initial': 'az spatial-anchors-account',
'name': self.create_random_name(prefix='cli', length=24),
'location': location
})
# Create
self._assert_spatial_anchors_account_not_exist()
self._assert_spatial_anchors_account_as_expected('{initial} create -g {rg} -n {name} -l {location}')
# Read
self._assert_spatial_anchors_account_as_expected('{initial} show -g {rg} -n {name}')
# Primary Key
self._assert_spatial_anchors_account_keys_work('primary', 'secondary')
# Secondary Key
self._assert_spatial_anchors_account_keys_work('secondary', 'primary')
# Delete
self.cmd('{initial} delete -g {rg} -n {name}')
self._assert_spatial_anchors_account_not_exist()
def _assert_spatial_anchors_account_not_exist(self):
for item in self.cmd('{initial} list -g {rg}').get_output_in_json():
self.assertNotEqual(self.kwargs['name'], item['name'])
def _assert_spatial_anchors_account_as_expected(self, cmd):
self.cmd(cmd, checks=[
self.check('name', '{name}'),
self.check('location', '{location}'),
])
def _assert_spatial_anchors_account_keys_work(self, changed, unchanged):
old = self.cmd('{initial} key show -g {rg} -n {name}').get_output_in_json()
self.kwargs['key'] = changed
new = self.cmd('{initial} key renew -g {rg} -n {name} -k {key}').get_output_in_json()
key = unchanged + 'Key'
self.assertEqual(old[key], new[key])
key = changed + 'Key'
self.assertNotEqual(old[key], new[key])

Просмотреть файл

@ -0,0 +1,6 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
__path__ = __import__('pkgutil').extend_path(__path__, __name__)

Просмотреть файл

@ -0,0 +1,18 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
from .mixed_reality_client import MixedRealityClient
from .version import VERSION
__all__ = ['MixedRealityClient']
__version__ = VERSION

Просмотреть файл

@ -0,0 +1,158 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
from msrest.service_client import SDKClient
from msrest import Serializer, Deserializer
from msrestazure import AzureConfiguration
from .version import VERSION
from msrest.pipeline import ClientRawResponse
import uuid
from .operations.operations import Operations
from .operations.spatial_anchors_accounts_operations import SpatialAnchorsAccountsOperations
from . import models
class MixedRealityClientConfiguration(AzureConfiguration):
"""Configuration for MixedRealityClient
Note that all parameters used to create this instance are saved as instance
attributes.
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param subscription_id: Azure subscription ID.
:type subscription_id: str
:param str base_url: Service URL
"""
def __init__(
self, credentials, subscription_id, base_url=None):
if credentials is None:
raise ValueError("Parameter 'credentials' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
if not base_url:
base_url = 'https://management.azure.com'
super(MixedRealityClientConfiguration, self).__init__(base_url)
self.add_user_agent('azure-mgmt-mixedreality/{}'.format(VERSION))
self.add_user_agent('Azure-SDK-For-Python')
self.credentials = credentials
self.subscription_id = subscription_id
class MixedRealityClient(SDKClient):
"""Mixed Reality Client
:ivar config: Configuration for client.
:vartype config: MixedRealityClientConfiguration
:ivar operations: Operations operations
:vartype operations: azure.mgmt.mixedreality.operations.Operations
:ivar spatial_anchors_accounts: SpatialAnchorsAccounts operations
:vartype spatial_anchors_accounts: azure.mgmt.mixedreality.operations.SpatialAnchorsAccountsOperations
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param subscription_id: Azure subscription ID.
:type subscription_id: str
:param str base_url: Service URL
"""
def __init__(
self, credentials, subscription_id, base_url=None):
self.config = MixedRealityClientConfiguration(credentials, subscription_id, base_url)
super(MixedRealityClient, self).__init__(self.config.credentials, self.config)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '2019-02-28-preview'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self.operations = Operations(
self._client, self.config, self._serialize, self._deserialize)
self.spatial_anchors_accounts = SpatialAnchorsAccountsOperations(
self._client, self.config, self._serialize, self._deserialize)
def check_name_availability_local(
self, location, name, type, custom_headers=None, raw=False, **operation_config):
"""Check Name Availability for global uniqueness.
:param location: The location in which uniqueness will be verified.
:type location: str
:param name: Resource Name To Verify
:type name: str
:param type: Fully qualified resource type which includes provider
namespace
:type type: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: CheckNameAvailabilityResponse or ClientRawResponse if
raw=true
:rtype: ~azure.mgmt.mixedreality.models.CheckNameAvailabilityResponse
or ~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.mgmt.mixedreality.models.ErrorResponseException>`
"""
check_name_availability = models.CheckNameAvailabilityRequest(name=name, type=type)
# Construct URL
url = self.check_name_availability_local.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'location': self._serialize.url("location", location, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct body
body_content = self._serialize.body(check_name_availability, 'CheckNameAvailabilityRequest')
# Construct and send request
request = self._client.post(url, query_parameters, header_parameters, body_content)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ErrorResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('CheckNameAvailabilityResponse', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
check_name_availability_local.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/locations/{location}/checkNameAvailability'}

Просмотреть файл

@ -0,0 +1,62 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
try:
from .check_name_availability_request_py3 import CheckNameAvailabilityRequest
from .check_name_availability_response_py3 import CheckNameAvailabilityResponse
from .error_response_py3 import ErrorResponse, ErrorResponseException
from .operation_display_py3 import OperationDisplay
from .operation_py3 import Operation
from .spatial_anchors_account_py3 import SpatialAnchorsAccount
from .spatial_anchors_account_keys_py3 import SpatialAnchorsAccountKeys
from .spatial_anchors_account_key_regenerate_request_py3 import SpatialAnchorsAccountKeyRegenerateRequest
from .proxy_resource_py3 import ProxyResource
from .azure_entity_resource_py3 import AzureEntityResource
from .resource_py3 import Resource
from .tracked_resource_py3 import TrackedResource
except (SyntaxError, ImportError):
from .check_name_availability_request import CheckNameAvailabilityRequest
from .check_name_availability_response import CheckNameAvailabilityResponse
from .error_response import ErrorResponse, ErrorResponseException
from .operation_display import OperationDisplay
from .operation import Operation
from .spatial_anchors_account import SpatialAnchorsAccount
from .spatial_anchors_account_keys import SpatialAnchorsAccountKeys
from .spatial_anchors_account_key_regenerate_request import SpatialAnchorsAccountKeyRegenerateRequest
from .proxy_resource import ProxyResource
from .azure_entity_resource import AzureEntityResource
from .resource import Resource
from .tracked_resource import TrackedResource
from .operation_paged import OperationPaged
from .spatial_anchors_account_paged import SpatialAnchorsAccountPaged
from .mixed_reality_client_enums import (
NameAvailability,
NameUnavailableReason,
)
__all__ = [
'CheckNameAvailabilityRequest',
'CheckNameAvailabilityResponse',
'ErrorResponse', 'ErrorResponseException',
'OperationDisplay',
'Operation',
'SpatialAnchorsAccount',
'SpatialAnchorsAccountKeys',
'SpatialAnchorsAccountKeyRegenerateRequest',
'ProxyResource',
'AzureEntityResource',
'Resource',
'TrackedResource',
'OperationPaged',
'SpatialAnchorsAccountPaged',
'NameAvailability',
'NameUnavailableReason',
]

Просмотреть файл

@ -0,0 +1,50 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
from .resource import Resource
class AzureEntityResource(Resource):
"""The resource model definition for a Azure Resource Manager resource with an
etag.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar id: Fully qualified resource Id for the resource. Ex -
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
:vartype id: str
:ivar name: The name of the resource
:vartype name: str
:ivar type: The type of the resource. Ex-
Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
:vartype type: str
:ivar etag: Resource Etag.
:vartype etag: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'etag': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'etag': {'key': 'etag', 'type': 'str'},
}
def __init__(self, **kwargs):
super(AzureEntityResource, self).__init__(**kwargs)
self.etag = None

Просмотреть файл

@ -0,0 +1,50 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
from .resource_py3 import Resource
class AzureEntityResource(Resource):
"""The resource model definition for a Azure Resource Manager resource with an
etag.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar id: Fully qualified resource Id for the resource. Ex -
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
:vartype id: str
:ivar name: The name of the resource
:vartype name: str
:ivar type: The type of the resource. Ex-
Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
:vartype type: str
:ivar etag: Resource Etag.
:vartype etag: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'etag': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'etag': {'key': 'etag', 'type': 'str'},
}
def __init__(self, **kwargs) -> None:
super(AzureEntityResource, self).__init__(**kwargs)
self.etag = None

Просмотреть файл

@ -0,0 +1,40 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
from msrest.serialization import Model
class CheckNameAvailabilityRequest(Model):
"""Check Name Availability Request.
All required parameters must be populated in order to send to Azure.
:param name: Required. Resource Name To Verify
:type name: str
:param type: Required. Fully qualified resource type which includes
provider namespace
:type type: str
"""
_validation = {
'name': {'required': True},
'type': {'required': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
}
def __init__(self, **kwargs):
super(CheckNameAvailabilityRequest, self).__init__(**kwargs)
self.name = kwargs.get('name', None)
self.type = kwargs.get('type', None)

Просмотреть файл

@ -0,0 +1,40 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
from msrest.serialization import Model
class CheckNameAvailabilityRequest(Model):
"""Check Name Availability Request.
All required parameters must be populated in order to send to Azure.
:param name: Required. Resource Name To Verify
:type name: str
:param type: Required. Fully qualified resource type which includes
provider namespace
:type type: str
"""
_validation = {
'name': {'required': True},
'type': {'required': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
}
def __init__(self, *, name: str, type: str, **kwargs) -> None:
super(CheckNameAvailabilityRequest, self).__init__(**kwargs)
self.name = name
self.type = type

Просмотреть файл

@ -0,0 +1,45 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
from msrest.serialization import Model
class CheckNameAvailabilityResponse(Model):
"""Check Name Availability Response.
All required parameters must be populated in order to send to Azure.
:param name_available: Required. if name Available. Possible values
include: 'true', 'false'
:type name_available: str or
~azure.mgmt.mixedreality.models.NameAvailability
:param reason: Resource Name To Verify. Possible values include:
'Invalid', 'AlreadyExists'
:type reason: str or ~azure.mgmt.mixedreality.models.NameUnavailableReason
:param message: detail message
:type message: str
"""
_validation = {
'name_available': {'required': True},
}
_attribute_map = {
'name_available': {'key': 'nameAvailable', 'type': 'str'},
'reason': {'key': 'reason', 'type': 'str'},
'message': {'key': 'message', 'type': 'str'},
}
def __init__(self, **kwargs):
super(CheckNameAvailabilityResponse, self).__init__(**kwargs)
self.name_available = kwargs.get('name_available', None)
self.reason = kwargs.get('reason', None)
self.message = kwargs.get('message', None)

Просмотреть файл

@ -0,0 +1,45 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
from msrest.serialization import Model
class CheckNameAvailabilityResponse(Model):
"""Check Name Availability Response.
All required parameters must be populated in order to send to Azure.
:param name_available: Required. if name Available. Possible values
include: 'true', 'false'
:type name_available: str or
~azure.mgmt.mixedreality.models.NameAvailability
:param reason: Resource Name To Verify. Possible values include:
'Invalid', 'AlreadyExists'
:type reason: str or ~azure.mgmt.mixedreality.models.NameUnavailableReason
:param message: detail message
:type message: str
"""
_validation = {
'name_available': {'required': True},
}
_attribute_map = {
'name_available': {'key': 'nameAvailable', 'type': 'str'},
'reason': {'key': 'reason', 'type': 'str'},
'message': {'key': 'message', 'type': 'str'},
}
def __init__(self, *, name_available, reason=None, message: str=None, **kwargs) -> None:
super(CheckNameAvailabilityResponse, self).__init__(**kwargs)
self.name_available = name_available
self.reason = reason
self.message = message

Просмотреть файл

@ -0,0 +1,65 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
from msrest.serialization import Model
from msrest.exceptions import HttpOperationError
class ErrorResponse(Model):
"""Response on Error.
All required parameters must be populated in order to send to Azure.
:param message: Required. Describes the error in detail and provides
debugging information
:type message: str
:param code: Required. String that can be used to programmatically
identify the error.
:type code: str
:param target: The target of the particular error
:type target: str
:param details: An array of JSON objects that MUST contain name/value
pairs for code and message, and MAY contain a name/value pair for target,
as described above.The contents of this section are service-defined but
must adhere to the aforementioned schema.
:type details: str
"""
_validation = {
'message': {'required': True},
'code': {'required': True},
}
_attribute_map = {
'message': {'key': 'message', 'type': 'str'},
'code': {'key': 'code', 'type': 'str'},
'target': {'key': 'target', 'type': 'str'},
'details': {'key': 'details', 'type': 'str'},
}
def __init__(self, **kwargs):
super(ErrorResponse, self).__init__(**kwargs)
self.message = kwargs.get('message', None)
self.code = kwargs.get('code', None)
self.target = kwargs.get('target', None)
self.details = kwargs.get('details', None)
class ErrorResponseException(HttpOperationError):
"""Server responsed with exception of type: 'ErrorResponse'.
:param deserialize: A deserializer
:param response: Server response to be deserialized.
"""
def __init__(self, deserialize, response, *args):
super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args)

Просмотреть файл

@ -0,0 +1,65 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
from msrest.serialization import Model
from msrest.exceptions import HttpOperationError
class ErrorResponse(Model):
"""Response on Error.
All required parameters must be populated in order to send to Azure.
:param message: Required. Describes the error in detail and provides
debugging information
:type message: str
:param code: Required. String that can be used to programmatically
identify the error.
:type code: str
:param target: The target of the particular error
:type target: str
:param details: An array of JSON objects that MUST contain name/value
pairs for code and message, and MAY contain a name/value pair for target,
as described above.The contents of this section are service-defined but
must adhere to the aforementioned schema.
:type details: str
"""
_validation = {
'message': {'required': True},
'code': {'required': True},
}
_attribute_map = {
'message': {'key': 'message', 'type': 'str'},
'code': {'key': 'code', 'type': 'str'},
'target': {'key': 'target', 'type': 'str'},
'details': {'key': 'details', 'type': 'str'},
}
def __init__(self, *, message: str, code: str, target: str=None, details: str=None, **kwargs) -> None:
super(ErrorResponse, self).__init__(**kwargs)
self.message = message
self.code = code
self.target = target
self.details = details
class ErrorResponseException(HttpOperationError):
"""Server responsed with exception of type: 'ErrorResponse'.
:param deserialize: A deserializer
:param response: Server response to be deserialized.
"""
def __init__(self, deserialize, response, *args):
super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args)

Просмотреть файл

@ -0,0 +1,24 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
from enum import Enum
class NameAvailability(str, Enum):
true = "true"
false = "false"
class NameUnavailableReason(str, Enum):
invalid = "Invalid"
already_exists = "AlreadyExists"

Просмотреть файл

@ -0,0 +1,32 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
from msrest.serialization import Model
class Operation(Model):
"""REST API operation.
:param name: Operation name: {provider}/{resource}/{operation}
:type name: str
:param display: The object that represents the operation.
:type display: ~azure.mgmt.mixedreality.models.OperationDisplay
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'display': {'key': 'display', 'type': 'OperationDisplay'},
}
def __init__(self, **kwargs):
super(Operation, self).__init__(**kwargs)
self.name = kwargs.get('name', None)
self.display = kwargs.get('display', None)

Просмотреть файл

@ -0,0 +1,50 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
from msrest.serialization import Model
class OperationDisplay(Model):
"""The object that represents the operation.
All required parameters must be populated in order to send to Azure.
:param provider: Required. Service provider: Microsoft.ResourceProvider
:type provider: str
:param resource: Required. Resource on which the operation is performed:
Profile, endpoint, etc.
:type resource: str
:param operation: Required. Operation type: Read, write, delete, etc.
:type operation: str
:param description: Required. Description of operation
:type description: str
"""
_validation = {
'provider': {'required': True},
'resource': {'required': True},
'operation': {'required': True},
'description': {'required': True},
}
_attribute_map = {
'provider': {'key': 'provider', 'type': 'str'},
'resource': {'key': 'resource', 'type': 'str'},
'operation': {'key': 'operation', 'type': 'str'},
'description': {'key': 'description', 'type': 'str'},
}
def __init__(self, **kwargs):
super(OperationDisplay, self).__init__(**kwargs)
self.provider = kwargs.get('provider', None)
self.resource = kwargs.get('resource', None)
self.operation = kwargs.get('operation', None)
self.description = kwargs.get('description', None)

Просмотреть файл

@ -0,0 +1,50 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
from msrest.serialization import Model
class OperationDisplay(Model):
"""The object that represents the operation.
All required parameters must be populated in order to send to Azure.
:param provider: Required. Service provider: Microsoft.ResourceProvider
:type provider: str
:param resource: Required. Resource on which the operation is performed:
Profile, endpoint, etc.
:type resource: str
:param operation: Required. Operation type: Read, write, delete, etc.
:type operation: str
:param description: Required. Description of operation
:type description: str
"""
_validation = {
'provider': {'required': True},
'resource': {'required': True},
'operation': {'required': True},
'description': {'required': True},
}
_attribute_map = {
'provider': {'key': 'provider', 'type': 'str'},
'resource': {'key': 'resource', 'type': 'str'},
'operation': {'key': 'operation', 'type': 'str'},
'description': {'key': 'description', 'type': 'str'},
}
def __init__(self, *, provider: str, resource: str, operation: str, description: str, **kwargs) -> None:
super(OperationDisplay, self).__init__(**kwargs)
self.provider = provider
self.resource = resource
self.operation = operation
self.description = description

Просмотреть файл

@ -0,0 +1,27 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
from msrest.paging import Paged
class OperationPaged(Paged):
"""
A paging container for iterating over a list of :class:`Operation <azure.mgmt.mixedreality.models.Operation>` object
"""
_attribute_map = {
'next_link': {'key': 'nextLink', 'type': 'str'},
'current_page': {'key': 'value', 'type': '[Operation]'}
}
def __init__(self, *args, **kwargs):
super(OperationPaged, self).__init__(*args, **kwargs)

Просмотреть файл

@ -0,0 +1,32 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
from msrest.serialization import Model
class Operation(Model):
"""REST API operation.
:param name: Operation name: {provider}/{resource}/{operation}
:type name: str
:param display: The object that represents the operation.
:type display: ~azure.mgmt.mixedreality.models.OperationDisplay
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'display': {'key': 'display', 'type': 'OperationDisplay'},
}
def __init__(self, *, name: str=None, display=None, **kwargs) -> None:
super(Operation, self).__init__(**kwargs)
self.name = name
self.display = display

Просмотреть файл

@ -0,0 +1,45 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
from .resource import Resource
class ProxyResource(Resource):
"""The resource model definition for a ARM proxy resource. It will have
everything other than required location and tags.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar id: Fully qualified resource Id for the resource. Ex -
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
:vartype id: str
:ivar name: The name of the resource
:vartype name: str
:ivar type: The type of the resource. Ex-
Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
:vartype type: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
}
def __init__(self, **kwargs):
super(ProxyResource, self).__init__(**kwargs)

Просмотреть файл

@ -0,0 +1,45 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
from .resource_py3 import Resource
class ProxyResource(Resource):
"""The resource model definition for a ARM proxy resource. It will have
everything other than required location and tags.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar id: Fully qualified resource Id for the resource. Ex -
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
:vartype id: str
:ivar name: The name of the resource
:vartype name: str
:ivar type: The type of the resource. Ex-
Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
:vartype type: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
}
def __init__(self, **kwargs) -> None:
super(ProxyResource, self).__init__(**kwargs)

Просмотреть файл

@ -0,0 +1,47 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
from msrest.serialization import Model
class Resource(Model):
"""Resource.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar id: Fully qualified resource Id for the resource. Ex -
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
:vartype id: str
:ivar name: The name of the resource
:vartype name: str
:ivar type: The type of the resource. Ex-
Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
:vartype type: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
}
def __init__(self, **kwargs):
super(Resource, self).__init__(**kwargs)
self.id = None
self.name = None
self.type = None

Просмотреть файл

@ -0,0 +1,47 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
from msrest.serialization import Model
class Resource(Model):
"""Resource.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar id: Fully qualified resource Id for the resource. Ex -
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
:vartype id: str
:ivar name: The name of the resource
:vartype name: str
:ivar type: The type of the resource. Ex-
Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
:vartype type: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
}
def __init__(self, **kwargs) -> None:
super(Resource, self).__init__(**kwargs)
self.id = None
self.name = None
self.type = None

Просмотреть файл

@ -0,0 +1,65 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
from .tracked_resource import TrackedResource
class SpatialAnchorsAccount(TrackedResource):
"""SpatialAnchorsAccount Response.
Variables are only populated by the server, and will be ignored when
sending a request.
All required parameters must be populated in order to send to Azure.
:ivar id: Fully qualified resource Id for the resource. Ex -
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
:vartype id: str
:ivar name: The name of the resource
:vartype name: str
:ivar type: The type of the resource. Ex-
Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
:vartype type: str
:param tags: Resource tags.
:type tags: dict[str, str]
:param location: Required. The geo-location where the resource lives
:type location: str
:ivar account_id: unique id of certain Spatial Anchors Account data
contract.
:vartype account_id: str
:ivar account_domain: Correspond domain name of certain Spatial Anchors
Account
:vartype account_domain: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'location': {'required': True},
'account_id': {'readonly': True},
'account_domain': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'location': {'key': 'location', 'type': 'str'},
'account_id': {'key': 'properties.accountId', 'type': 'str'},
'account_domain': {'key': 'properties.accountDomain', 'type': 'str'},
}
def __init__(self, **kwargs):
super(SpatialAnchorsAccount, self).__init__(**kwargs)
self.account_id = None
self.account_domain = None

Просмотреть файл

@ -0,0 +1,28 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
from msrest.serialization import Model
class SpatialAnchorsAccountKeyRegenerateRequest(Model):
"""Spatial Anchors Account Regenerate Key.
:param serial: serial of key to be regenerated. Default value: 1 .
:type serial: int
"""
_attribute_map = {
'serial': {'key': 'serial', 'type': 'int'},
}
def __init__(self, **kwargs):
super(SpatialAnchorsAccountKeyRegenerateRequest, self).__init__(**kwargs)
self.serial = kwargs.get('serial', 1)

Просмотреть файл

@ -0,0 +1,28 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
from msrest.serialization import Model
class SpatialAnchorsAccountKeyRegenerateRequest(Model):
"""Spatial Anchors Account Regenerate Key.
:param serial: serial of key to be regenerated. Default value: 1 .
:type serial: int
"""
_attribute_map = {
'serial': {'key': 'serial', 'type': 'int'},
}
def __init__(self, *, serial: int=1, **kwargs) -> None:
super(SpatialAnchorsAccountKeyRegenerateRequest, self).__init__(**kwargs)
self.serial = serial

Просмотреть файл

@ -0,0 +1,40 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
from msrest.serialization import Model
class SpatialAnchorsAccountKeys(Model):
"""Spatial Anchors Account Keys.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar primary_key: value of primary key.
:vartype primary_key: str
:ivar secondary_key: value of secondary key.
:vartype secondary_key: str
"""
_validation = {
'primary_key': {'readonly': True},
'secondary_key': {'readonly': True},
}
_attribute_map = {
'primary_key': {'key': 'primaryKey', 'type': 'str'},
'secondary_key': {'key': 'secondaryKey', 'type': 'str'},
}
def __init__(self, **kwargs):
super(SpatialAnchorsAccountKeys, self).__init__(**kwargs)
self.primary_key = None
self.secondary_key = None

Просмотреть файл

@ -0,0 +1,40 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
from msrest.serialization import Model
class SpatialAnchorsAccountKeys(Model):
"""Spatial Anchors Account Keys.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar primary_key: value of primary key.
:vartype primary_key: str
:ivar secondary_key: value of secondary key.
:vartype secondary_key: str
"""
_validation = {
'primary_key': {'readonly': True},
'secondary_key': {'readonly': True},
}
_attribute_map = {
'primary_key': {'key': 'primaryKey', 'type': 'str'},
'secondary_key': {'key': 'secondaryKey', 'type': 'str'},
}
def __init__(self, **kwargs) -> None:
super(SpatialAnchorsAccountKeys, self).__init__(**kwargs)
self.primary_key = None
self.secondary_key = None

Просмотреть файл

@ -0,0 +1,27 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
from msrest.paging import Paged
class SpatialAnchorsAccountPaged(Paged):
"""
A paging container for iterating over a list of :class:`SpatialAnchorsAccount <azure.mgmt.mixedreality.models.SpatialAnchorsAccount>` object
"""
_attribute_map = {
'next_link': {'key': 'nextLink', 'type': 'str'},
'current_page': {'key': 'value', 'type': '[SpatialAnchorsAccount]'}
}
def __init__(self, *args, **kwargs):
super(SpatialAnchorsAccountPaged, self).__init__(*args, **kwargs)

Просмотреть файл

@ -0,0 +1,65 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
from .tracked_resource_py3 import TrackedResource
class SpatialAnchorsAccount(TrackedResource):
"""SpatialAnchorsAccount Response.
Variables are only populated by the server, and will be ignored when
sending a request.
All required parameters must be populated in order to send to Azure.
:ivar id: Fully qualified resource Id for the resource. Ex -
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
:vartype id: str
:ivar name: The name of the resource
:vartype name: str
:ivar type: The type of the resource. Ex-
Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
:vartype type: str
:param tags: Resource tags.
:type tags: dict[str, str]
:param location: Required. The geo-location where the resource lives
:type location: str
:ivar account_id: unique id of certain Spatial Anchors Account data
contract.
:vartype account_id: str
:ivar account_domain: Correspond domain name of certain Spatial Anchors
Account
:vartype account_domain: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'location': {'required': True},
'account_id': {'readonly': True},
'account_domain': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'location': {'key': 'location', 'type': 'str'},
'account_id': {'key': 'properties.accountId', 'type': 'str'},
'account_domain': {'key': 'properties.accountDomain', 'type': 'str'},
}
def __init__(self, *, location: str, tags=None, **kwargs) -> None:
super(SpatialAnchorsAccount, self).__init__(tags=tags, location=location, **kwargs)
self.account_id = None
self.account_domain = None

Просмотреть файл

@ -0,0 +1,55 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
from .resource import Resource
class TrackedResource(Resource):
"""The resource model definition for a ARM tracked top level resource.
Variables are only populated by the server, and will be ignored when
sending a request.
All required parameters must be populated in order to send to Azure.
:ivar id: Fully qualified resource Id for the resource. Ex -
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
:vartype id: str
:ivar name: The name of the resource
:vartype name: str
:ivar type: The type of the resource. Ex-
Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
:vartype type: str
:param tags: Resource tags.
:type tags: dict[str, str]
:param location: Required. The geo-location where the resource lives
:type location: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'location': {'required': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'location': {'key': 'location', 'type': 'str'},
}
def __init__(self, **kwargs):
super(TrackedResource, self).__init__(**kwargs)
self.tags = kwargs.get('tags', None)
self.location = kwargs.get('location', None)

Просмотреть файл

@ -0,0 +1,55 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
from .resource_py3 import Resource
class TrackedResource(Resource):
"""The resource model definition for a ARM tracked top level resource.
Variables are only populated by the server, and will be ignored when
sending a request.
All required parameters must be populated in order to send to Azure.
:ivar id: Fully qualified resource Id for the resource. Ex -
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
:vartype id: str
:ivar name: The name of the resource
:vartype name: str
:ivar type: The type of the resource. Ex-
Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
:vartype type: str
:param tags: Resource tags.
:type tags: dict[str, str]
:param location: Required. The geo-location where the resource lives
:type location: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'location': {'required': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'location': {'key': 'location', 'type': 'str'},
}
def __init__(self, *, location: str, tags=None, **kwargs) -> None:
super(TrackedResource, self).__init__(**kwargs)
self.tags = tags
self.location = location

Просмотреть файл

@ -0,0 +1,18 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
from .operations import Operations
from .spatial_anchors_accounts_operations import SpatialAnchorsAccountsOperations
__all__ = [
'Operations',
'SpatialAnchorsAccountsOperations',
]

Просмотреть файл

@ -0,0 +1,96 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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 uuid
from msrest.pipeline import ClientRawResponse
from .. import models
class Operations(object):
"""Operations operations.
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
:ivar api_version: Version of the API to be used with the client request. Constant value: "2019-02-28-preview".
"""
models = models
def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.api_version = "2019-02-28-preview"
self.config = config
def list(
self, custom_headers=None, raw=False, **operation_config):
"""Exposing Available Operations.
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: An iterator like instance of Operation
:rtype:
~azure.mgmt.mixedreality.models.OperationPaged[~azure.mgmt.mixedreality.models.Operation]
:raises:
:class:`ErrorResponseException<azure.mgmt.mixedreality.models.ErrorResponseException>`
"""
def internal_paging(next_link=None, raw=False):
if not next_link:
# Construct URL
url = self.list.metadata['url']
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
else:
url = next_link
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ErrorResponseException(self._deserialize, response)
return response
# Deserialize response
deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies)
if raw:
header_dict = {}
client_raw_response = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict)
return client_raw_response
return deserialized
list.metadata = {'url': '/providers/Microsoft.MixedReality/operations'}

Просмотреть файл

@ -0,0 +1,559 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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 uuid
from msrest.pipeline import ClientRawResponse
from .. import models
class SpatialAnchorsAccountsOperations(object):
"""SpatialAnchorsAccountsOperations operations.
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
:ivar api_version: Version of the API to be used with the client request. Constant value: "2019-02-28-preview".
"""
models = models
def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.api_version = "2019-02-28-preview"
self.config = config
def list_by_subscription(
self, custom_headers=None, raw=False, **operation_config):
"""List Spatial Anchors Accounts by Subscription.
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: An iterator like instance of SpatialAnchorsAccount
:rtype:
~azure.mgmt.mixedreality.models.SpatialAnchorsAccountPaged[~azure.mgmt.mixedreality.models.SpatialAnchorsAccount]
:raises:
:class:`ErrorResponseException<azure.mgmt.mixedreality.models.ErrorResponseException>`
"""
def internal_paging(next_link=None, raw=False):
if not next_link:
# Construct URL
url = self.list_by_subscription.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
else:
url = next_link
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ErrorResponseException(self._deserialize, response)
return response
# Deserialize response
deserialized = models.SpatialAnchorsAccountPaged(internal_paging, self._deserialize.dependencies)
if raw:
header_dict = {}
client_raw_response = models.SpatialAnchorsAccountPaged(internal_paging, self._deserialize.dependencies, header_dict)
return client_raw_response
return deserialized
list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/spatialAnchorsAccounts'}
def list_by_resource_group(
self, resource_group_name, custom_headers=None, raw=False, **operation_config):
"""List Resources by Resource Group.
:param resource_group_name: Name of an Azure resource group.
:type resource_group_name: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: An iterator like instance of SpatialAnchorsAccount
:rtype:
~azure.mgmt.mixedreality.models.SpatialAnchorsAccountPaged[~azure.mgmt.mixedreality.models.SpatialAnchorsAccount]
:raises:
:class:`ErrorResponseException<azure.mgmt.mixedreality.models.ErrorResponseException>`
"""
def internal_paging(next_link=None, raw=False):
if not next_link:
# Construct URL
url = self.list_by_resource_group.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
else:
url = next_link
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ErrorResponseException(self._deserialize, response)
return response
# Deserialize response
deserialized = models.SpatialAnchorsAccountPaged(internal_paging, self._deserialize.dependencies)
if raw:
header_dict = {}
client_raw_response = models.SpatialAnchorsAccountPaged(internal_paging, self._deserialize.dependencies, header_dict)
return client_raw_response
return deserialized
list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts'}
def delete(
self, resource_group_name, spatial_anchors_account_name, custom_headers=None, raw=False, **operation_config):
"""Delete a Spatial Anchors Account.
:param resource_group_name: Name of an Azure resource group.
:type resource_group_name: str
:param spatial_anchors_account_name: Name of an Mixed Reality Spatial
Anchors Account.
:type spatial_anchors_account_name: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: None or ClientRawResponse if raw=true
:rtype: None or ~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.mgmt.mixedreality.models.ErrorResponseException>`
"""
# Construct URL
url = self.delete.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'spatialAnchorsAccountName': self._serialize.url("spatial_anchors_account_name", spatial_anchors_account_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.delete(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200, 204]:
raise models.ErrorResponseException(self._deserialize, response)
if raw:
client_raw_response = ClientRawResponse(None, response)
return client_raw_response
delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{spatialAnchorsAccountName}'}
def get(
self, resource_group_name, spatial_anchors_account_name, custom_headers=None, raw=False, **operation_config):
"""Retrieve a Spatial Anchors Account.
:param resource_group_name: Name of an Azure resource group.
:type resource_group_name: str
:param spatial_anchors_account_name: Name of an Mixed Reality Spatial
Anchors Account.
:type spatial_anchors_account_name: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: SpatialAnchorsAccount or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.mixedreality.models.SpatialAnchorsAccount or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.mgmt.mixedreality.models.ErrorResponseException>`
"""
# Construct URL
url = self.get.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'spatialAnchorsAccountName': self._serialize.url("spatial_anchors_account_name", spatial_anchors_account_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ErrorResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('SpatialAnchorsAccount', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{spatialAnchorsAccountName}'}
def update(
self, resource_group_name, spatial_anchors_account_name, location, tags=None, custom_headers=None, raw=False, **operation_config):
"""Updating a Spatial Anchors Account.
:param resource_group_name: Name of an Azure resource group.
:type resource_group_name: str
:param spatial_anchors_account_name: Name of an Mixed Reality Spatial
Anchors Account.
:type spatial_anchors_account_name: str
:param location: The geo-location where the resource lives
:type location: str
:param tags: Resource tags.
:type tags: dict[str, str]
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: SpatialAnchorsAccount or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.mixedreality.models.SpatialAnchorsAccount or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.mgmt.mixedreality.models.ErrorResponseException>`
"""
spatial_anchors_account = models.SpatialAnchorsAccount(tags=tags, location=location)
# Construct URL
url = self.update.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'spatialAnchorsAccountName': self._serialize.url("spatial_anchors_account_name", spatial_anchors_account_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct body
body_content = self._serialize.body(spatial_anchors_account, 'SpatialAnchorsAccount')
# Construct and send request
request = self._client.patch(url, query_parameters, header_parameters, body_content)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ErrorResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('SpatialAnchorsAccount', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{spatialAnchorsAccountName}'}
def create(
self, resource_group_name, spatial_anchors_account_name, location, tags=None, custom_headers=None, raw=False, **operation_config):
"""Creating or Updating a Spatial Anchors Account.
:param resource_group_name: Name of an Azure resource group.
:type resource_group_name: str
:param spatial_anchors_account_name: Name of an Mixed Reality Spatial
Anchors Account.
:type spatial_anchors_account_name: str
:param location: The geo-location where the resource lives
:type location: str
:param tags: Resource tags.
:type tags: dict[str, str]
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: SpatialAnchorsAccount or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.mixedreality.models.SpatialAnchorsAccount or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.mgmt.mixedreality.models.ErrorResponseException>`
"""
spatial_anchors_account = models.SpatialAnchorsAccount(tags=tags, location=location)
# Construct URL
url = self.create.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'spatialAnchorsAccountName': self._serialize.url("spatial_anchors_account_name", spatial_anchors_account_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct body
body_content = self._serialize.body(spatial_anchors_account, 'SpatialAnchorsAccount')
# Construct and send request
request = self._client.put(url, query_parameters, header_parameters, body_content)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200, 201]:
raise models.ErrorResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('SpatialAnchorsAccount', response)
if response.status_code == 201:
deserialized = self._deserialize('SpatialAnchorsAccount', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{spatialAnchorsAccountName}'}
def get_keys(
self, resource_group_name, spatial_anchors_account_name, custom_headers=None, raw=False, **operation_config):
"""Get Both of the 2 Keys of a Spatial Anchors Account.
:param resource_group_name: Name of an Azure resource group.
:type resource_group_name: str
:param spatial_anchors_account_name: Name of an Mixed Reality Spatial
Anchors Account.
:type spatial_anchors_account_name: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: SpatialAnchorsAccountKeys or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.mixedreality.models.SpatialAnchorsAccountKeys or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.mgmt.mixedreality.models.ErrorResponseException>`
"""
# Construct URL
url = self.get_keys.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'spatialAnchorsAccountName': self._serialize.url("spatial_anchors_account_name", spatial_anchors_account_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ErrorResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('SpatialAnchorsAccountKeys', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
get_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{spatialAnchorsAccountName}/keys'}
def regenerate_keys(
self, resource_group_name, spatial_anchors_account_name, serial=1, custom_headers=None, raw=False, **operation_config):
"""Regenerate 1 Key of a Spatial Anchors Account.
:param resource_group_name: Name of an Azure resource group.
:type resource_group_name: str
:param spatial_anchors_account_name: Name of an Mixed Reality Spatial
Anchors Account.
:type spatial_anchors_account_name: str
:param serial: serial of key to be regenerated
:type serial: int
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: SpatialAnchorsAccountKeys or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.mixedreality.models.SpatialAnchorsAccountKeys or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.mgmt.mixedreality.models.ErrorResponseException>`
"""
spatial_anchors_account_key_regenerate = models.SpatialAnchorsAccountKeyRegenerateRequest(serial=serial)
# Construct URL
url = self.regenerate_keys.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'spatialAnchorsAccountName': self._serialize.url("spatial_anchors_account_name", spatial_anchors_account_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct body
body_content = self._serialize.body(spatial_anchors_account_key_regenerate, 'SpatialAnchorsAccountKeyRegenerateRequest')
# Construct and send request
request = self._client.post(url, query_parameters, header_parameters, body_content)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ErrorResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('SpatialAnchorsAccountKeys', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{spatialAnchorsAccountName}/keys'}

Просмотреть файл

@ -0,0 +1,13 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
VERSION = "0.1.0"

Просмотреть файл

@ -0,0 +1,2 @@
[bdist_wheel]
universal=1

Просмотреть файл

@ -0,0 +1,46 @@
#!/usr/bin/env python
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
from codecs import open
from setuptools import setup, find_packages
VERSION = "0.0.2"
CLASSIFIERS = [
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'License :: OSI Approved :: MIT License',
]
DEPENDENCIES = []
setup(
name='mixed-reality',
version=VERSION,
description='Mixed Reality Azure CLI Extension.',
long_description='Azure CLI Extension of Mixed Reality Azure Resource Management',
license='MIT',
author='Xiangyu Luo',
author_email='xiangyul@microsoft.com',
url='https://github.com/Azure/azure-cli-extensions',
classifiers=CLASSIFIERS,
packages=find_packages(exclude=["tests"]),
install_requires=DEPENDENCIES,
package_data={
'azext_mixed_reality': [
'azext_metadata.json'
]
}
)

Просмотреть файл

@ -0,0 +1,36 @@
## Azure CLI
These settings apply only when `--az` is specified on the command line.
``` yaml $(az)
az:
extensions: mixed-reality
package-name: azure-mgmt-mixedreality
namespace: azure.mgmt.mixedreality
az-output-folder: $(azure-cli-extension-folder)/src/mixed-reality
python-sdk-output-folder: "$(az-output-folder)/azext_mixed_reality/vendored_sdks/mixedreality"
directive:
- where:
group: mixed-reality spatial-anchor-account
set:
group: spatial-anchors-account
- where:
group: mixed-reality remote-rendering-account
set:
group: remote-rendering-account
cli:
cli-directive:
- where:
group: "*"
op: "*"
hidden: true
- where:
group: RemoteRenderingAccounts
op: "*"
hidden: false
- where:
group: SpatialAnchorsAccounts
op: RegenerateKeys
hidden: false

Просмотреть файл

@ -0,0 +1,34 @@
## CLI
These settings apply only when `--cli` is specified on the command line.
``` yaml $(cli)
cli:
cli-name: mixedreality
package-name: azure-mgmt-mixedreality
namespace: azure.mgmt.mixedreality
test-scenario:
- name: Create spatial anchor account
- name: Create remote rendering account
- name: Get remote rendering account key
- name: Get spatial anchor account key
- name: List spatial anchor accounts by resource group
- name: List remote rendering accounts by resource group
- name: Get spatial anchors account
- name: Get remote rendering account
- name: List remote rendering accounts by subscription
- name: List spatial anchors accounts by subscription
- name: List available operations
disabled: true
- name: Regenerate remote rendering account keys
- name: Regenerate spatial anchors account keys
- name: Update remote rendering account
disabled: true
- name: Update spatial anchors account
disabled: true
- name: CheckLocalNameAvailability
disabled: true
- name: Delete spatial anchors account
- name: Delete remote rendering account
```

Просмотреть файл

@ -0,0 +1,60 @@
# Mixed-Reality
> see https://aka.ms/autorest
This is the AutoRest configuration file for Mixed-Reality Azure Resource Management.
---
## Getting Started
To build the SDK for Azure Resource Management, simply [Install AutoRest](https://aka.ms/autorest/install) and in this folder, run:
> `autorest`
To see additional help and options, run:
> `autorest --help`
---
---
## Configuration
### Basic Information
These are the global settings for the Mixed Reality Azure Resource Management Client.
``` yaml
title: MixedRealityClient
description: Mixed Reality Client
openapi-type: arm
tag: package-2020-05
```
### Tag: package-2020-05
These settings apply only when `--tag=package-2020-05` is specified on the command line.
``` yaml $(tag) == 'package-2020-05'
input-file:
- ../input/stable/2020-05-01/proxy.json
- ../input/stable/2020-05-01/spatial-anchors.json
- ../input/preview/2020-04-06-preview/remote-rendering.json
```
---
# Code Generation
## Swagger to SDK
This section describes what SDK should be generated by the automatic system.
This is not used by Autorest itself.
``` yaml $(swagger-to-sdk)
swagger-to-sdk:
- repo: azure-sdk-for-python
```
## Python
See configuration in [readme.python.md](./readme.python.md)
## CLI
See configuration in [readme.cli.md](./readme.cli.md)

Просмотреть файл

@ -0,0 +1,29 @@
## Python
These settings apply only when `--python` is specified on the command line.
Please also specify `--python-sdks-folder=<path to the root directory of your azure-sdk-for-python clone>`.
Use `--python-mode=update` if you already have a setup.py and just want to update the code itself.
``` yaml $(python)
python-mode: create
python:
azure-arm: true
license-header: MICROSOFT_MIT_NO_VERSION
payload-flattening-threshold: 2
namespace: azure.mgmt.mixedreality
package-name: azure-mgmt-mixedreality
package-version: 0.1.0
clear-output-folder: true
```
``` yaml $(python) && $(python-mode) == 'update'
python:
no-namespace-folders: true
output-folder: $(python-sdks-folder)/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality
```
``` yaml $(python) && $(python-mode) == 'create'
python:
basic-setup-py: true
output-folder: $(python-sdks-folder)/mixedreality/azure-mgmt-mixedreality
```

Просмотреть файл

@ -0,0 +1,166 @@
{
"swagger": "2.0",
"info": {
"title": "Mixed Reality",
"description": "Mixed Reality Resource Provider API",
"version": "2020-04-06-preview"
},
"paths": {},
"definitions": {
"AccountKeys": {
"description": "Developer Keys of account",
"type": "object",
"properties": {
"primaryKey": {
"description": "value of primary key.",
"readOnly": true,
"type": "string"
},
"secondaryKey": {
"description": "value of secondary key.",
"readOnly": true,
"type": "string"
}
}
},
"AccountKeyRegenerateRequest": {
"description": "Request for account key regeneration",
"type": "object",
"properties": {
"serial": {
"type": "integer",
"enum": [
1,
2
],
"default": 1,
"x-ms-enum": {
"name": "Serial",
"values": [
{
"value": 1,
"description": "The Primary Key",
"name": "Primary"
},
{
"value": 2,
"description": "The Secondary Key",
"name": "Secondary"
}
]
},
"description": "serial of key to be regenerated"
}
}
},
"CloudError": {
"x-ms-external": true,
"properties": {
"error": {
"$ref": "#/definitions/CloudErrorBody"
}
},
"description": "An Error response."
},
"CloudErrorBody": {
"x-ms-external": true,
"properties": {
"code": {
"type": "string",
"description": "An identifier for the error. Codes are invariant and are intended to be consumed programmatically."
},
"message": {
"type": "string",
"description": "A message describing the error, intended to be suitable for displaying in a user interface."
},
"target": {
"type": "string",
"description": "The target of the particular error. For example, the name of the property in error."
},
"details": {
"type": "array",
"items": {
"$ref": "#/definitions/CloudErrorBody"
},
"description": "A list of additional details about the error."
}
},
"description": "An error response from Azure."
},
"MixedRealityAccountProperties": {
"description": "Common Properties shared by Mixed Reality Accounts",
"type": "object",
"properties": {
"accountId": {
"description": "unique id of certain account.",
"readOnly": true,
"type": "string"
},
"accountDomain": {
"description": "Correspond domain name of certain Spatial Anchors Account",
"readOnly": true,
"type": "string"
}
}
}
},
"parameters": {
"accountKeyRegenerateParameter": {
"name": "regenerate",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/AccountKeyRegenerateRequest"
},
"x-ms-parameter-location": "method",
"description": "Required information for key regeneration."
},
"accountNameParameter": {
"name": "accountName",
"in": "path",
"required": true,
"type": "string",
"pattern": "^[-\\w\\._\\(\\)]+$",
"minLength": 1,
"maxLength": 90,
"x-ms-parameter-location": "method",
"description": "Name of an Mixed Reality Account."
},
"apiVersionParameter": {
"name": "api-version",
"description": "The API version to be used with the HTTP request.",
"in": "query",
"required": true,
"type": "string"
},
"locationParameter": {
"name": "location",
"in": "path",
"required": true,
"type": "string",
"pattern": "^[-\\w\\._\\(\\)]+$",
"minLength": 1,
"maxLength": 90,
"x-ms-parameter-location": "method",
"description": "The location in which uniqueness will be verified."
},
"resourceGroupNameParameter": {
"name": "resourceGroupName",
"in": "path",
"required": true,
"type": "string",
"pattern": "^[-\\w\\._\\(\\)]+$",
"minLength": 1,
"maxLength": 90,
"x-ms-parameter-location": "method",
"description": "Name of an Azure resource group."
},
"subscriptionIdParameter": {
"name": "subscriptionId",
"description": "The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)",
"in": "path",
"required": true,
"type": "string"
}
}
}

Просмотреть файл

@ -0,0 +1,20 @@
{
"parameters": {
"subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"location": "eastus2euap",
"checkNameAvailability": {
"name": "MyAccount",
"type": "Microsoft.MixedReality/spatialAnchorsAccounts"
},
"api-version": " 2020-04-06-preview"
},
"responses": {
"200": {
"body": {
"nameAvailable": "false",
"reason": "AlreadyExists",
"message": "..."
}
}
}
}

Просмотреть файл

@ -0,0 +1,50 @@
{
"parameters": {
"api-version": "2020-04-06-preview"
},
"responses": {
"200": {
"body": {
"value": [
{
"name": "Microsoft.MixedReality/register/action",
"display": {
"provider": "Microsoft.MixedReality",
"resource": "Mixed Reality resource provider",
"operation": "Registers the Mixed Reality resource provider",
"description": "Registers a subscription for the Mixed Reality resource provider."
}
},
{
"name": "Microsoft.MixedReality/SpatialAnchorsAccounts/delete",
"display": {
"provider": "Microsoft.MixedReality",
"resource": "SpatialAnchorsAccounts",
"operation": "Delete Spatial Anchors Accounts",
"description": "Deletes the resource for Microsoft.MixedReality/SpatialAnchorsAccounts"
}
},
{
"name": "Microsoft.MixedReality/SpatialAnchorsAccounts/read",
"display": {
"provider": "Microsoft.MixedReality",
"resource": "SpatialAnchorsAccounts",
"operation": "Get Spatial Anchors Accounts",
"description": "Gets the resource for Microsoft.MixedReality/SpatialAnchorsAccounts"
}
},
{
"name": "Microsoft.MixedReality/SpatialAnchorsAccounts/write",
"display": {
"provider": "Microsoft.MixedReality",
"resource": "SpatialAnchorsAccounts",
"operation": "Update Spatial Anchors Accounts",
"description": "Updates the resource for Microsoft.MixedReality/SpatialAnchorsAccounts"
}
}
],
"nextLink": null
}
}
}
}

Просмотреть файл

@ -0,0 +1,12 @@
{
"parameters": {
"subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"resourceGroupName": "MyResourceGroup",
"accountName": "MyAccount",
"api-version": "2020-04-06-preview"
},
"responses": {
"200": {},
"204": {}
}
}

Просмотреть файл

@ -0,0 +1,26 @@
{
"parameters": {
"subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"resourceGroupName": "MyResourceGroup",
"accountName": "MyAccount",
"api-version": "2020-04-06-preview"
},
"responses": {
"200": {
"body": {
"properties": {
"accountId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"accountDomain": "mixedreality.azure.com"
},
"tags": {},
"identity": {
"type": "SystemAssigned"
},
"location": "eastus2euap",
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/MyResourceGroup/providers/Microsoft.MixedReality/remoteRenderingAccounts/MyAccount",
"name": "MyAccount",
"type": "Microsoft.MixedReality/remoteRenderingAccounts"
}
}
}
}

Просмотреть файл

@ -0,0 +1,44 @@
{
"parameters": {
"subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"resourceGroupName": "MyResourceGroup",
"api-version": "2020-04-06-preview"
},
"responses": {
"200": {
"body": {
"value": [
{
"properties": {
"accountId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"accountDomain": "mixedreality.azure.com"
},
"tags": {},
"identity": {
"type": "SystemAssigned"
},
"location": "eastus2euap",
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/MyResourceGroup/providers/Microsoft.MixedReality/remoteRenderingAccounts/alpha",
"name": "alpha",
"type": "Microsoft.MixedReality/remoteRenderingAccounts"
},
{
"properties": {
"accountId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"accountDomain": "mixedreality.azure.com"
},
"tags": {},
"identity": {
"type": "SystemAssigned"
},
"location": "eastus2euap",
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/MyResourceGroup/providers/Microsoft.MixedReality/remoteRenderingAccounts/omega",
"name": "omega",
"type": "Microsoft.MixedReality/remoteRenderingAccounts"
}
],
"nextLink": "https://aka.ms/&^FDKKAR"
}
}
}
}

Просмотреть файл

@ -0,0 +1,43 @@
{
"parameters": {
"subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"api-version": "2020-04-06-preview"
},
"responses": {
"200": {
"body": {
"value": [
{
"properties": {
"accountId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"accountDomain": "mixedreality.azure.com"
},
"tags": {},
"identity": {
"type": "SystemAssigned"
},
"location": "eastus2euap",
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/MyResourceGroup/providers/Microsoft.MixedReality/remoteRenderingAccounts/alpha",
"name": "alpha",
"type": "Microsoft.MixedReality/remoteRenderingAccounts"
},
{
"properties": {
"accountId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"accountDomain": "mixedreality.azure.com"
},
"tags": {},
"identity": {
"type": "SystemAssigned"
},
"location": "eastus2euap",
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/MyResourceGroup/providers/Microsoft.MixedReality/remoteRenderingAccounts/omega",
"name": "omega",
"type": "Microsoft.MixedReality/remoteRenderingAccounts"
}
],
"nextLink": "https://aka.ms/&^FDKKAR"
}
}
}
}

Просмотреть файл

@ -0,0 +1,16 @@
{
"parameters": {
"subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"resourceGroupName": "MyResourceGroup",
"accountName": "MyAccount",
"api-version": "2020-04-06-preview"
},
"responses": {
"200": {
"body": {
"primaryKey": "******",
"secondaryKey": "******"
}
}
}
}

Просмотреть файл

@ -0,0 +1,39 @@
{
"parameters": {
"subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"resourceGroupName": "MyResourceGroup",
"accountName": "MyAccount",
"api-version": "2020-04-06-preview",
"remoteRenderingAccount": {
"identity": {
"type": "SystemAssigned"
},
"location": "eastus2euap",
"tags": {
"heroine": "juliet",
"hero": "romeo"
}
}
},
"responses": {
"200": {
"body": {
"properties": {
"accountId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"accountDomain": "mixedreality.azure.com"
},
"tags": {
"heroine": "juliet",
"hero": "romeo"
},
"identity": {
"type": "SystemAssigned"
},
"location": "eastus2euap",
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/MyResourceGroup/providers/Microsoft.MixedReality/remoteRenderingAccounts/MyAccount",
"name": "MyAccount",
"type": "Microsoft.MixedReality/remoteRenderingAccounts"
}
}
}
}

Просмотреть файл

@ -0,0 +1,48 @@
{
"parameters": {
"subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"resourceGroupName": "MyResourceGroup",
"accountName": "MyAccount",
"api-version": "2020-04-06-preview",
"remoteRenderingAccount": {
"identity": {
"type": "SystemAssigned"
},
"location": "eastus2euap"
}
},
"responses": {
"201": {
"body": {
"properties": {
"accountId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"accountDomain": "mixedreality.azure.com"
},
"tags": {},
"identity": {
"type": "SystemAssigned"
},
"location": "eastus2euap",
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/MyResourceGroup/providers/Microsoft.MixedReality/remoteRenderingAccounts/MyAccount",
"name": "MyAccount",
"type": "Microsoft.MixedReality/remoteRenderingAccounts"
}
},
"200": {
"body": {
"properties": {
"accountId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"accountDomain": "mixedreality.azure.com"
},
"tags": {},
"identity": {
"type": "SystemAssigned"
},
"location": "eastus2euap",
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/MyResourceGroup/providers/Microsoft.MixedReality/remoteRenderingAccounts/MyAccount",
"name": "MyAccount",
"type": "Microsoft.MixedReality/remoteRenderingAccounts"
}
}
}
}

Просмотреть файл

@ -0,0 +1,19 @@
{
"parameters": {
"subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"resourceGroupName": "MyResourceGroup",
"accountName": "MyAccount",
"api-version": "2020-04-06-preview",
"regenerate": {
"serial": 1
}
},
"responses": {
"200": {
"body": {
"primaryKey": "******",
"secondaryKey": "******"
}
}
}
}

Просмотреть файл

@ -0,0 +1,254 @@
{
"swagger": "2.0",
"info": {
"title": "Mixed Reality",
"description": "Mixed Reality Resource Provider Proxy API",
"version": "2020-04-06-preview",
"x-ms-code-generation-settings": {
"name": "MixedRealityClient"
}
},
"host": "management.azure.com",
"schemes": [
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"security": [
{
"azure_auth": [
"user_impersonation"
]
}
],
"securityDefinitions": {
"azure_auth": {
"type": "oauth2",
"authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize",
"flow": "implicit",
"description": "Azure Active Directory OAuth2 Flow",
"scopes": {
"user_impersonation": "Impersonate your user account"
}
}
},
"paths": {
"/providers/Microsoft.MixedReality/operations": {
"get": {
"operationId": "Operations_List",
"tags": [
"Proxy"
],
"description": "Exposing Available Operations",
"x-ms-examples": {
"List available operations": {
"$ref": "./examples/proxy/ExposingAvailableOperations.json"
}
},
"parameters": [
{
"$ref": "./common.json#/parameters/apiVersionParameter"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/OperationPage"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "./common.json#/definitions/CloudError"
}
}
},
"x-ms-pageable": {
"nextLinkName": "nextLink"
}
}
},
"/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/locations/{location}/checkNameAvailability": {
"post": {
"operationId": "CheckNameAvailabilityLocal",
"tags": [
"Proxy"
],
"description": "Check Name Availability for local uniqueness",
"x-ms-examples": {
"CheckLocalNameAvailability": {
"$ref": "./examples/proxy/CheckNameAvailabilityForLocalUniqueness.json"
}
},
"parameters": [
{
"$ref": "./common.json#/parameters/subscriptionIdParameter"
},
{
"$ref": "./common.json#/parameters/locationParameter"
},
{
"$ref": "#/parameters/checkNameAvailabilityParameter"
},
{
"$ref": "./common.json#/parameters/apiVersionParameter"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/CheckNameAvailabilityResponse"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "./common.json#/definitions/CloudError"
}
}
}
}
}
},
"definitions": {
"CheckNameAvailabilityRequest": {
"description": "Check Name Availability Request",
"type": "object",
"required": [
"name",
"type"
],
"properties": {
"name": {
"description": "Resource Name To Verify",
"type": "string"
},
"type": {
"description": "Fully qualified resource type which includes provider namespace",
"type": "string"
}
}
},
"CheckNameAvailabilityResponse": {
"description": "Check Name Availability Response",
"type": "object",
"required": [
"nameAvailable"
],
"properties": {
"nameAvailable": {
"description": "if name Available",
"$ref": "#/definitions/NameAvailability"
},
"reason": {
"description": "Resource Name To Verify",
"$ref": "#/definitions/NameUnavailableReason"
},
"message": {
"description": "detail message",
"type": "string"
}
}
},
"Operation": {
"description": "REST API operation",
"type": "object",
"properties": {
"name": {
"description": "Operation name: {provider}/{resource}/{operation}",
"type": "string"
},
"display": {
"description": "The object that represents the operation.",
"$ref": "#/definitions/OperationDisplay"
}
}
},
"OperationDisplay": {
"description": "The object that represents the operation.",
"type": "object",
"required": [
"provider",
"resource",
"operation",
"description"
],
"properties": {
"provider": {
"description": "Service provider: Microsoft.ResourceProvider",
"type": "string"
},
"resource": {
"description": "Resource on which the operation is performed: Profile, endpoint, etc.",
"type": "string"
},
"operation": {
"description": "Operation type: Read, write, delete, etc.",
"type": "string"
},
"description": {
"description": "Description of operation",
"type": "string"
}
}
},
"NameAvailability": {
"description": "Whether or not the name is available.",
"type": "string",
"enum": [
"true",
"false"
],
"x-ms-enum": {
"name": "NameAvailability",
"modelAsString": true
}
},
"NameUnavailableReason": {
"description": "reason of name unavailable.",
"type": "string",
"enum": [
"Invalid",
"AlreadyExists"
],
"x-ms-enum": {
"name": "NameUnavailableReason",
"modelAsString": true
}
},
"OperationPage": {
"description": "Result of the request to list Resource Provider operations. It contains a list of operations and a URL link to get the next set of results.",
"properties": {
"value": {
"type": "array",
"items": {
"$ref": "#/definitions/Operation"
},
"description": "List of operations supported by the Resource Provider."
},
"nextLink": {
"type": "string",
"description": "URL to get the next set of operation list results if there are any."
}
}
}
},
"parameters": {
"checkNameAvailabilityParameter": {
"name": "checkNameAvailability",
"description": "Check Name Availability Request.",
"in": "body",
"schema": {
"$ref": "#/definitions/CheckNameAvailabilityRequest"
},
"required": true,
"x-ms-parameter-location": "method"
}
}
}

Просмотреть файл

@ -0,0 +1,511 @@
{
"swagger": "2.0",
"info": {
"title": "Mixed Reality",
"description": "Mixed Reality Resource Provider Remote Rendering Resource API",
"version": "2020-04-06-preview"
},
"host": "management.azure.com",
"schemes": [
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"security": [
{
"azure_auth": [
"user_impersonation"
]
}
],
"securityDefinitions": {
"azure_auth": {
"type": "oauth2",
"authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize",
"flow": "implicit",
"description": "Azure Active Directory OAuth2 Flow",
"scopes": {
"user_impersonation": "Impersonate your user account"
}
}
},
"paths": {
"/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/remoteRenderingAccounts": {
"get": {
"operationId": "RemoteRenderingAccounts_ListBySubscription",
"tags": [
"Resource",
"Proxy"
],
"description": "List Remote Rendering Accounts by Subscription",
"x-ms-examples": {
"List remote rendering accounts by subscription": {
"$ref": "./examples/remote-rendering/GetBySubscription.json"
}
},
"parameters": [
{
"$ref": "./common.json#/parameters/subscriptionIdParameter"
},
{
"$ref": "./common.json#/parameters/apiVersionParameter"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/RemoteRenderingAccountPage"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "./common.json#/definitions/CloudError"
}
}
},
"x-ms-pageable": {
"nextLinkName": "nextLink"
}
}
},
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts": {
"get": {
"operationId": "RemoteRenderingAccounts_ListByResourceGroup",
"tags": [
"Resource"
],
"description": "List Resources by Resource Group",
"x-ms-examples": {
"List remote rendering accounts by resource group": {
"$ref": "./examples/remote-rendering/GetByResourceGroup.json"
}
},
"parameters": [
{
"$ref": "./common.json#/parameters/subscriptionIdParameter"
},
{
"$ref": "./common.json#/parameters/resourceGroupNameParameter"
},
{
"$ref": "./common.json#/parameters/apiVersionParameter"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/RemoteRenderingAccountPage"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "./common.json#/definitions/CloudError"
}
}
},
"x-ms-pageable": {
"nextLinkName": "nextLink"
}
}
},
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}": {
"delete": {
"operationId": "RemoteRenderingAccounts_Delete",
"tags": [
"Resource"
],
"description": "Delete a Remote Rendering Account.",
"x-ms-examples": {
"Delete remote rendering account": {
"$ref": "./examples/remote-rendering/Delete.json"
}
},
"parameters": [
{
"$ref": "./common.json#/parameters/subscriptionIdParameter"
},
{
"$ref": "./common.json#/parameters/resourceGroupNameParameter"
},
{
"$ref": "./common.json#/parameters/accountNameParameter"
},
{
"$ref": "./common.json#/parameters/apiVersionParameter"
}
],
"responses": {
"200": {
"description": "OK"
},
"204": {
"description": "NoContent"
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "./common.json#/definitions/CloudError"
}
}
}
},
"get": {
"operationId": "RemoteRenderingAccounts_Get",
"tags": [
"Resource"
],
"description": "Retrieve a Remote Rendering Account.",
"x-ms-examples": {
"Get remote rendering account": {
"$ref": "./examples/remote-rendering/Get.json"
}
},
"parameters": [
{
"$ref": "./common.json#/parameters/subscriptionIdParameter"
},
{
"$ref": "./common.json#/parameters/resourceGroupNameParameter"
},
{
"$ref": "./common.json#/parameters/accountNameParameter"
},
{
"$ref": "./common.json#/parameters/apiVersionParameter"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/RemoteRenderingAccount"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "./common.json#/definitions/CloudError"
}
}
}
},
"patch": {
"operationId": "RemoteRenderingAccounts_Update",
"tags": [
"Resource"
],
"description": "Updating a Remote Rendering Account",
"x-ms-examples": {
"Update remote rendering account": {
"$ref": "./examples/remote-rendering/Patch.json"
}
},
"parameters": [
{
"$ref": "./common.json#/parameters/subscriptionIdParameter"
},
{
"$ref": "./common.json#/parameters/resourceGroupNameParameter"
},
{
"$ref": "./common.json#/parameters/accountNameParameter"
},
{
"$ref": "#/parameters/remoteRenderingAccountParameter"
},
{
"$ref": "./common.json#/parameters/apiVersionParameter"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/RemoteRenderingAccount"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "./common.json#/definitions/CloudError"
}
}
}
},
"put": {
"operationId": "RemoteRenderingAccounts_Create",
"tags": [
"Resource"
],
"description": "Creating or Updating a Remote Rendering Account.",
"x-ms-examples": {
"Create remote rendering account": {
"$ref": "./examples/remote-rendering/Put.json"
}
},
"parameters": [
{
"$ref": "./common.json#/parameters/subscriptionIdParameter"
},
{
"$ref": "./common.json#/parameters/resourceGroupNameParameter"
},
{
"$ref": "./common.json#/parameters/accountNameParameter"
},
{
"$ref": "#/parameters/remoteRenderingAccountParameter"
},
{
"$ref": "./common.json#/parameters/apiVersionParameter"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/RemoteRenderingAccount"
}
},
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/RemoteRenderingAccount"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "./common.json#/definitions/CloudError"
}
}
}
}
},
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}/listKeys": {
"post": {
"operationId": "RemoteRenderingAccounts_ListKeys",
"tags": [
"Key"
],
"description": "List Both of the 2 Keys of a Remote Rendering Account",
"x-ms-examples": {
"List remote rendering account key": {
"$ref": "./examples/remote-rendering/ListKeys.json"
}
},
"parameters": [
{
"$ref": "./common.json#/parameters/subscriptionIdParameter"
},
{
"$ref": "./common.json#/parameters/resourceGroupNameParameter"
},
{
"$ref": "./common.json#/parameters/accountNameParameter"
},
{
"$ref": "./common.json#/parameters/apiVersionParameter"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "./common.json#/definitions/AccountKeys"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "./common.json#/definitions/CloudError"
}
}
}
}
},
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}/regenerateKeys": {
"post": {
"operationId": "RemoteRenderingAccounts_RegenerateKeys",
"tags": [
"Key"
],
"description": "Regenerate specified Key of a Remote Rendering Account",
"x-ms-examples": {
"Regenerate remote rendering account keys": {
"$ref": "./examples/remote-rendering/RegenerateKey.json"
}
},
"parameters": [
{
"$ref": "./common.json#/parameters/subscriptionIdParameter"
},
{
"$ref": "./common.json#/parameters/resourceGroupNameParameter"
},
{
"$ref": "./common.json#/parameters/accountNameParameter"
},
{
"name": "regenerate",
"in": "body",
"description": "The account payload.",
"required": true,
"schema": {
"$ref": "./common.json#/definitions/AccountKeyRegenerateRequest"
}
},
{
"$ref": "./common.json#/parameters/apiVersionParameter"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "./common.json#/definitions/AccountKeys"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "./common.json#/definitions/CloudError"
}
}
}
}
}
},
"definitions": {
"TrackedResource": {
"description": "The resource model definition for a ARM tracked top level resource",
"properties": {
"tags": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"x-ms-mutability": ["read", "create", "update"],
"description": "Resource tags."
},
"location": {
"type": "string",
"x-ms-mutability": ["read", "create"],
"description": "The geo-location where the resource lives"
}
},
"required": ["location"],
"allOf": [
{
"$ref": "#/definitions/Resource"
}
]
},
"Resource": {
"properties": {
"id": {
"readOnly": true,
"type": "string",
"description": "Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"
},
"name": {
"readOnly": true,
"type": "string",
"description": "The name of the resource"
},
"type": {
"readOnly": true,
"type": "string",
"description": "The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts."
}
},
"x-ms-azure-resource": true
},
"Identity": {
"description": "Identity for the resource.",
"properties": {
"principalId": {
"readOnly": true,
"type": "string",
"description": "The principal ID of resource identity."
},
"tenantId": {
"readOnly": true,
"type": "string",
"description": "The tenant ID of resource."
},
"type": {
"type": "string",
"description": "The identity type.",
"enum": [
"SystemAssigned"
],
"x-ms-enum": {
"name": "ResourceIdentityType",
"modelAsString": false
}
}
}
},
"RemoteRenderingAccount": {
"allOf": [
{
"$ref": "#/definitions/TrackedResource"
}
],
"description": "RemoteRenderingAccount Response.",
"type": "object",
"properties": {
"identity": {
"allOf": [
{
"$ref": "#/definitions/Identity"
}
]
},
"properties": {
"x-ms-client-flatten": true,
"description": "Property bag.",
"$ref": "./common.json#/definitions/MixedRealityAccountProperties"
}
}
},
"RemoteRenderingAccountPage": {
"description": "Result of the request to get resource collection. It contains a list of resources and a URL link to get the next set of results.",
"type": "object",
"properties": {
"value": {
"type": "array",
"items": {
"$ref": "#/definitions/RemoteRenderingAccount"
},
"description": "List of resources supported by the Resource Provider."
},
"nextLink": {
"type": "string",
"description": "URL to get the next set of resource list results if there are any."
}
}
}
},
"parameters": {
"remoteRenderingAccountParameter": {
"name": "remoteRenderingAccount",
"description": "Remote Rendering Account parameter.",
"in": "body",
"schema": {
"$ref": "#/definitions/RemoteRenderingAccount"
},
"required": true,
"x-ms-parameter-location": "method"
}
}
}

Просмотреть файл

@ -0,0 +1,166 @@
{
"swagger": "2.0",
"info": {
"title": "Mixed Reality",
"description": "Mixed Reality Resource Provider API",
"version": "2020-05-01"
},
"paths": {},
"definitions": {
"AccountKeys": {
"description": "Developer Keys of account",
"type": "object",
"properties": {
"primaryKey": {
"description": "value of primary key.",
"readOnly": true,
"type": "string"
},
"secondaryKey": {
"description": "value of secondary key.",
"readOnly": true,
"type": "string"
}
}
},
"AccountKeyRegenerateRequest": {
"description": "Request for account key regeneration",
"type": "object",
"properties": {
"serial": {
"type": "integer",
"enum": [
1,
2
],
"default": 1,
"x-ms-enum": {
"name": "Serial",
"values": [
{
"value": 1,
"description": "The Primary Key",
"name": "Primary"
},
{
"value": 2,
"description": "The Secondary Key",
"name": "Secondary"
}
]
},
"description": "serial of key to be regenerated"
}
}
},
"CloudError": {
"x-ms-external": true,
"properties": {
"error": {
"$ref": "#/definitions/CloudErrorBody"
}
},
"description": "An Error response."
},
"CloudErrorBody": {
"x-ms-external": true,
"properties": {
"code": {
"type": "string",
"description": "An identifier for the error. Codes are invariant and are intended to be consumed programmatically."
},
"message": {
"type": "string",
"description": "A message describing the error, intended to be suitable for displaying in a user interface."
},
"target": {
"type": "string",
"description": "The target of the particular error. For example, the name of the property in error."
},
"details": {
"type": "array",
"items": {
"$ref": "#/definitions/CloudErrorBody"
},
"description": "A list of additional details about the error."
}
},
"description": "An error response from Azure."
},
"MixedRealityAccountProperties": {
"description": "Common Properties shared by Mixed Reality Accounts",
"type": "object",
"properties": {
"accountId": {
"description": "unique id of certain account.",
"readOnly": true,
"type": "string"
},
"accountDomain": {
"description": "Correspond domain name of certain Spatial Anchors Account",
"readOnly": true,
"type": "string"
}
}
}
},
"parameters": {
"accountKeyRegenerateParameter": {
"name": "regenerate",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/AccountKeyRegenerateRequest"
},
"x-ms-parameter-location": "method",
"description": "Required information for key regeneration."
},
"accountNameParameter": {
"name": "accountName",
"in": "path",
"required": true,
"type": "string",
"pattern": "^[-\\w\\._\\(\\)]+$",
"minLength": 1,
"maxLength": 90,
"x-ms-parameter-location": "method",
"description": "Name of an Mixed Reality Account."
},
"apiVersionParameter": {
"name": "api-version",
"description": "The API version to be used with the HTTP request.",
"in": "query",
"required": true,
"type": "string"
},
"locationParameter": {
"name": "location",
"in": "path",
"required": true,
"type": "string",
"pattern": "^[-\\w\\._\\(\\)]+$",
"minLength": 1,
"maxLength": 90,
"x-ms-parameter-location": "method",
"description": "The location in which uniqueness will be verified."
},
"resourceGroupNameParameter": {
"name": "resourceGroupName",
"in": "path",
"required": true,
"type": "string",
"pattern": "^[-\\w\\._\\(\\)]+$",
"minLength": 1,
"maxLength": 90,
"x-ms-parameter-location": "method",
"description": "Name of an Azure resource group."
},
"subscriptionIdParameter": {
"name": "subscriptionId",
"description": "The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)",
"in": "path",
"required": true,
"type": "string"
}
}
}

Просмотреть файл

@ -0,0 +1,20 @@
{
"parameters": {
"subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"location": "eastus2euap",
"checkNameAvailability": {
"name": "MyAccount",
"type": "Microsoft.MixedReality/spatialAnchorsAccounts"
},
"api-version": "2020-05-01"
},
"responses": {
"200": {
"body": {
"nameAvailable": "false",
"reason": "AlreadyExists",
"message": "..."
}
}
}
}

Просмотреть файл

@ -0,0 +1,50 @@
{
"parameters": {
"api-version": "2020-05-01"
},
"responses": {
"200": {
"body": {
"value": [
{
"name": "Microsoft.MixedReality/register/action",
"display": {
"provider": "Microsoft.MixedReality",
"resource": "Mixed Reality resource provider",
"operation": "Registers the Mixed Reality resource provider",
"description": "Registers a subscription for the Mixed Reality resource provider."
}
},
{
"name": "Microsoft.MixedReality/SpatialAnchorsAccounts/delete",
"display": {
"provider": "Microsoft.MixedReality",
"resource": "SpatialAnchorsAccounts",
"operation": "Delete Spatial Anchors Accounts",
"description": "Deletes the resource for Microsoft.MixedReality/SpatialAnchorsAccounts"
}
},
{
"name": "Microsoft.MixedReality/SpatialAnchorsAccounts/read",
"display": {
"provider": "Microsoft.MixedReality",
"resource": "SpatialAnchorsAccounts",
"operation": "Get Spatial Anchors Accounts",
"description": "Gets the resource for Microsoft.MixedReality/SpatialAnchorsAccounts"
}
},
{
"name": "Microsoft.MixedReality/SpatialAnchorsAccounts/write",
"display": {
"provider": "Microsoft.MixedReality",
"resource": "SpatialAnchorsAccounts",
"operation": "Update Spatial Anchors Accounts",
"description": "Updates the resource for Microsoft.MixedReality/SpatialAnchorsAccounts"
}
}
],
"nextLink": null
}
}
}
}

Просмотреть файл

@ -0,0 +1,12 @@
{
"parameters": {
"subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"resourceGroupName": "MyResourceGroup",
"accountName": "MyAccount",
"api-version": "2020-05-01"
},
"responses": {
"200": {},
"204": {}
}
}

Просмотреть файл

@ -0,0 +1,23 @@
{
"parameters": {
"subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"resourceGroupName": "MyResourceGroup",
"accountName": "MyAccount",
"api-version": "2020-05-01"
},
"responses": {
"200": {
"body": {
"properties": {
"accountId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"accountDomain": "mixedreality.azure.com"
},
"tags": {},
"location": "eastus",
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/MyResourceGroup/providers/Microsoft.MixedReality/spatialAnchorsAccounts/MyAccount",
"name": "MyAccount",
"type": "Microsoft.MixedReality/spatialAnchorsAccounts"
}
}
}
}

Просмотреть файл

@ -0,0 +1,38 @@
{
"parameters": {
"subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"resourceGroupName": "MyResourceGroup",
"api-version": "2020-05-01"
},
"responses": {
"200": {
"body": {
"value": [
{
"properties": {
"accountId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"accountDomain": "mixedreality.azure.com"
},
"tags": {},
"location": "eastus",
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/MyResourceGroup/providers/Microsoft.MixedReality/spatialAnchorsAccounts/alpha",
"name": "alpha",
"type": "Microsoft.MixedReality/spatialAnchorsAccounts"
},
{
"properties": {
"accountId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"accountDomain": "mixedreality.azure.com"
},
"tags": {},
"location": "eastus",
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/MyResourceGroup/providers/Microsoft.MixedReality/spatialAnchorsAccounts/omega",
"name": "omega",
"type": "Microsoft.MixedReality/spatialAnchorsAccounts"
}
],
"nextLink": "https://aka.ms/&^FDKKAR"
}
}
}
}

Просмотреть файл

@ -0,0 +1,37 @@
{
"parameters": {
"subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"api-version": "2020-05-01"
},
"responses": {
"200": {
"body": {
"value": [
{
"properties": {
"accountId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"accountDomain": "mixedreality.azure.com"
},
"tags": {},
"location": "eastus2euap",
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/MyResourceGroup/providers/Microsoft.MixedReality/spatialAnchorsAccounts/alpha",
"name": "alpha",
"type": "Microsoft.MixedReality/spatialAnchorsAccounts"
},
{
"properties": {
"accountId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"accountDomain": "mixedreality.azure.com"
},
"tags": {},
"location": "eastus2euap",
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/MyResourceGroup/providers/Microsoft.MixedReality/spatialAnchorsAccounts/omega",
"name": "omega",
"type": "Microsoft.MixedReality/spatialAnchorsAccounts"
}
],
"nextLink": "https://aka.ms/&^FDKKAR"
}
}
}
}

Просмотреть файл

@ -0,0 +1,16 @@
{
"parameters": {
"subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"resourceGroupName": "MyResourceGroup",
"accountName": "MyAccount",
"api-version": "2020-05-01"
},
"responses": {
"200": {
"body": {
"primaryKey": "******",
"secondaryKey": "******"
}
}
}
}

Просмотреть файл

@ -0,0 +1,33 @@
{
"parameters": {
"subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"resourceGroupName": "MyResourceGroup",
"accountName": "MyAccount",
"api-version": "2020-05-01",
"spatialAnchorsAccount": {
"location": "eastus2euap",
"tags": {
"heroine": "juliet",
"hero": "romeo"
}
}
},
"responses": {
"200": {
"body": {
"properties": {
"accountId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"accountDomain": "mixedreality.azure.com"
},
"tags": {
"heroine": "juliet",
"hero": "romeo"
},
"location": "eastus2euap",
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/MyResourceGroup/providers/Microsoft.MixedReality/spatialAnchorsAccounts/MyAccount",
"name": "MyAccount",
"type": "Microsoft.MixedReality/spatialAnchorsAccounts"
}
}
}
}

Просмотреть файл

@ -0,0 +1,39 @@
{
"parameters": {
"subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"resourceGroupName": "MyResourceGroup",
"accountName": "MyAccount",
"api-version": "2020-05-01",
"spatialAnchorsAccount": {
"location": "eastus2euap"
}
},
"responses": {
"201": {
"body": {
"properties": {
"accountId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"accountDomain": "mixedreality.azure.com"
},
"tags": {},
"location": "eastus2euap",
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/MyResourceGroup/providers/Microsoft.MixedReality/spatialAnchorsAccounts/MyAccount",
"name": "MyAccount",
"type": "Microsoft.MixedReality/spatialAnchorsAccounts"
}
},
"200": {
"body": {
"properties": {
"accountId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"accountDomain": "mixedreality.azure.com"
},
"tags": {},
"location": "eastus2euap",
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/MyResourceGroup/providers/Microsoft.MixedReality/spatialAnchorsAccounts/MyAccount",
"name": "MyAccount",
"type": "Microsoft.MixedReality/spatialAnchorsAccounts"
}
}
}
}

Просмотреть файл

@ -0,0 +1,19 @@
{
"parameters": {
"subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"resourceGroupName": "MyResourceGroup",
"accountName": "MyAccount",
"api-version": "2020-05-01",
"regenerate": {
"serial": 1
}
},
"responses": {
"200": {
"body": {
"primaryKey": "******",
"secondaryKey": "******"
}
}
}
}

Просмотреть файл

@ -0,0 +1,254 @@
{
"swagger": "2.0",
"info": {
"title": "Mixed Reality",
"description": "Mixed Reality Resource Provider Proxy API",
"version": "2020-05-01",
"x-ms-code-generation-settings": {
"name": "MixedRealityClient"
}
},
"host": "management.azure.com",
"schemes": [
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"security": [
{
"azure_auth": [
"user_impersonation"
]
}
],
"securityDefinitions": {
"azure_auth": {
"type": "oauth2",
"authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize",
"flow": "implicit",
"description": "Azure Active Directory OAuth2 Flow",
"scopes": {
"user_impersonation": "Impersonate your user account"
}
}
},
"paths": {
"/providers/Microsoft.MixedReality/operations": {
"get": {
"operationId": "Operations_List",
"tags": [
"Proxy"
],
"description": "Exposing Available Operations",
"x-ms-examples": {
"List available operations": {
"$ref": "./examples/proxy/ExposingAvailableOperations.json"
}
},
"parameters": [
{
"$ref": "./common.json#/parameters/apiVersionParameter"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/OperationPage"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "./common.json#/definitions/CloudError"
}
}
},
"x-ms-pageable": {
"nextLinkName": "nextLink"
}
}
},
"/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/locations/{location}/checkNameAvailability": {
"post": {
"operationId": "CheckNameAvailabilityLocal",
"tags": [
"Proxy"
],
"description": "Check Name Availability for local uniqueness",
"x-ms-examples": {
"CheckLocalNameAvailability": {
"$ref": "./examples/proxy/CheckNameAvailabilityForLocalUniqueness.json"
}
},
"parameters": [
{
"$ref": "./common.json#/parameters/subscriptionIdParameter"
},
{
"$ref": "./common.json#/parameters/locationParameter"
},
{
"$ref": "#/parameters/checkNameAvailabilityParameter"
},
{
"$ref": "./common.json#/parameters/apiVersionParameter"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/CheckNameAvailabilityResponse"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "./common.json#/definitions/CloudError"
}
}
}
}
}
},
"definitions": {
"CheckNameAvailabilityRequest": {
"description": "Check Name Availability Request",
"type": "object",
"required": [
"name",
"type"
],
"properties": {
"name": {
"description": "Resource Name To Verify",
"type": "string"
},
"type": {
"description": "Fully qualified resource type which includes provider namespace",
"type": "string"
}
}
},
"CheckNameAvailabilityResponse": {
"description": "Check Name Availability Response",
"type": "object",
"required": [
"nameAvailable"
],
"properties": {
"nameAvailable": {
"description": "if name Available",
"$ref": "#/definitions/NameAvailability"
},
"reason": {
"description": "Resource Name To Verify",
"$ref": "#/definitions/NameUnavailableReason"
},
"message": {
"description": "detail message",
"type": "string"
}
}
},
"Operation": {
"description": "REST API operation",
"type": "object",
"properties": {
"name": {
"description": "Operation name: {provider}/{resource}/{operation}",
"type": "string"
},
"display": {
"description": "The object that represents the operation.",
"$ref": "#/definitions/OperationDisplay"
}
}
},
"OperationDisplay": {
"description": "The object that represents the operation.",
"type": "object",
"required": [
"provider",
"resource",
"operation",
"description"
],
"properties": {
"provider": {
"description": "Service provider: Microsoft.ResourceProvider",
"type": "string"
},
"resource": {
"description": "Resource on which the operation is performed: Profile, endpoint, etc.",
"type": "string"
},
"operation": {
"description": "Operation type: Read, write, delete, etc.",
"type": "string"
},
"description": {
"description": "Description of operation",
"type": "string"
}
}
},
"NameAvailability": {
"description": "Whether or not the name is available.",
"type": "string",
"enum": [
"true",
"false"
],
"x-ms-enum": {
"name": "NameAvailability",
"modelAsString": true
}
},
"NameUnavailableReason": {
"description": "reason of name unavailable.",
"type": "string",
"enum": [
"Invalid",
"AlreadyExists"
],
"x-ms-enum": {
"name": "NameUnavailableReason",
"modelAsString": true
}
},
"OperationPage": {
"description": "Result of the request to list Resource Provider operations. It contains a list of operations and a URL link to get the next set of results.",
"properties": {
"value": {
"type": "array",
"items": {
"$ref": "#/definitions/Operation"
},
"description": "List of operations supported by the Resource Provider."
},
"nextLink": {
"type": "string",
"description": "URL to get the next set of operation list results if there are any."
}
}
}
},
"parameters": {
"checkNameAvailabilityParameter": {
"name": "checkNameAvailability",
"description": "Check Name Availability Request.",
"in": "body",
"schema": {
"$ref": "#/definitions/CheckNameAvailabilityRequest"
},
"required": true,
"x-ms-parameter-location": "method"
}
}
}

Просмотреть файл

@ -0,0 +1,478 @@
{
"swagger": "2.0",
"info": {
"title": "Mixed Reality",
"description": "Mixed Reality Resource Provider Spatial Anchors Resource API",
"version": "2020-05-01"
},
"host": "management.azure.com",
"schemes": [
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"security": [
{
"azure_auth": [
"user_impersonation"
]
}
],
"securityDefinitions": {
"azure_auth": {
"type": "oauth2",
"authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize",
"flow": "implicit",
"description": "Azure Active Directory OAuth2 Flow",
"scopes": {
"user_impersonation": "Impersonate your user account"
}
}
},
"paths": {
"/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/spatialAnchorsAccounts": {
"get": {
"operationId": "SpatialAnchorsAccounts_ListBySubscription",
"tags": [
"Resource",
"Proxy"
],
"description": "List Spatial Anchors Accounts by Subscription",
"x-ms-examples": {
"List spatial anchors accounts by subscription": {
"$ref": "./examples/spatial-anchors/GetBySubscription.json"
}
},
"parameters": [
{
"$ref": "./common.json#/parameters/subscriptionIdParameter"
},
{
"$ref": "./common.json#/parameters/apiVersionParameter"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/SpatialAnchorsAccountPage"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "./common.json#/definitions/CloudError"
}
}
},
"x-ms-pageable": {
"nextLinkName": "nextLink"
}
}
},
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts": {
"get": {
"operationId": "SpatialAnchorsAccounts_ListByResourceGroup",
"tags": [
"Resource"
],
"description": "List Resources by Resource Group",
"x-ms-examples": {
"List spatial anchor accounts by resource group": {
"$ref": "./examples/spatial-anchors/GetByResourceGroup.json"
}
},
"parameters": [
{
"$ref": "./common.json#/parameters/subscriptionIdParameter"
},
{
"$ref": "./common.json#/parameters/resourceGroupNameParameter"
},
{
"$ref": "./common.json#/parameters/apiVersionParameter"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/SpatialAnchorsAccountPage"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "./common.json#/definitions/CloudError"
}
}
},
"x-ms-pageable": {
"nextLinkName": "nextLink"
}
}
},
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}": {
"delete": {
"operationId": "SpatialAnchorsAccounts_Delete",
"tags": [
"Resource"
],
"description": "Delete a Spatial Anchors Account.",
"x-ms-examples": {
"Delete spatial anchors account": {
"$ref": "./examples/spatial-anchors/Delete.json"
}
},
"parameters": [
{
"$ref": "./common.json#/parameters/subscriptionIdParameter"
},
{
"$ref": "./common.json#/parameters/resourceGroupNameParameter"
},
{
"$ref": "./common.json#/parameters/accountNameParameter"
},
{
"$ref": "./common.json#/parameters/apiVersionParameter"
}
],
"responses": {
"200": {
"description": "OK"
},
"204": {
"description": "NoContent"
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "./common.json#/definitions/CloudError"
}
}
}
},
"get": {
"operationId": "SpatialAnchorsAccounts_Get",
"tags": [
"Resource"
],
"description": "Retrieve a Spatial Anchors Account.",
"x-ms-examples": {
"Get spatial anchors account": {
"$ref": "./examples/spatial-anchors/Get.json"
}
},
"parameters": [
{
"$ref": "./common.json#/parameters/subscriptionIdParameter"
},
{
"$ref": "./common.json#/parameters/resourceGroupNameParameter"
},
{
"$ref": "./common.json#/parameters/accountNameParameter"
},
{
"$ref": "./common.json#/parameters/apiVersionParameter"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/SpatialAnchorsAccount"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "./common.json#/definitions/CloudError"
}
}
}
},
"patch": {
"operationId": "SpatialAnchorsAccounts_Update",
"tags": [
"Resource"
],
"description": "Updating a Spatial Anchors Account",
"x-ms-examples": {
"Update spatial anchors account": {
"$ref": "./examples/spatial-anchors/Patch.json"
}
},
"parameters": [
{
"$ref": "./common.json#/parameters/subscriptionIdParameter"
},
{
"$ref": "./common.json#/parameters/resourceGroupNameParameter"
},
{
"$ref": "./common.json#/parameters/accountNameParameter"
},
{
"$ref": "#/parameters/spatialAnchorsAccountParameter"
},
{
"$ref": "./common.json#/parameters/apiVersionParameter"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/SpatialAnchorsAccount"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "./common.json#/definitions/CloudError"
}
}
}
},
"put": {
"operationId": "SpatialAnchorsAccounts_Create",
"tags": [
"Resource"
],
"description": "Creating or Updating a Spatial Anchors Account.",
"x-ms-examples": {
"Create spatial anchor account": {
"$ref": "./examples/spatial-anchors/Put.json"
}
},
"parameters": [
{
"$ref": "./common.json#/parameters/subscriptionIdParameter"
},
{
"$ref": "./common.json#/parameters/resourceGroupNameParameter"
},
{
"$ref": "./common.json#/parameters/accountNameParameter"
},
{
"$ref": "#/parameters/spatialAnchorsAccountParameter"
},
{
"$ref": "./common.json#/parameters/apiVersionParameter"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/SpatialAnchorsAccount"
}
},
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/SpatialAnchorsAccount"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "./common.json#/definitions/CloudError"
}
}
}
}
},
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}/listKeys": {
"post": {
"operationId": "SpatialAnchorsAccounts_ListKeys",
"tags": [
"Key"
],
"description": "List Both of the 2 Keys of a Spatial Anchors Account",
"x-ms-examples": {
"List spatial anchor account key": {
"$ref": "./examples/spatial-anchors/ListKeys.json"
}
},
"parameters": [
{
"$ref": "./common.json#/parameters/subscriptionIdParameter"
},
{
"$ref": "./common.json#/parameters/resourceGroupNameParameter"
},
{
"$ref": "./common.json#/parameters/accountNameParameter"
},
{
"$ref": "./common.json#/parameters/apiVersionParameter"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "./common.json#/definitions/AccountKeys"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "./common.json#/definitions/CloudError"
}
}
}
}
},
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}/regenerateKeys": {
"post": {
"operationId": "SpatialAnchorsAccounts_RegenerateKeys",
"tags": [
"Key"
],
"description": "Regenerate specified Key of a Spatial Anchors Account",
"x-ms-examples": {
"Regenerate spatial anchors account keys": {
"$ref": "./examples/spatial-anchors/RegenerateKey.json"
}
},
"parameters": [
{
"$ref": "./common.json#/parameters/subscriptionIdParameter"
},
{
"$ref": "./common.json#/parameters/resourceGroupNameParameter"
},
{
"$ref": "./common.json#/parameters/accountNameParameter"
},
{
"name": "regenerate",
"in": "body",
"description": "Required information for key regeneration.",
"required": true,
"schema": {
"$ref": "./common.json#/definitions/AccountKeyRegenerateRequest"
}
},
{
"$ref": "./common.json#/parameters/apiVersionParameter"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "./common.json#/definitions/AccountKeys"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "./common.json#/definitions/CloudError"
}
}
}
}
}
},
"definitions": {
"TrackedResource": {
"description": "The resource model definition for a ARM tracked top level resource",
"properties": {
"tags": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"x-ms-mutability": ["read", "create", "update"],
"description": "Resource tags."
},
"location": {
"type": "string",
"x-ms-mutability": ["read", "create"],
"description": "The geo-location where the resource lives"
}
},
"required": ["location"],
"allOf": [
{
"$ref": "#/definitions/Resource"
}
]
},
"Resource": {
"properties": {
"id": {
"readOnly": true,
"type": "string",
"description": "Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"
},
"name": {
"readOnly": true,
"type": "string",
"description": "The name of the resource"
},
"type": {
"readOnly": true,
"type": "string",
"description": "The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts."
}
},
"x-ms-azure-resource": true
},
"SpatialAnchorsAccount": {
"allOf": [
{
"$ref": "#/definitions/TrackedResource"
}
],
"description": "SpatialAnchorsAccount Response.",
"type": "object",
"properties": {
"properties": {
"x-ms-client-flatten": true,
"description": "Property bag.",
"$ref": "./common.json#/definitions/MixedRealityAccountProperties"
}
}
},
"SpatialAnchorsAccountPage": {
"description": "Result of the request to get resource collection. It contains a list of resources and a URL link to get the next set of results.",
"type": "object",
"properties": {
"value": {
"type": "array",
"items": {
"$ref": "#/definitions/SpatialAnchorsAccount"
},
"description": "List of resources supported by the Resource Provider."
},
"nextLink": {
"type": "string",
"description": "URL to get the next set of resource list results if there are any."
}
}
}
},
"parameters": {
"spatialAnchorsAccountParameter": {
"name": "spatialAnchorsAccount",
"description": "Spatial Anchors Account parameter.",
"in": "body",
"schema": {
"$ref": "#/definitions/SpatialAnchorsAccount"
},
"required": true,
"x-ms-parameter-location": "method"
}
}
}

Просмотреть файл

@ -0,0 +1,13 @@
# Azure CLI Mixed Reality Extension #
This is the extension of azure cli which provides commands to manage resources of Mixed Reality cloud service.
## How to use ##
First, install the extension:
```
az extension add --name mixed-reality
```
Then, call it as you would any other az command:
```
az spatial-anchors-account -h
```

Просмотреть файл

@ -0,0 +1,49 @@
# --------------------------------------------------------------------------
# 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.
#
# Generation mode: Incremental
# --------------------------------------------------------------------------
from azure.cli.core import AzCommandsLoader
import azext_mixed_reality._help # pylint: disable=unused-import
class MixedRealityCommandsLoader(AzCommandsLoader):
def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
custom_command_type = CliCommandType(operations_tmpl='azext_mixed_reality.custom#{}')
super(MixedRealityCommandsLoader, self).__init__(cli_ctx=cli_ctx, custom_command_type=custom_command_type) # pylint: disable=line-too-long
def load_command_table(self, args):
from .commands import load_command_table
load_command_table(self, args)
try:
from .generated.commands import load_command_table as load_command_table_generated
load_command_table_generated(self, args)
from .manual.commands import load_command_table as load_command_table_manual
load_command_table_manual(self, args)
except ImportError:
pass
return self.command_table
def load_arguments(self, command):
from ._params import load_arguments
load_arguments(self, command)
try:
from .generated._params import load_arguments as load_arguments_generated
load_arguments_generated(self, command)
from .manual._params import load_arguments as load_arguments_manual
load_arguments_manual(self, command)
except ImportError:
pass
COMMAND_LOADER_CLS = MixedRealityCommandsLoader

Просмотреть файл

@ -0,0 +1,14 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
def mixed_reality_client_factory(cli_ctx):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from azext_mixed_reality.vendored_sdks.mixedreality.mixed_reality_client import MixedRealityClient
return get_mgmt_service_client(cli_ctx, MixedRealityClient, subscription_bound=True)
def spatial_anchors_account_factory(cli_ctx, _):
return mixed_reality_client_factory(cli_ctx).spatial_anchors_accounts

Просмотреть файл

@ -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.
#
# Generation mode: Incremental
# --------------------------------------------------------------------------
try:
from .generated._help import helps # pylint: disable=reimported
from .manual._help import helps # pylint: disable=reimported
except ImportError:
pass
from knack.help_files import helps
helps['spatial-anchors-account'] = """
type: group
short-summary: Manage Spatial Anchors Accounts.
"""
helps['spatial-anchors-account list'] = """
type: command
short-summary: List Spatial Anchors Accounts.
examples:
- name: List all Spatial Anchors Accounts in Resource Group 'example'.
text: az spatial-anchors-account list -g example
- name: List all Spatial Anchors Accounts in current Subscription.
text: az spatial-anchors-account list
"""
helps['spatial-anchors-account create'] = """
type: command
short-summary: Create a Spatial Anchors Account.
examples:
- name: Create a Spatial Anchors Account.
text: az spatial-anchors-account create -g example -n example -l eastus2
- name: Create a Spatial Anchors Account without Location specified.
text: az spatial-anchors-account create -g example -n example
"""
helps['spatial-anchors-account show'] = """
type: command
short-summary: Show a Spatial Anchors Account.
examples:
- name: Show properties of a Spatial Anchors Account.
text: az spatial-anchors-account show -g example -n example
"""
helps['spatial-anchors-account delete'] = """
type: command
short-summary: Delete a Spatial Anchors Account.
examples:
- name: Delete of a Spatial Anchors Account.
text: az spatial-anchors-account delete -g example -n example
"""
helps['spatial-anchors-account key'] = """
type: group
short-summary: Manage developer keys of a Spatial Anchors Account.
"""
helps['spatial-anchors-account key show'] = """
type: command
short-summary: Show keys of a Spatial Anchors Account.
examples:
- name: Show primary key and secondary key of a Spatial Anchors Account.
text: az spatial-anchors-account key show -g example -n example
"""
helps['spatial-anchors-account key renew'] = """
type: command
short-summary: Renew one of the keys of a Spatial Anchors Account.
examples:
- name: Renew primary key of a Spatial Anchors Account.
text: az spatial-anchors-account key renew -g example -n example -k primary
- name: Renew secondary key of a Spatial Anchors Account.
text: az spatial-anchors-account key renew -g example -n example -k secondary
"""

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше