-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
## 2.31.0 * [Issue #218](#218) * Fixed: `Update-GSOrganizationalUnit` was failing with `null` reference errors. * [Issue #213](#213) * Added: Support for `RELEASE_RESOURCES` TransferParam for Calendar application data transfers to function `Start-GSDataTransfer` * [Issue #215](#215) * Added: * `Get-GSDomain` * `Remove-GSDomain` * `New-GSDomain` * `Get-GSDomainAlias` * `New-GSDomainAlias` * `Remove-GSDomainAlias` * _These will need the additional scope of `https://www.googleapis.com/auth/admin.directory.domain` added in order to use!_ * Miscellaneous * Added: * `Get-GSCustomer` * `Update-GSCustomer` * `Add-GSCustomerPostalAddress` * _These will need the additional scope of `https://www.googleapis.com/auth/admin.directory.customer` added in order to use!_
- Loading branch information
Showing
14 changed files
with
678 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
function Get-GSCustomer { | ||
<# | ||
.SYNOPSIS | ||
Retrieves a customer | ||
.DESCRIPTION | ||
Retrieves a customer | ||
.PARAMETER CustomerKey | ||
Id of the Customer to be retrieved | ||
.EXAMPLE | ||
Get-GSCustomer (Get-GSUser).CustomerId | ||
#> | ||
[OutputType('Google.Apis.Admin.Directory.directory_v1.Data.Customer')] | ||
[CmdletBinding()] | ||
Param( | ||
[Parameter(Position = 0,ValueFromPipeline,ValueFromPipelineByPropertyName)] | ||
[Alias('CustomerId')] | ||
[String] | ||
$CustomerKey = $Script:PSGSuite.CustomerId | ||
) | ||
Begin { | ||
$serviceParams = @{ | ||
Scope = 'https://www.googleapis.com/auth/admin.directory.customer' | ||
ServiceType = 'Google.Apis.Admin.Directory.directory_v1.DirectoryService' | ||
} | ||
$service = New-GoogleService @serviceParams | ||
} | ||
Process { | ||
try { | ||
Write-Verbose "Getting Customer '$CustomerKey'" | ||
$request = $service.Customers.Get($CustomerKey) | ||
$request.Execute() | ||
} | ||
catch { | ||
if ($ErrorActionPreference -eq 'Stop') { | ||
$PSCmdlet.ThrowTerminatingError($_) | ||
} | ||
else { | ||
Write-Error $_ | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
function Update-GSCustomer { | ||
<# | ||
.SYNOPSIS | ||
Updates a customer using patch semantics. | ||
.DESCRIPTION | ||
Updates a customer using patch semantics. | ||
.PARAMETER CustomerKey | ||
Id of the Customer to be updated. | ||
.PARAMETER AlternateEmail | ||
The customer's secondary contact email address. This email address cannot be on the same domain as the customerDomain. | ||
.PARAMETER CustomerDomain | ||
The customer's primary domain name string. Do not include the www prefix when creating a new customer. | ||
.PARAMETER Language | ||
The customer's ISO 639-2 language code. The default value is en-US. | ||
.PARAMETER PhoneNumber | ||
The customer's contact phone number in E.164 format. | ||
.PARAMETER PostalAddress | ||
The customer's postal address information. | ||
Must be type [Google.Apis.Admin.Directory.directory_v1.Data.CustomerPostalAddress]. Use helper function Add-GSCustomerPostalAddress to create the correct type easily. | ||
.EXAMPLE | ||
Get-GSCustomer (Get-GSUser).CustomerId | ||
#> | ||
[OutputType('Google.Apis.Admin.Directory.directory_v1.Data.Customer')] | ||
[CmdletBinding()] | ||
Param( | ||
[Parameter(Position = 0,ValueFromPipeline,ValueFromPipelineByPropertyName)] | ||
[Alias('CustomerId')] | ||
[String] | ||
$CustomerKey = $Script:PSGSuite.CustomerId, | ||
[Parameter()] | ||
[String] | ||
$AlternateEmail, | ||
[Parameter()] | ||
[String] | ||
$CustomerDomain, | ||
[Parameter()] | ||
[String] | ||
$Language, | ||
[Parameter()] | ||
[String] | ||
$PhoneNumber, | ||
[Parameter()] | ||
[Google.Apis.Admin.Directory.directory_v1.Data.CustomerPostalAddress] | ||
$PostalAddress | ||
) | ||
Begin { | ||
$serviceParams = @{ | ||
Scope = 'https://www.googleapis.com/auth/admin.directory.customer' | ||
ServiceType = 'Google.Apis.Admin.Directory.directory_v1.DirectoryService' | ||
} | ||
$service = New-GoogleService @serviceParams | ||
} | ||
Process { | ||
try { | ||
$body = New-Object 'Google.Apis.Admin.Directory.directory_v1.Data.Customer' | ||
foreach ($key in $PSBoundParameters.Keys | Where-Object {$body.PSObject.Properties.Name -contains $_}) { | ||
$body.$key = $PSBoundParameters[$key] | ||
} | ||
Write-Verbose "Updating Customer '$CustomerKey'" | ||
$request = $service.Customers.Patch($body,$CustomerKey) | ||
$request.Execute() | ||
} | ||
catch { | ||
if ($ErrorActionPreference -eq 'Stop') { | ||
$PSCmdlet.ThrowTerminatingError($_) | ||
} | ||
else { | ||
Write-Error $_ | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
function Get-GSDomain { | ||
<# | ||
.SYNOPSIS | ||
Retrieves a Domain | ||
.DESCRIPTION | ||
Retrieves a Domain | ||
.PARAMETER DomainName | ||
Name of the domain to retrieve. | ||
If excluded, returns the list of domains. | ||
.EXAMPLE | ||
Get-GSDDomain | ||
Returns the list of domains. | ||
#> | ||
[OutputType('Google.Apis.Admin.Directory.directory_v1.Data.Domains')] | ||
[CmdletBinding()] | ||
Param( | ||
[Parameter(Position = 0,ValueFromPipeline,ValueFromPipelineByPropertyName)] | ||
[Alias('Domain')] | ||
[String[]] | ||
$DomainName | ||
) | ||
Begin { | ||
$serviceParams = @{ | ||
Scope = 'https://www.googleapis.com/auth/admin.directory.domain' | ||
ServiceType = 'Google.Apis.Admin.Directory.directory_v1.DirectoryService' | ||
} | ||
$service = New-GoogleService @serviceParams | ||
} | ||
Process { | ||
if ($PSBoundParameters.ContainsKey('DomainName')) { | ||
foreach ($domain in $DomainName) { | ||
try { | ||
Write-Verbose "Getting Domain '$domain'" | ||
$request = $service.Domains.Get($Script:PSGSuite.CustomerId,$domain) | ||
$request.Execute() | ||
} | ||
catch { | ||
if ($ErrorActionPreference -eq 'Stop') { | ||
$PSCmdlet.ThrowTerminatingError($_) | ||
} | ||
else { | ||
Write-Error $_ | ||
} | ||
} | ||
} | ||
} | ||
else { | ||
try { | ||
Write-Verbose "Getting the list of Domains" | ||
$request = $service.Domains.List($Script:PSGSuite.CustomerId) | ||
$request.Execute().Domains | ||
} | ||
catch { | ||
if ($ErrorActionPreference -eq 'Stop') { | ||
$PSCmdlet.ThrowTerminatingError($_) | ||
} | ||
else { | ||
Write-Error $_ | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
function Get-GSDomainAlias { | ||
<# | ||
.SYNOPSIS | ||
Retrieves a Domain Alias | ||
.DESCRIPTION | ||
Retrieves a Domain Alias | ||
.PARAMETER DomainAliasName | ||
Name of the domain alias to retrieve. | ||
If excluded, returns the list of domain aliases. | ||
.PARAMETER ParentDomainName | ||
Name of the parent domain to list aliases for. | ||
If excluded, lists all aliases for all domains. | ||
.EXAMPLE | ||
Get-GSDDomainAlias | ||
Returns the list of domain aliases for all domains. | ||
#> | ||
[OutputType('Google.Apis.Admin.Directory.directory_v1.Data.DomainAlias')] | ||
[CmdletBinding(DefaultParameterSetName = "List")] | ||
Param( | ||
[Parameter(Position = 0,ValueFromPipeline,ValueFromPipelineByPropertyName,ParameterSetName = "Get")] | ||
[Alias('DomainAlias')] | ||
[String[]] | ||
$DomainAliasName, | ||
[Parameter(Position = 0,ValueFromPipeline,ValueFromPipelineByPropertyName,ParameterSetName = "List")] | ||
[String[]] | ||
$ParentDomainName | ||
) | ||
Begin { | ||
$serviceParams = @{ | ||
Scope = 'https://www.googleapis.com/auth/admin.directory.domain' | ||
ServiceType = 'Google.Apis.Admin.Directory.directory_v1.DirectoryService' | ||
} | ||
$service = New-GoogleService @serviceParams | ||
} | ||
Process { | ||
if ($PSBoundParameters.ContainsKey('DomainAliasName')) { | ||
foreach ($alias in $DomainAliasName) { | ||
try { | ||
Write-Verbose "Getting DomainAlias '$alias'" | ||
$request = $service.DomainAliases.Get($Script:PSGSuite.CustomerId,$alias) | ||
$request.Execute() | ||
} | ||
catch { | ||
if ($ErrorActionPreference -eq 'Stop') { | ||
$PSCmdlet.ThrowTerminatingError($_) | ||
} | ||
else { | ||
Write-Error $_ | ||
} | ||
} | ||
} | ||
} | ||
else { | ||
try { | ||
$request = $service.DomainAliases.List($Script:PSGSuite.CustomerId) | ||
if ($PSBoundParameters.ContainsKey('ParentDomainName')) { | ||
foreach ($pDom in $ParentDomainName) { | ||
Write-Verbose "Getting the list of all DomainAliases under parent domain '$pDom'" | ||
$request.ParentDomainName = $pDom | ||
$request.Execute().DomainAliasesValue | ||
} | ||
} | ||
else { | ||
Write-Verbose "Getting the list of all DomainAliases" | ||
$request.Execute().DomainAliasesValue | ||
} | ||
} | ||
catch { | ||
if ($ErrorActionPreference -eq 'Stop') { | ||
$PSCmdlet.ThrowTerminatingError($_) | ||
} | ||
else { | ||
Write-Error $_ | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.