Skip to content

Commit

Permalink
!deploy v2.31.0 to fix #218 and add support for #213 and #215
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
scrthq authored Jul 31, 2019
2 parents 93bb597 + a6d7733 commit 43e3630
Show file tree
Hide file tree
Showing 14 changed files with 678 additions and 39 deletions.
35 changes: 29 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
* [PSGSuite - ChangeLog](#PSGSuite---ChangeLog)
* [PSGSuite - ChangeLog](#psgsuite---changelog)
* [2.31.0](#2310)
* [2.30.2](#2302)
* [2.30.1](#2301)
* [2.30.0](#2300)
Expand Down Expand Up @@ -84,16 +85,38 @@
* [2.0.2](#202)
* [2.0.1](#201)
* [2.0.0](#200)
* [New Functionality](#New-Functionality)
* [Breaking Changes in 2.0.0](#Breaking-Changes-in-200)
* [Gmail Delegation Management Removed](#Gmail-Delegation-Management-Removed)
* [Functions Removed](#Functions-Removed)
* [Functions Aliased](#Functions-Aliased)
* [New Functionality](#new-functionality)
* [Breaking Changes in 2.0.0](#breaking-changes-in-200)
* [Gmail Delegation Management Removed](#gmail-delegation-management-removed)
* [Functions Removed](#functions-removed)
* [Functions Aliased](#functions-aliased)

***

# PSGSuite - ChangeLog

## 2.31.0

* [Issue #218](https://github.com/scrthq/PSGSuite/issues/218)
* Fixed: `Update-GSOrganizationalUnit` was failing with `null` reference errors.
* [Issue #213](https://github.com/scrthq/PSGSuite/issues/213)
* Added: Support for `RELEASE_RESOURCES` TransferParam for Calendar application data transfers to function `Start-GSDataTransfer`
* [Issue #215](https://github.com/scrthq/PSGSuite/issues/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!_

## 2.30.2

* [Issue #212](https://github.com/scrthq/PSGSuite/issues/212)
Expand Down
2 changes: 1 addition & 1 deletion PSGSuite/PSGSuite.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'PSGSuite.psm1'

# Version number of this module.
ModuleVersion = '2.30.2'
ModuleVersion = '2.31.0'

# ID used to uniquely identify this module
GUID = '9d751152-e83e-40bb-a6db-4c329092aaec'
Expand Down
45 changes: 45 additions & 0 deletions PSGSuite/Public/Customers/Get-GSCustomer.ps1
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 $_
}
}
}
}
81 changes: 81 additions & 0 deletions PSGSuite/Public/Customers/Update-GSCustomer.ps1
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 $_
}
}
}
}
20 changes: 18 additions & 2 deletions PSGSuite/Public/Data Transfer/Start-GSDataTransfer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,17 @@
.PARAMETER PrivacyLevel
The privacy level for the data you'd like to transfer
*Valid for Drive & Docs data transfers only.*
Available values are:
* "SHARED": all shared content owned by the user
* "PRIVATE": all private (unshared) content owned by the user
.PARAMETER ReleaseResources
If true, releases Calendar resources booked by the OldOwner to the NewOwner.
*Valid for Calendar data transfers only.*
.EXAMPLE
Start-GSDataTransfer -OldOwnerUserId joe -NewOwnerUserId mark -ApplicationId 55656082996 -PrivacyLevel SHARED,PRIVATE
Expand All @@ -40,10 +47,13 @@
[alias("id")]
[string]
$ApplicationId,
[parameter(Mandatory=$true)]
[parameter(Mandatory=$false)]
[ValidateSet("SHARED","PRIVATE")]
[string[]]
$PrivacyLevel
$PrivacyLevel,
[parameter(Mandatory=$false)]
[switch]
$ReleaseResources
)
Begin {
$serviceParams = @{
Expand Down Expand Up @@ -81,6 +91,12 @@
Value = [String[]]$PrivacyLevel
})
}
elseif ($ReleaseResources) {
$AppDataTransfers.ApplicationTransferParams = [Google.Apis.Admin.DataTransfer.datatransfer_v1.Data.ApplicationTransferParam[]](New-Object 'Google.Apis.Admin.DataTransfer.datatransfer_v1.Data.ApplicationTransferParam' -Property @{
Key = 'RELEASE_RESOURCES'
Value = [String[]]'TRUE'
})
}
$body.ApplicationDataTransfers = [Google.Apis.Admin.DataTransfer.datatransfer_v1.Data.ApplicationDataTransfer[]]$AppDataTransfers
$request = $service.Transfers.Insert($body)
Write-Verbose "Starting Data Transfer from User Id '$OldOwnerUserId' to User Id '$NewOwnerUserId'"
Expand Down
68 changes: 68 additions & 0 deletions PSGSuite/Public/Domains/Get-GSDomain.ps1
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 $_
}
}
}
}
}
85 changes: 85 additions & 0 deletions PSGSuite/Public/Domains/Get-GSDomainAlias.ps1
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 $_
}
}
}
}
}
Loading

0 comments on commit 43e3630

Please sign in to comment.