Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
martinlingstuyl committed Dec 15, 2023
1 parent 1335198 commit a73649f
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 41 deletions.
2 changes: 1 addition & 1 deletion src/Auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ export class Auth {
}

if (resource === 'https://api.flow.microsoft.com') {
resource = 'https://management.azure.com';
resource = 'https://management.azure.com/';
}

if (resource === 'https://api.powerbi.com') {
Expand Down
4 changes: 2 additions & 2 deletions src/m365/flow/commands/flow-disable.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ describe(commands.DISABLE, () => {
});

await command.action(logger, { options: { debug: true, name: '3989cb59-ce1a-4a5c-bb78-257c5c39381d', environmentName: 'Default-d87a7535-dd31-4437-bfe1-95340acd55c5' } });
assert.strictEqual(postStub.lastCall.args[0].url, 'https://management.azure.com/providers/Microsoft.ProcessSimple/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5/flows/3989cb59-ce1a-4a5c-bb78-257c5c39381d/stop?api-version=2016-11-01');
assert.strictEqual(postStub.lastCall.args[0].url, 'https://api.flow.microsoft.com/providers/Microsoft.ProcessSimple/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5/flows/3989cb59-ce1a-4a5c-bb78-257c5c39381d/stop?api-version=2016-11-01');
});

it('disables the specified flow as admin', async () => {
Expand All @@ -81,7 +81,7 @@ describe(commands.DISABLE, () => {
});

await assert.rejects(command.action(logger, { options: { name: '3989cb59-ce1a-4a5c-bb78-257c5c39381d', environmentName: 'Default-d87a7535-dd31-4437-bfe1-95340acd55c5', asAdmin: true } }));
assert.strictEqual(postStub.lastCall.args[0].url, 'https://management.azure.com/providers/Microsoft.ProcessSimple/scopes/admin/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5/flows/3989cb59-ce1a-4a5c-bb78-257c5c39381d/stop?api-version=2016-11-01');
assert.strictEqual(postStub.lastCall.args[0].url, 'https://api.flow.microsoft.com/providers/Microsoft.ProcessSimple/scopes/admin/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5/flows/3989cb59-ce1a-4a5c-bb78-257c5c39381d/stop?api-version=2016-11-01');
});

it('correctly handles no environment found', async () => {
Expand Down
6 changes: 3 additions & 3 deletions src/m365/flow/commands/flow-disable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Logger } from '../../../cli/Logger.js';
import GlobalOptions from '../../../GlobalOptions.js';
import request, { CliRequestOptions } from '../../../request.js';
import { formatting } from '../../../utils/formatting.js';
import AzmgmtCommand from '../../base/AzmgmtCommand.js';
import PowerAutomateCommand from '../../base/PowerAutomateCommand.js';
import commands from '../commands.js';

interface CommandArgs {
Expand All @@ -15,7 +15,7 @@ interface Options extends GlobalOptions {
asAdmin: boolean;
}

class FlowDisableCommand extends AzmgmtCommand {
class FlowDisableCommand extends PowerAutomateCommand {
public get name(): string {
return commands.DISABLE;
}
Expand Down Expand Up @@ -59,7 +59,7 @@ class FlowDisableCommand extends AzmgmtCommand {
}

const requestOptions: CliRequestOptions = {
url: `${this.resource}providers/Microsoft.ProcessSimple/${args.options.asAdmin ? 'scopes/admin/' : ''}environments/${formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting.encodeQueryParameter(args.options.name)}/stop?api-version=2016-11-01`,
url: `${this.resource}/providers/Microsoft.ProcessSimple/${args.options.asAdmin ? 'scopes/admin/' : ''}environments/${formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting.encodeQueryParameter(args.options.name)}/stop?api-version=2016-11-01`,
headers: {
accept: 'application/json'
},
Expand Down
4 changes: 2 additions & 2 deletions src/m365/flow/commands/flow-enable.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe(commands.ENABLE, () => {
});

await command.action(logger, { options: { debug: true, name: '3989cb59-ce1a-4a5c-bb78-257c5c39381d', environmentName: 'Default-d87a7535-dd31-4437-bfe1-95340acd55c5' } });
assert.strictEqual(postStub.lastCall.args[0].url, 'https://management.azure.com/providers/Microsoft.ProcessSimple/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5/flows/3989cb59-ce1a-4a5c-bb78-257c5c39381d/start?api-version=2016-11-01');
assert.strictEqual(postStub.lastCall.args[0].url, 'https://api.flow.microsoft.com/providers/Microsoft.ProcessSimple/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5/flows/3989cb59-ce1a-4a5c-bb78-257c5c39381d/start?api-version=2016-11-01');
});

it('enables the specified flow as admin', async () => {
Expand All @@ -82,7 +82,7 @@ describe(commands.ENABLE, () => {
});

await assert.rejects(command.action(logger, { options: { name: '3989cb59-ce1a-4a5c-bb78-257c5c39381d', environmentName: 'Default-d87a7535-dd31-4437-bfe1-95340acd55c5', asAdmin: true } }));
assert.strictEqual(postStub.lastCall.args[0].url, 'https://management.azure.com/providers/Microsoft.ProcessSimple/scopes/admin/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5/flows/3989cb59-ce1a-4a5c-bb78-257c5c39381d/start?api-version=2016-11-01');
assert.strictEqual(postStub.lastCall.args[0].url, 'https://api.flow.microsoft.com/providers/Microsoft.ProcessSimple/scopes/admin/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5/flows/3989cb59-ce1a-4a5c-bb78-257c5c39381d/start?api-version=2016-11-01');
});

it('correctly handles no environment found', async () => {
Expand Down
6 changes: 3 additions & 3 deletions src/m365/flow/commands/flow-enable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Logger } from '../../../cli/Logger.js';
import GlobalOptions from '../../../GlobalOptions.js';
import request, { CliRequestOptions } from '../../../request.js';
import { formatting } from '../../../utils/formatting.js';
import AzmgmtCommand from '../../base/AzmgmtCommand.js';
import PowerAutomateCommand from '../../base/PowerAutomateCommand.js';
import commands from '../commands.js';

interface CommandArgs {
Expand All @@ -15,7 +15,7 @@ interface Options extends GlobalOptions {
asAdmin: boolean;
}

class FlowEnableCommand extends AzmgmtCommand {
class FlowEnableCommand extends PowerAutomateCommand {
public get name(): string {
return commands.ENABLE;
}
Expand Down Expand Up @@ -59,7 +59,7 @@ class FlowEnableCommand extends AzmgmtCommand {
}

const requestOptions: CliRequestOptions = {
url: `${this.resource}providers/Microsoft.ProcessSimple/${args.options.asAdmin ? 'scopes/admin/' : ''}environments/${formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting.encodeQueryParameter(args.options.name)}/start?api-version=2016-11-01`,
url: `${this.resource}/providers/Microsoft.ProcessSimple/${args.options.asAdmin ? 'scopes/admin/' : ''}environments/${formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting.encodeQueryParameter(args.options.name)}/start?api-version=2016-11-01`,
headers: {
accept: 'application/json'
},
Expand Down
22 changes: 11 additions & 11 deletions src/m365/flow/commands/flow-get.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ describe(commands.GET, () => {
"userId": "da8f7aea-cf43-497f-ad62-c2feae89a194",
"userType": "ActiveDirectory"
},
"flowTriggerUri": "https://management.azure.com:443/providers/Microsoft.ProcessSimple/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5/flows/3989cb59-ce1a-4a5c-bb78-257c5c39381d/triggers/Every_day/run?api-version=2016-11-01",
"flowTriggerUri": "https://api.flow.microsoft.com:443/providers/Microsoft.ProcessSimple/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5/flows/3989cb59-ce1a-4a5c-bb78-257c5c39381d/triggers/Every_day/run?api-version=2016-11-01",
"installationStatus": "Installed",
"provisioningMethod": "FromDefinition",
"flowFailureAlertSubscribed": true,
Expand Down Expand Up @@ -1435,7 +1435,7 @@ describe(commands.GET, () => {
"userId": "da8f7aea-cf43-497f-ad62-c2feae89a194",
"userType": "ActiveDirectory"
},
"flowTriggerUri": "https://management.azure.com:443/providers/Microsoft.ProcessSimple/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5/flows/3989cb59-ce1a-4a5c-bb78-257c5c39381d/triggers/Every_day/run?api-version=2016-11-01",
"flowTriggerUri": "https://api.flow.microsoft.com:443/providers/Microsoft.ProcessSimple/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5/flows/3989cb59-ce1a-4a5c-bb78-257c5c39381d/triggers/Every_day/run?api-version=2016-11-01",
"installationStatus": "Installed",
"provisioningMethod": "FromDefinition",
"flowFailureAlertSubscribed": true,
Expand Down Expand Up @@ -2130,7 +2130,7 @@ describe(commands.GET, () => {
"userId": "da8f7aea-cf43-497f-ad62-c2feae89a194",
"userType": "ActiveDirectory"
},
"flowTriggerUri": "https://management.azure.com:443/providers/Microsoft.ProcessSimple/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5/flows/3989cb59-ce1a-4a5c-bb78-257c5c39381d/triggers/Every_day/run?api-version=2016-11-01",
"flowTriggerUri": "https://api.flow.microsoft.com:443/providers/Microsoft.ProcessSimple/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5/flows/3989cb59-ce1a-4a5c-bb78-257c5c39381d/triggers/Every_day/run?api-version=2016-11-01",
"installationStatus": "Installed",
"provisioningMethod": "FromDefinition",
"flowFailureAlertSubscribed": true,
Expand Down Expand Up @@ -2820,7 +2820,7 @@ describe(commands.GET, () => {
"userId": "da8f7aea-cf43-497f-ad62-c2feae89a194",
"userType": "ActiveDirectory"
},
"flowTriggerUri": "https://management.azure.com:443/providers/Microsoft.ProcessSimple/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5/flows/3989cb59-ce1a-4a5c-bb78-257c5c39381d/triggers/Every_day/run?api-version=2016-11-01",
"flowTriggerUri": "https://api.flow.microsoft.com:443/providers/Microsoft.ProcessSimple/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5/flows/3989cb59-ce1a-4a5c-bb78-257c5c39381d/triggers/Every_day/run?api-version=2016-11-01",
"installationStatus": "Installed",
"provisioningMethod": "FromDefinition",
"flowFailureAlertSubscribed": true,
Expand Down Expand Up @@ -3519,7 +3519,7 @@ describe(commands.GET, () => {
"userId": "da8f7aea-cf43-497f-ad62-c2feae89a194",
"userType": "ActiveDirectory"
},
"flowTriggerUri": "https://management.azure.com:443/providers/Microsoft.ProcessSimple/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5/flows/3989cb59-ce1a-4a5c-bb78-257c5c39381d/triggers/Every_day/run?api-version=2016-11-01",
"flowTriggerUri": "https://api.flow.microsoft.com:443/providers/Microsoft.ProcessSimple/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5/flows/3989cb59-ce1a-4a5c-bb78-257c5c39381d/triggers/Every_day/run?api-version=2016-11-01",
"installationStatus": "Installed",
"provisioningMethod": "FromDefinition",
"flowFailureAlertSubscribed": true,
Expand Down Expand Up @@ -4213,7 +4213,7 @@ describe(commands.GET, () => {
"userId": "da8f7aea-cf43-497f-ad62-c2feae89a194",
"userType": "ActiveDirectory"
},
"flowTriggerUri": "https://management.azure.com:443/providers/Microsoft.ProcessSimple/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5/flows/3989cb59-ce1a-4a5c-bb78-257c5c39381d/triggers/Every_day/run?api-version=2016-11-01",
"flowTriggerUri": "https://api.flow.microsoft.com:443/providers/Microsoft.ProcessSimple/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5/flows/3989cb59-ce1a-4a5c-bb78-257c5c39381d/triggers/Every_day/run?api-version=2016-11-01",
"installationStatus": "Installed",
"provisioningMethod": "FromDefinition",
"flowFailureAlertSubscribed": true,
Expand Down Expand Up @@ -4908,7 +4908,7 @@ describe(commands.GET, () => {
"userId": "da8f7aea-cf43-497f-ad62-c2feae89a194",
"userType": "ActiveDirectory"
},
"flowTriggerUri": "https://management.azure.com:443/providers/Microsoft.ProcessSimple/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5/flows/3989cb59-ce1a-4a5c-bb78-257c5c39381d/triggers/Every_day/run?api-version=2016-11-01",
"flowTriggerUri": "https://api.flow.microsoft.com:443/providers/Microsoft.ProcessSimple/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5/flows/3989cb59-ce1a-4a5c-bb78-257c5c39381d/triggers/Every_day/run?api-version=2016-11-01",
"installationStatus": "Installed",
"provisioningMethod": "FromDefinition",
"flowFailureAlertSubscribed": true,
Expand Down Expand Up @@ -5598,7 +5598,7 @@ describe(commands.GET, () => {
"userId": "da8f7aea-cf43-497f-ad62-c2feae89a194",
"userType": "ActiveDirectory"
},
"flowTriggerUri": "https://management.azure.com:443/providers/Microsoft.ProcessSimple/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5/flows/3989cb59-ce1a-4a5c-bb78-257c5c39381d/triggers/Every_day/run?api-version=2016-11-01",
"flowTriggerUri": "https://api.flow.microsoft.com:443/providers/Microsoft.ProcessSimple/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5/flows/3989cb59-ce1a-4a5c-bb78-257c5c39381d/triggers/Every_day/run?api-version=2016-11-01",
"installationStatus": "Installed",
"provisioningMethod": "FromDefinition",
"flowFailureAlertSubscribed": true,
Expand Down Expand Up @@ -6288,7 +6288,7 @@ describe(commands.GET, () => {
"userId": "da8f7aea-cf43-497f-ad62-c2feae89a194",
"userType": "ActiveDirectory"
},
"flowTriggerUri": "https://management.azure.com:443/providers/Microsoft.ProcessSimple/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5/flows/3989cb59-ce1a-4a5c-bb78-257c5c39381d/triggers/Every_day/run?api-version=2016-11-01",
"flowTriggerUri": "https://api.flow.microsoft.com:443/providers/Microsoft.ProcessSimple/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5/flows/3989cb59-ce1a-4a5c-bb78-257c5c39381d/triggers/Every_day/run?api-version=2016-11-01",
"installationStatus": "Installed",
"provisioningMethod": "FromDefinition",
"flowFailureAlertSubscribed": true,
Expand Down Expand Up @@ -6990,7 +6990,7 @@ describe(commands.GET, () => {
"userId": "da8f7aea-cf43-497f-ad62-c2feae89a194",
"userType": "ActiveDirectory"
},
"flowTriggerUri": "https://management.azure.com:443/providers/Microsoft.ProcessSimple/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5/flows/3989cb59-ce1a-4a5c-bb78-257c5c39381d/triggers/Every_day/run?api-version=2016-11-01",
"flowTriggerUri": "https://api.flow.microsoft.com:443/providers/Microsoft.ProcessSimple/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5/flows/3989cb59-ce1a-4a5c-bb78-257c5c39381d/triggers/Every_day/run?api-version=2016-11-01",
"installationStatus": "Installed",
"provisioningMethod": "FromDefinition",
"flowFailureAlertSubscribed": true,
Expand Down Expand Up @@ -7678,7 +7678,7 @@ describe(commands.GET, () => {
"userId": "da8f7aea-cf43-497f-ad62-c2feae89a194",
"userType": "ActiveDirectory"
},
"flowTriggerUri": "https://management.azure.com:443/providers/Microsoft.ProcessSimple/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5/flows/3989cb59-ce1a-4a5c-bb78-257c5c39381d/triggers/Every_day/run?api-version=2016-11-01",
"flowTriggerUri": "https://api.flow.microsoft.com:443/providers/Microsoft.ProcessSimple/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5/flows/3989cb59-ce1a-4a5c-bb78-257c5c39381d/triggers/Every_day/run?api-version=2016-11-01",
"installationStatus": "Installed",
"provisioningMethod": "FromDefinition",
"flowFailureAlertSubscribed": true,
Expand Down
6 changes: 3 additions & 3 deletions src/m365/flow/commands/flow-get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Logger } from '../../../cli/Logger.js';
import GlobalOptions from '../../../GlobalOptions.js';
import request, { CliRequestOptions } from '../../../request.js';
import { formatting } from '../../../utils/formatting.js';
import AzmgmtCommand from '../../base/AzmgmtCommand.js';
import PowerAutomateCommand from '../../base/PowerAutomateCommand.js';
import commands from '../commands.js';

interface CommandArgs {
Expand Down Expand Up @@ -40,7 +40,7 @@ interface Flow {
triggers: string;
}

class FlowGetCommand extends AzmgmtCommand {
class FlowGetCommand extends PowerAutomateCommand {
public get name(): string {
return commands.GET;
}
Expand Down Expand Up @@ -88,7 +88,7 @@ class FlowGetCommand extends AzmgmtCommand {
}

const requestOptions: CliRequestOptions = {
url: `${this.resource}providers/Microsoft.ProcessSimple/${args.options.asAdmin ? 'scopes/admin/' : ''}environments/${formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting.encodeQueryParameter(args.options.name)}?api-version=2016-11-01`,
url: `${this.resource}/providers/Microsoft.ProcessSimple/${args.options.asAdmin ? 'scopes/admin/' : ''}environments/${formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting.encodeQueryParameter(args.options.name)}?api-version=2016-11-01`,
headers: {
accept: 'application/json'
},
Expand Down
Loading

0 comments on commit a73649f

Please sign in to comment.