Skip to content

Commit 648b51e

Browse files
committed
fix: virtualMachine null fields
1 parent 2c7dbea commit 648b51e

File tree

3 files changed

+42
-19
lines changed

3 files changed

+42
-19
lines changed

src/services/virtualMachine/format.ts

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,29 @@ export default ({
1818
id,
1919
name,
2020
type,
21+
vmId,
2122
diagnosticsProfile: {
2223
bootDiagnostics: { enabled: bootDiagnostics = false } = {},
2324
} = {},
24-
osProfile: { adminUsername, adminPassword, secrets, ...restOsProfile } = {},
25+
osProfile: {
26+
computerName,
27+
windowsConfiguration: {
28+
provisionVMAgent: wProvisionVMAgent,
29+
enableAutomaticUpdates,
30+
timeZone,
31+
} = {},
32+
linuxConfiguration: {
33+
disablePasswordAuthentication,
34+
provisionVMAgent: lProvisionVMAgent,
35+
} = {},
36+
allowExtensionOperations,
37+
requireGuestProvisionSignal,
38+
} = {},
2539
storageProfile: { imageReference } = {},
2640
licenseType,
2741
resourceGroupId,
2842
Tags,
2943
} = service
30-
const {
31-
linuxConfiguration: {
32-
patchSettings: lps,
33-
ssh: lssh,
34-
...linuxConfiguration
35-
} = {},
36-
windowsConfiguration: { patchSettings: wps, ...windowsConfiguration } = {},
37-
...osProfile
38-
} = restOsProfile
3944
const storageImageReference: AzureVirtualMachineStorageImageReference =
4045
imageReference || {}
4146
return {
@@ -44,7 +49,21 @@ export default ({
4449
name,
4550
type,
4651
region,
47-
osProfile: { linuxConfiguration, windowsConfiguration, ...osProfile },
52+
vmId,
53+
osProfile: {
54+
computerName,
55+
windowsConfiguration: {
56+
provisionVMAgent: wProvisionVMAgent,
57+
enableAutomaticUpdates,
58+
timeZone,
59+
},
60+
linuxConfiguration: {
61+
disablePasswordAuthentication,
62+
provisionVMAgent: lProvisionVMAgent,
63+
},
64+
allowExtensionOperations,
65+
requireGuestProvisionSignal,
66+
},
4867
storageImageReference,
4968
bootDiagnostics,
5069
licenseType,

src/services/virtualMachine/schema.graphql

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,21 @@ type azureVirtualMachineStorageImageReference
4646
sharedGalleryImageId: String @search(by: [hash, regexp])
4747
}
4848

49-
type azureVirtualMachine implements azureResource
49+
type azureVirtualMachine implements azureBaseResource
5050
@key(fields: "id")
5151
@generate(
5252
query: { get: true, query: true, aggregate: true }
5353
mutation: { add: true, delete: false }
5454
) {
55-
managedBy: String @search(by: [hash, regexp])
56-
vmSize: String @search(by: [hash, regexp])
55+
vmId: String @search(by: [hash, regexp])
56+
subscriptionId: String @search(by: [hash, regexp])
57+
region: String @search(by: [hash, regexp])
58+
resourceGroupId: String @search(by: [hash, regexp])
5759
osProfile: azureVirtualMachineOSProfile
58-
osType: String @search(by: [hash, regexp])
5960
storageImageReference: azureVirtualMachineStorageImageReference
6061
bootDiagnostics: Boolean @search
6162
licenseType: String @search(by: [hash, regexp])
63+
tags: [azureRawTag]
6264
disks: [azureDisk] @hasInverse(field: virtualMachine)
6365
networkInterfaces: [azureNetworkInterface] @hasInverse(field: virtualMachines)
6466
virtualNetworks: [azureVirtualNetwork] @hasInverse(field: virtualMachines)

src/types/generated.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5113,18 +5113,20 @@ export type AzureVaultSecretGroup = {
51135113
vaultCertificates?: Maybe<Array<Maybe<AzureVaultCertificate>>>;
51145114
};
51155115

5116-
export type AzureVirtualMachine = AzureResource & {
5116+
export type AzureVirtualMachine = AzureBaseResource & {
51175117
bootDiagnostics?: Maybe<Scalars['Boolean']>;
51185118
disks?: Maybe<Array<Maybe<AzureDisk>>>;
51195119
licenseType?: Maybe<Scalars['String']>;
5120-
managedBy?: Maybe<Scalars['String']>;
51215120
networkInterfaces?: Maybe<Array<Maybe<AzureNetworkInterface>>>;
51225121
osProfile?: Maybe<AzureVirtualMachineOsProfile>;
5123-
osType?: Maybe<Scalars['String']>;
5122+
region?: Maybe<Scalars['String']>;
51245123
resourceGroup?: Maybe<Array<Maybe<AzureResourceGroup>>>;
5124+
resourceGroupId?: Maybe<Scalars['String']>;
51255125
storageImageReference?: Maybe<AzureVirtualMachineStorageImageReference>;
5126+
subscriptionId?: Maybe<Scalars['String']>;
5127+
tags?: Maybe<Array<Maybe<AzureRawTag>>>;
51265128
virtualNetworks?: Maybe<Array<Maybe<AzureVirtualNetwork>>>;
5127-
vmSize?: Maybe<Scalars['String']>;
5129+
vmId?: Maybe<Scalars['String']>;
51285130
};
51295131

51305132
export type AzureVirtualMachineOsProfile = {

0 commit comments

Comments
 (0)