Skip to content

Commit

Permalink
added new command Get Powe Platform Connectors.
Browse files Browse the repository at this point in the history
  • Loading branch information
siddharth-vaghasia committed Jul 29, 2023
1 parent 8d9c8ae commit 46b8eb0
Show file tree
Hide file tree
Showing 29 changed files with 730 additions and 0 deletions.
125 changes: 125 additions & 0 deletions documentation/Get-PnPPowerPlatformConnectors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
---
Module Name: PnP.PowerShell
schema: 2.0.0
applicable: SharePoint Online
online version: https://pnp.github.io/powershell/cmdlets/Get-PnPPowerPlatformConnectors.html
external help file: PnP.PowerShell.dll-Help.xml
title: Get-PnPPowerPlatformConnectors
---

# Get-PnPPowerPlatformConnectors

## SYNOPSIS

**Required Permissions**

* Azure: management.azure.com

Returns the Custom Power Platform Connectors for a given environment

## SYNTAX

```powershell
Get-PnPPowerPlatformConnectors [-Environment <PowerPlatformEnvironmentPipeBind>] [-AsAdmin] [-Identity <PowerPlatformConnectorPipeBind>]
[-Connection <PnPConnection>] [-Verbose]
```

## DESCRIPTION
This cmdlet returns the custom connectors on a given enviroment.

## EXAMPLES

### Example 1
```powershell
$environment = Get-PnPPowerPlatformEnvironment
Get-PnPPowerPlatformConnectors -Environment $environment
```
This returns all the custom connectors for a given Power Platform environment

### Example 2
```powershell
$environment = Get-PnPPowerPlatformEnvironment
Get-PowerPlatformConnectorPipeBind -Environment $environment -Identity fba63225-baf9-4d76-86a1-1b42c917a182
```
This returns a specific custom connector

## PARAMETERS

### -Environment
The name of the Power Platform environment or an Environment object to retrieve the available custom connectors for.

```yaml
Type: PowerPlatformEnvironmentPipeBind
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: The default environment
Accept pipeline input: True
Accept wildcard characters: False
```
### -Identity
The Id of the connector to retrieve.
```yaml
Type: PowerPlatformConnectorPipeBind
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -AsAdmin
If specified returns all the custom connectors as admin. If not specified only the custom connectors for the current user will be returned.
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Connection
Optional connection to be used by the cmdlet.
Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.
```yaml
Type: PnPConnection
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Verbose
When provided, additional debug statements will be shown while executing the cmdlet.
```yaml
Type: SwitchParameter
Parameter Sets: (All)

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
## RELATED LINKS
[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)
26 changes: 26 additions & 0 deletions src/Commands/Base/PipeBinds/PowerPlatformConnectorPipeBind.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
namespace PnP.PowerShell.Commands.Base.PipeBinds
{
public sealed class PowerPlatformConnectorPipeBind
{
private readonly string _name;
private readonly Model.PowerPlatform.Environment.PowerPlatformConnector _connector;
public PowerPlatformConnectorPipeBind(string input)
{
_name = input;
}

public PowerPlatformConnectorPipeBind(Model.PowerPlatform.Environment.PowerPlatformConnector connector)
{
_connector = connector;
}

public string GetName()
{
if (_connector != null)
{
return _connector.Name;
}
return _name;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using PnP.Framework.Extensions;
using System.Text.Json.Serialization;

namespace PnP.PowerShell.Commands.Model.PowerPlatform.Environment
{
public class PowerPlatformConnector
{
/// <summary>
/// Name of the connector as its GUID
/// </summary>
[JsonPropertyName("name")]
public string Name { get; set; }
/// <summary>
/// Unique identifier of this connector.
/// </summary>
[JsonPropertyName("id")]
public string Id { get; set; }
/// <summary>
/// Type of object, typically Microsoft.PowerApps/apis
/// </summary>
[JsonPropertyName("type")]
public string Type { get; set; }
/// <summary>
/// Additional information on the Connector
/// </summary>
[JsonPropertyName("properties")]
public PowerPlatformConnectorProperties Properties { get; set; }
public bool IsCustomConnector
{
get { return Properties.isCustomApi; }
}
public string DisplayName
{
get { return Properties.displayName; }
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System.Text.Json.Serialization;

namespace PnP.PowerShell.Commands.Model.PowerPlatform.Environment
{
public class PowerPlatformConnectorApiDefinitions
{
[JsonPropertyName("originalSwaggerUrl")]
public string originalSwaggerUrl { get; set; }

[JsonPropertyName("modifiedSwaggerUrl")]
public string modifiedSwaggerUrl { get; set; }
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Text.Json.Serialization;

namespace PnP.PowerShell.Commands.Model.PowerPlatform.Environment
{
public class PowerPlatformConnectorAuthorizationUrl
{
[JsonPropertyName("value")]
public string value { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System.Text.Json.Serialization;

namespace PnP.PowerShell.Commands.Model.PowerPlatform.Environment
{
public class PowerPlatformConnectorBackendService
{
[JsonPropertyName("serviceUrl")]
public string serviceUrl { get; set; }
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System.Text.Json.Serialization;

namespace PnP.PowerShell.Commands.Model.PowerPlatform.Environment
{
public class PowerPlatformConnectorConnectionParameters
{
[JsonPropertyName("token")]
public PowerPlatformConnectorToken token { get; set; }

[JsonPropertyName("token:TenantId")]
public PowerPlatformConnectorTokenTenantId tokenTenantId { get; set; }
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System.Text.Json.Serialization;

namespace PnP.PowerShell.Commands.Model.PowerPlatform.Environment
{
public class PowerPlatformConnectorConstraints
{
[JsonPropertyName("required")]
public string required { get; set; }

[JsonPropertyName("hidden")]
public string hidden { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//namespace PnP.PowerShell.Commands.Model.PowerPlatform.Environment
//{
// public class PowerPlatformConnectorContact
// {
// }
//}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System.Text.Json.Serialization;

namespace PnP.PowerShell.Commands.Model.PowerPlatform.Environment
{
public class PowerPlatformConnectorCreatedBy
{
[JsonPropertyName("id")]
public string id { get; set; }

[JsonPropertyName("displayName")]
public string displayName { get; set; }

[JsonPropertyName("email")]
public string email { get; set; }

[JsonPropertyName("type")]
public string type { get; set; }

[JsonPropertyName("tenantId")]
public string tenantId { get; set; }

[JsonPropertyName("userPrincipalName")]
public string userPrincipalName { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System.Text.Json.Serialization;

namespace PnP.PowerShell.Commands.Model.PowerPlatform.Environment
{
public class PowerPlatformConnectorCustomParameters
{
[JsonPropertyName("loginUri")]
public PowerPlatformConnectorLoginUri loginUri { get; set; }

[JsonPropertyName("tenantId")]
public PowerPlatformConnectorTenantId tenantId { get; set; }

[JsonPropertyName("resourceUri")]
public PowerPlatformConnectorResourceUri resourceUri { get; set; }

[JsonPropertyName("authorizationUrl")]
public PowerPlatformConnectorAuthorizationUrl authorizationUrl { get; set; }

[JsonPropertyName("tokenUrl")]
public PowerPlatformConnectorTokenUrl tokenUrl { get; set; }

[JsonPropertyName("refreshUrl")]
public PowerPlatformConnectorRefreshUrl refreshUrl { get; set; }

[JsonPropertyName("enableOnbehalfOfLogin")]
public PowerPlatformConnectorEnableOnbehalfOfLogin enableOnbehalfOfLogin { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Text.Json.Serialization;

namespace PnP.PowerShell.Commands.Model.PowerPlatform.Environment
{
public class PowerPlatformConnectorEnableOnbehalfOfLogin
{
[JsonPropertyName("value")]
public string value { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System.Text.Json.Serialization;

namespace PnP.PowerShell.Commands.Model.PowerPlatform.Environment
{
public class PowerPlatformConnectorEnvironment
{
[JsonPropertyName("id")]
public string id { get; set; }

[JsonPropertyName("name")]
public string name { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//namespace PnP.PowerShell.Commands.Model.PowerPlatform.Environment
//{
// public class PowerPlatformConnectorLicense
// {
// }
//}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Text.Json.Serialization;

namespace PnP.PowerShell.Commands.Model.PowerPlatform.Environment
{
public class PowerPlatformConnectorLoginUri
{
[JsonPropertyName("value")]
public string value { get; set; }
}
}
Loading

0 comments on commit 46b8eb0

Please sign in to comment.