* WIP updating models to include new properties after data plane version update

* Finish adding properties for dataplane api update

* Small fix

* Update VMExtension model and add in type definition for JSON
This commit is contained in:
Rena 2023-10-13 16:29:42 -07:00 коммит произвёл Shiran Pasternak
Родитель 82b3e71ba5
Коммит 4619bd040d
22 изменённых файлов: 203 добавлений и 3 удалений

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

@ -198,7 +198,10 @@ class SwaggerModelValidator {
this.addPropertyError(name, e.message);
}
}
} else if (swaggerType === "object") {
if (type !== Object) {
this.addPropertyError(name, `Expected type to be an object but was ${type}`);
}
} else {
console.log("Property", this.modelName, name, swaggerProperty, metadata[name]);
process.exit(1);

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

@ -26,6 +26,8 @@ export interface JobAttributes {
previousState: JobState;
previousStateTransitionTime: Date;
priority: number;
allowTaskPreemption: boolean;
maxParallelTasks: number;
onAllTasksComplete: AllTasksCompleteAction;
onTaskFailure: TaskFailureAction;
@ -58,6 +60,8 @@ export class Job extends Record<JobAttributes> implements NavigableRecord {
@Prop() public previousState: JobState;
@Prop() public previousStateTransitionTime: Date;
@Prop() public priority: number;
@Prop() public allowTaskPreemption: boolean;
@Prop() public maxParallelTasks: number;
@Prop() public onAllTasksComplete: AllTasksCompleteAction = AllTasksCompleteAction.noaction;
@Prop() public onTaskFailure: TaskFailureAction = TaskFailureAction.noaction;

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

@ -9,6 +9,7 @@ import {
} from "./compute-node-endpoint-configuration";
import { ComputeNodeError, ComputeNodeErrorAttributes } from "./compute-node-error";
import { NodeAgentInformation, NodeAgentInformationAttributes } from "./node-agent-information";
import { VirtualMachineInfo } from "app/models/virtual-machine-info";
export interface NodeAttributes {
id: string;
@ -34,6 +35,7 @@ export interface NodeAttributes {
errors: ComputeNodeErrorAttributes[];
nodeAgentInfo: NodeAgentInformationAttributes;
endpointConfiguration: ComputeNodeEndpointConfigurationAttributes;
virtualMachineInfo: VirtualMachineInfo;
}
/**
@ -61,6 +63,7 @@ export class Node extends Record<NodeAttributes> {
@Prop() public startTask: StartTask;
@Prop() public nodeAgentInfo: NodeAgentInformation;
@Prop() public endpointConfiguration: ComputeNodeEndpointConfiguration;
@Prop() public virtualMachineInfo: VirtualMachineInfo;
@ListProp(NodeRecentTask) public recentTasks: List<NodeRecentTask> = List([]);
@ListProp(CertificateReference) public certificateReferences: List<CertificateReference> = List([]);

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

@ -20,6 +20,8 @@ import { List } from "immutable";
import { Duration } from "luxon";
import { AutoScaleRun, AutoScaleRunAttributes } from "./auto-scale-run";
import { PoolStatistics, PoolStatisticsAttributes } from "./pool-statistics";
import { NodeCommunicationMode } from "app/models/node-communication-mode";
import { BatchPoolIdentity } from "app/models/batch-pool-identity";
export enum OSType {
Windows = "windows",
@ -57,8 +59,11 @@ export interface PoolAttributes {
metadata: MetadataAttributes[];
userAccounts: UserAccountAttributes[];
applicationLicenses: string[];
targetNodeCommunicationMode: NodeCommunicationMode;
autoScaleRun: AutoScaleRunAttributes;
stats: PoolStatisticsAttributes;
identity: BatchPoolIdentity;
currentNodeCommunicationMode: NodeCommunicationMode;
}
/**
@ -134,6 +139,8 @@ export class Pool extends Record<PoolAttributes> implements NavigableRecord {
@ListProp(String) public applicationLicenses: List<string> = List([]);
@Prop() public targetNodeCommunicationMode: NodeCommunicationMode;
/**
* Tags are computed from the metadata using an internal key
*/
@ -143,6 +150,10 @@ export class Pool extends Record<PoolAttributes> implements NavigableRecord {
@Prop() public stats: PoolStatistics;
@Prop() public identity: BatchPoolIdentity;
@Prop() public currentNodeCommunicationMode: NodeCommunicationMode;
/**
* Computed field sum of dedicated and low pri nodes
*/

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

@ -0,0 +1,28 @@
import { ListProp, Model, Prop, Record } from "@batch-flask/core";
import { List } from "immutable";
export interface UserAssignedIdentityAttributes {
resourceId: string;
clientId: string;
principalId: string;
}
export interface BatchPoolIdentityAttributes {
type: string;
userAssignedIdentities: List<UserAssignedIdentity>;
}
@Model()
export class UserAssignedIdentity extends Record<UserAssignedIdentityAttributes> {
@Prop() resourceId: string;
@Prop() clientId: string;
@Prop() principalId: string;
}
@Model()
export class BatchPoolIdentity extends Record<BatchPoolIdentityAttributes> {
@Prop() type: string;
@ListProp(UserAssignedIdentity) public userAssignedIdentities: List<UserAssignedIdentity>;
}

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

@ -0,0 +1,13 @@
import { Model, Prop, Record } from "@batch-flask/core";
export interface ComputeNodeIdentityReferenceAttributes {
resourceId: string;
}
/**
* The reference to a user assigned identity associated with the Batch pool which a compute node will use.
*/
@Model()
export class ComputeNodeIdentityReference extends Record<ComputeNodeIdentityReferenceAttributes> {
@Prop() public resourceId: string;
}

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

@ -1,5 +1,6 @@
import { ListProp, Model, Prop, Record } from "@batch-flask/core";
import { List } from "immutable";
import { ComputeNodeIdentityReference } from "./compute-node-identity-reference";
export enum ContainerType {
DockerCompatible = "dockerCompatible",
@ -15,6 +16,7 @@ export interface ContainerRegistryAttributes {
username: string;
password: string;
registryServer: string;
identityReference: ComputeNodeIdentityReference;
}
export interface TaskContainerSettingsAttributes {
@ -29,6 +31,7 @@ export class ContainerRegistry extends Record<ContainerRegistryAttributes> {
@Prop() public username: string;
@Prop() public password: string;
@Prop() public registryServer: string;
@Prop() public identityReference: ComputeNodeIdentityReference;
}
@Model()

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

@ -1,7 +1,9 @@
import { Dto, DtoAttr } from "@batch-flask/core";
import { ComputeNodeIdentityReference } from "../compute-node-identity-reference";
export class ContainerRegistryDto extends Dto<ContainerRegistryDto> {
@DtoAttr() public username: string;
@DtoAttr() public password: string;
@DtoAttr() public registryServer: string;
identityReference: ComputeNodeIdentityReference;
}

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

@ -0,0 +1,12 @@
import { Model, Prop, Record } from "@batch-flask/core";
export interface HttpHeaderAttributes {
name: string;
value: string;
}
@Model()
export class HttpHeader extends Record<HttpHeaderAttributes> {
@Prop() public name: string;
@Prop() public value: string;
}

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

@ -24,4 +24,5 @@ export class ImageReference extends Record<ImageReferenceAttributes> {
@Prop() public sku: string;
@Prop() public version: string;
@Prop() public virtualMachineImageId: string;
@Prop() public exactVersion: string;
}

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

@ -13,6 +13,7 @@ export * from "./auto-user";
export * from "./autoscale-formula";
export * from "./azure-batch";
export * from "./batch-account";
export * from "./batch-pool-identity";
export * from "./batch-software-license";
export * from "./blob-container";
export * from "./certificate-reference";
@ -20,9 +21,11 @@ export * from "./certificate";
export * from "./cloud-service-configuration";
export * from "./container-lease";
export * from "./container-setup";
export * from "./compute-node-identity-reference";
export * from "./disk-encryption-configuration";
export * from "./failure-info";
export * from "./file-type";
export * from "./http-header";
export * from "./image-reference";
export * from "./job-action";
export * from "./job-constraints";
@ -47,9 +50,12 @@ export * from "./name-value-pair";
export * from "./ncj-job-template";
export * from "./network-configuration";
export * from "./image-information";
export * from "./node-communication-mode";
export * from "./node-connection-settings";
export * from "./node-placement-configuration";
export * from "./node-recent-task";
export * from "./node-user";
export * from "./os-disk";
export * from "./pool-endpoint-configuration";
export * from "./pool-os-skus";
export * from "./public-ip-address-configuration";
@ -80,6 +86,8 @@ export * from "./tenant-details";
export * from "./user-account";
export * from "./user-identity";
export * from "./virtual-machine-configuration";
export * from "./virtual-machine-info";
export * from "./vm-extension";
export * from "./vm-size";
export * from "./windows-configuration";
export * from "./workspace-definition";

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

@ -15,6 +15,7 @@ export interface NetworkConfigurationAttributes {
endpointConfiguration: PoolEndpointConfigurationAttributes;
dynamicVNetAssignmentScope: DynamicVNetAssignmentScope;
publicIPAddressConfiguration: PublicIPAddressConfigurationAttributes;
enableAcceleratedNetworking: boolean;
}
/**
@ -26,4 +27,5 @@ export class NetworkConfiguration extends Record<NetworkConfigurationAttributes>
@Prop() public endpointConfiguration: PoolEndpointConfiguration;
@Prop() public dynamicVNetAssignmentScope: DynamicVNetAssignmentScope = DynamicVNetAssignmentScope.None;
@Prop() public publicIPAddressConfiguration: PublicIPAddressConfiguration;
@Prop() public enableAcceleratedNetworking: boolean;
}

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

@ -0,0 +1,5 @@
export enum NodeCommunicationMode {
default = "default",
classic = "classic",
simplified = "simplified",
}

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

@ -0,0 +1,18 @@
import { Model, Prop, Record } from "@batch-flask/core";
export interface NodePlacementConfigurationAttributes {
policy: NodePlacementPolicyType;
}
/**
* Class for displaying Batch WindowsConfiguration information.
*/
@Model()
export class NodePlacementConfiguration extends Record<NodePlacementConfigurationAttributes> {
@Prop() public policy: NodePlacementPolicyType;
}
export enum NodePlacementPolicyType {
regional = "regional",
zonal = "zonal",
}

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

@ -0,0 +1,23 @@
import { Model, Prop, Record } from "@batch-flask/core";
export interface OSDiskAttributes {
ephemeralOSDiskSettings: DiffDiskSettings;
}
export interface DiffDiskSettingsAttributes {
placement: DiffDiskPlacement;
}
export enum DiffDiskPlacement {
CacheDisk = "CacheDisk",
}
@Model()
export class DiffDiskSettings extends Record<DiffDiskSettingsAttributes> {
@Prop() public placement: DiffDiskPlacement;
}
@Model()
export class OSDisk extends Record<OSDiskAttributes> {
@Prop() public ephemeralOSDiskSettings: DiffDiskSettings;
}

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

@ -1,4 +1,5 @@
import { Model, Prop, Record } from "@batch-flask/core";
import { ComputeNodeIdentityReference } from "./compute-node-identity-reference";
export interface ResourceFileAttributes {
autoStorageContainerName?: string;
@ -7,6 +8,7 @@ export interface ResourceFileAttributes {
storageContainerUrl?: string;
filePath: string;
fileMode?: string;
identityReference?: ComputeNodeIdentityReference;
}
/**
@ -26,6 +28,8 @@ export class ResourceFile extends Record<ResourceFileAttributes> {
@Prop() public fileMode: string;
@Prop() public identityReference: ComputeNodeIdentityReference;
public get id() {
return this.filePath;
}

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

@ -1,4 +1,7 @@
import { Model, Prop, Record } from "@batch-flask/core";
import { ListProp, Model, Prop, Record } from "@batch-flask/core";
import { ComputeNodeIdentityReference } from "./compute-node-identity-reference";
import { List } from "immutable";
import { HttpHeader } from "./http-header";
export interface TaskOutputFileAttributes {
filePattern: string;
@ -17,6 +20,8 @@ export interface TaskOutputFileUploadOptionsAttributes {
export interface TaskOutputFileContainerAttributes {
path?: string;
containerUrl: string;
identityReference: ComputeNodeIdentityReference;
uploadHeaders: List<HttpHeader>;
}
export enum TaskOutputFileUploadCondition {
@ -29,6 +34,8 @@ export enum TaskOutputFileUploadCondition {
export class TaskOutputFileContainer extends Record<TaskOutputFileContainerAttributes> {
@Prop() public path: string;
@Prop() public containerUrl: string;
@Prop() public identityReference: ComputeNodeIdentityReference;
@ListProp(HttpHeader) public uploadHeaders: List<HttpHeader>;
}
@Model()

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

@ -5,6 +5,9 @@ import { ContainerConfiguration, ContainerConfigurationAttributes } from "./cont
import { DiskEncryptionConfiguration, DiskEncryptionConfigurationAttributes } from "./disk-encryption-configuration";
import { ImageReference, ImageReferenceAttributes } from "./image-reference";
import { WindowsConfiguration } from "./windows-configuration";
import { NodePlacementConfiguration } from "./node-placement-configuration";
import { VMExtension } from "./vm-extension";
import { OSDisk } from "./os-disk";
export interface VirtualMachineConfigurationAttributes {
diskEncryptionConfiguration: DiskEncryptionConfigurationAttributes;
@ -12,6 +15,9 @@ export interface VirtualMachineConfigurationAttributes {
nodeAgentSKUId: string;
windowsConfiguration: WindowsConfiguration;
containerConfiguration: ContainerConfigurationAttributes;
nodePlacementConfiguration: NodePlacementConfiguration;
extensions: List<VMExtension>;
osDisk: OSDisk;
}
/**
@ -24,6 +30,9 @@ export class VirtualMachineConfiguration extends Record<VirtualMachineConfigurat
@Prop() public nodeAgentSKUId: string;
@Prop() public windowsConfiguration: WindowsConfiguration;
@Prop() public containerConfiguration: ContainerConfiguration;
@Prop() public nodePlacementConfiguration: NodePlacementConfiguration;
@Prop() public licenseType: string;
@Prop() public osDisk: OSDisk;
@ListProp(DataDisk) public dataDisks: List<DataDisk>;
@ListProp(VMExtension) public extensions: List<VMExtension>;
}

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

@ -0,0 +1,11 @@
import { Model, Prop, Record } from "@batch-flask/core";
import { ImageReference } from "./image-reference";
export interface VirtualMachineInfoAttributes {
imageReference: ImageReference;
}
@Model()
export class VirtualMachineInfo extends Record<VirtualMachineInfoAttributes> {
@Prop() imageReference: ImageReference;
}

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

@ -0,0 +1,28 @@
import { JsonObject } from "@azure/bonito-core";
import { ListProp, Model, Prop, Record } from "@batch-flask/core";
import { List } from "immutable";
export interface VMExtensionAttributes {
name: string,
publisher: string,
type: string,
typeHandlerVersion: string,
autoUpgradeMinorVersion: boolean,
enableAutomaticUpgrade: boolean,
settings: JsonObject,
protectedSettings: JsonObject,
provisionAfterExtensions: string[],
}
@Model()
export class VMExtension extends Record<VMExtensionAttributes> {
@Prop() public name: string;
@Prop() public publisher: string;
@Prop() public type: string;
@Prop() public typeHandlerVersion: string;
@Prop() public autoUpgradeMinorVersion: boolean;
@Prop() public enableAutomaticUpgrade: boolean;
@Prop() public settings: JsonObject;
@Prop() public protectedSettings: JsonObject;
@ListProp(String) public provisionAfterExtensions: List<string>;
}

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

@ -113,7 +113,7 @@ export const ApiVersion = {
network: "2017-10-01",
classicNetwork: "2015-12-01",
consumption: "2018-10-01",
batchService: "2020-09-01.12.0",
batchService: "2023-05-01.17.0",
costManagement: "2019-01-01",
};

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

@ -1,3 +1,8 @@
export type JsonValue = JsonPrimitive | JsonArray | JsonObject;
export type JsonPrimitive = string | boolean | number | undefined | null;
export type JsonObject = { [key: string]: JsonValue };
export type JsonArray = JsonValue[];
export type Mutable<T> = {
-readonly [K in keyof T]: T[K];
};