Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP feat(overhaul): Node google admin overhaul #12271

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ const scopes = [
'https://www.googleapis.com/auth/admin.directory.user',
'https://www.googleapis.com/auth/admin.directory.domain.readonly',
'https://www.googleapis.com/auth/admin.directory.userschema.readonly',
'https://www.googleapis.com/auth/admin.directory.device.chromeos',
'https://www.googleapis.com/auth/admin.directory.orgunit.readonly',
];

export class GSuiteAdminOAuth2Api implements ICredentialType {
Expand Down
300 changes: 300 additions & 0 deletions packages/nodes-base/nodes/Google/GSuiteAdmin/DeviceDescription.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,300 @@
import type { INodeProperties } from 'n8n-workflow';

export const deviceOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['device'],
},
},
options: [
{
name: 'Get',
value: 'get',
description: 'Get a device',
action: 'Get a device',
},
{
name: 'Get Many',
value: 'getAll',
description: 'Get many devices',
action: 'Get many devices',
},
{
name: 'Update',
value: 'update',
description: 'Update a device',
action: 'Update a device',
},
{
name: 'Change Status',
value: 'changeStatus',
description: 'Change the Status of a Chromebook',
action: 'Set the status of a device',
},
],
default: 'get',
},
];

export const deviceFields: INodeProperties[] = [
/* -------------------------------------------------------------------------- */
/* device:get */
/* -------------------------------------------------------------------------- */
{
displayName: 'UUID',
name: 'uuid',
type: 'string',
required: true,
displayOptions: {
show: {
operation: ['get', 'update', 'changeStatus'],
resource: ['device'],
},
},
default: '',
},
/* -------------------------------------------------------------------------- */
/* device:getAll */
/* -------------------------------------------------------------------------- */
{
displayName: 'Return All?',
name: 'returnAll',
type: 'boolean',
default: false,
// eslint-disable-next-line n8n-nodes-base/node-param-description-boolean-without-whether
description: 'Whether to return all results or only up to a given limit',
displayOptions: {
show: {
operation: ['getAll'],
resource: ['device'],
},
},
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
operation: ['getAll'],
resource: ['device'],
returnAll: [false],
},
},
typeOptions: {
minValue: 1,
maxValue: 500,
},
default: 100,
description: 'Max number of results to return',
},
{
displayName: 'Projection',
name: 'projection',
type: 'options',
required: true,
options: [
{
name: 'Basic',
value: 'basic',
description: 'Do not include any custom fields for the user',
},
{
name: 'Full',
value: 'full',
description: 'Include all fields associated with this user',
},
],
displayOptions: {
show: {
operation: ['get', 'getAll', 'update'],
resource: ['device'],
},
},
default: 'basic',
description: 'What subset of fields to fetch for this device',
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
operation: ['getAll'],
resource: ['device'],
},
},
options: [
{
displayName: 'Organizational Unit Name or ID',
name: 'orgUnitPath',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getOrgUnits',
},
default: [],
description:
'A comma-separated list of schema names. All fields from these schemas are fetched. This should only be set when projection=custom. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName: 'Include Children?',
name: 'includeChildOrgunits',
type: 'boolean',
default: false,
// eslint-disable-next-line n8n-nodes-base/node-param-description-boolean-without-whether
description:
'Include devices from organizational units below your specified organizational unit',
},
{
displayName: 'Order By',
name: 'orderBy',
type: 'options',
options: [
{
name: 'Annotated Location',
value: 'annotatedLocation',
},
{
name: 'Annotated User',
value: 'annotatedUser',
},
{
name: 'Last Sync',
value: 'lastSync',
},
{
name: 'Notes',
value: 'notes',
},
{
name: 'Serial Number',
value: 'serialNumber',
},
{
name: 'Status',
value: 'status',
},
{
name: 'Support End Date',
value: 'supportEndDate',
},
],
default: '',
description: 'Property to use for sorting results',
},
{
displayName: 'Sort By',
name: 'sortBy',
type: 'options',
options: [
{
name: 'Ascending',
value: 'ascending',
},
{
name: 'Descending',
value: 'descending',
},
],
default: '',
description: 'Property to use for sorting results. Must accompany Order By variable.',
},
{
displayName: 'Query',
name: 'query',
type: 'string',
default: '',
description: "Must use Google's querying syntax",
},
],
},
{
displayName: 'Update Fields',
name: 'updateOptions',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
operation: ['update'],
resource: ['device'],
},
},
options: [
{
displayName: 'Move to Organizational Unit Name or ID',
name: 'orgUnitPath',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getOrgUnits',
},
default: [],
description:
'A comma-separated list of schema names. All fields from these schemas are fetched. This should only be set when projection=custom. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName: 'Annotated User',
name: 'annotatedUser',
type: 'string',
default: '',
description: 'The annotated User of the device',
},
{
displayName: 'Annotated Location',
name: 'annotatedLocation',
type: 'string',
default: '',
description: 'The annotated Location of the device',
},
{
displayName: 'Annotated Asset ID',
name: 'annotatedAssetId',
type: 'string',
default: '',
description: 'The annotated Asset ID of a device',
},
{
displayName: 'Notes',
name: 'notes',
type: 'string',
default: '',
description: 'Add notes to a device',
},
],
},
{
displayName: 'Action',
name: 'action',
type: 'options',
required: true,
options: [
{
name: 'Enable',
value: 'reenable',
description: 'Re-enable a disabled chromebook',
action: 'Enable a device',
},
{
name: 'Disable',
value: 'disable',
description: 'Disable a chromebook',
action: 'Disable a device',
},
],
displayOptions: {
show: {
operation: ['changeStatus'],
resource: ['device'],
},
},
default: 'Enable',
description: 'Set the status of a device',
},
];
Loading
Loading