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

Initial commit of vCD cmdlets and related tests #453

Merged
merged 42 commits into from
Sep 26, 2019
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
a9d9672
Add Get-RubrikVCD and related tests
shamsway Sep 5, 2019
99bf2c0
Get-RubrikVApp and related tests
shamsway Sep 6, 2019
a0069e4
Additional tests for Get-RubrikVApp
shamsway Sep 9, 2019
f87737a
Add Get-RubrikVappSnapshot and related tests
shamsway Sep 9, 2019
fe9b249
Add Protect-RubrikVApp and related tests
shamsway Sep 9, 2019
5940dda
Add Set-RubrikVCD and related tests
shamsway Sep 10, 2019
1119029
Update Protect-RubrikVApp unit tests
shamsway Sep 10, 2019
472639e
Add Update-RubrikVCD and related tests
shamsway Sep 10, 2019
ac81078
Update Get-RubrikSnapshot to support vApps
shamsway Sep 11, 2019
4ebf093
Update New-RubrikSnapshot to support vApps
shamsway Sep 11, 2019
4b40b0c
Restore-RubrikVApp initial commit
shamsway Sep 13, 2019
0e99598
Add Restore-RubrikVApp and related cmdlets+tests
shamsway Sep 13, 2019
cbaba9b
Add Export-RubrikVApp, related functions and tests
shamsway Sep 19, 2019
e563ef8
Add DetailedObject parameter to Get-RubrikVApp
shamsway Sep 19, 2019
0d4c40f
Misc cleanup
shamsway Sep 19, 2019
0ee8bc5
Fix typo
shamsway Sep 19, 2019
1aca948
Misc cleanup
shamsway Sep 19, 2019
4b5da0e
Add Export-RubrikVcdTemplate related cmdlets+tests
shamsway Sep 20, 2019
5901bec
Cleanup
shamsway Sep 20, 2019
21fe9b9
Update CHANGELOG.md
shamsway Sep 20, 2019
30445cd
Updating AppVeyor image version
shamsway Sep 20, 2019
86fcea4
Trying another AppVeyor image
shamsway Sep 20, 2019
57b29fd
Removing AppVeyor image change
shamsway Sep 20, 2019
c57452d
Merge branch 'master' into melliott-273
shamsway Sep 20, 2019
9e677a1
Update Get-RubrikVApp.ps1
rfitzhugh Sep 21, 2019
c012643
Update Get-RubrikVAppSnapshot.ps1
rfitzhugh Sep 21, 2019
61dc079
Remove relic from query if not specified
mwpreston Sep 24, 2019
522a5a7
added comment for ID parameter
mwpreston Sep 24, 2019
bf03f00
del -Depth param from tests - no support < PSv6
mwpreston Sep 24, 2019
58e160f
More instances of depth parameter
mwpreston Sep 24, 2019
4f81448
Swapped 'length' for 'count' in tests
mwpreston Sep 24, 2019
fad44d9
remove depth parameter
mwpreston Sep 24, 2019
e92e665
Update Restore-RubrikVApp.ps1
rfitzhugh Sep 24, 2019
1fb173b
Fix bug in Export-RubrikVapp
shamsway Sep 24, 2019
5aae635
Merge branch 'melliott-273' of github.com:rubrikinc/rubrik-sdk-for-po…
shamsway Sep 24, 2019
b5c087a
documentation updates
rfitzhugh Sep 26, 2019
0284f0b
Change references from Vcd to VCD
shamsway Sep 26, 2019
7da3270
Rename Export-RubrikVcdTemplate.ps1 to Export-RubrikVCDTemplate.ps1
shamsway Sep 26, 2019
daaf37f
Rename Get-RubrikVcdTemplateExportOptions.ps1 to Get-RubrikVCDTemplat…
shamsway Sep 26, 2019
51d591c
Rename Export-RubrikVcdTemplate.Tests.ps1 to Export-RubrikVCDTemplate…
shamsway Sep 26, 2019
62761e5
Update Changelog
shamsway Sep 26, 2019
52deea3
Merge branch 'master' into melliott-273
shamsway Sep 26, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

## 2019-09-19

### Added initial support for VMware vCloud Director (vCD) API endpoints in CDM

* Added cmdlets `Update-RubrikVCD`, `Set-RubrikVCD`, `Restore-RubrikVApp`, `Protect-RubrikVApp`, `Get-RubrikVcdTemplateExportOptions`, `Get-RubrikVCD`, `Get-RubrikVappSnapshot`, `RubrikVAppRecoverOptions`, `Get-RubrikVAppExportOptions`, `Get-RubrikVApp`, `Export-RubrikVcdTemplate`, `Export-RubrikVApp` and related tests as requested in [Issue 273](https://github.com/rubrikinc/rubrik-sdk-for-powershell/issues/273)
* Updated `Get-RubrikSnapshot` to support vCD vApps
* Misc bug fixes and typos corrected

## 2019-09-12

### Changed [Added ability to rename Managed Volumes]
Expand Down
220 changes: 220 additions & 0 deletions Rubrik/Private/Get-RubrikAPIData.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,56 @@ function Get-RubrikAPIData($endpoint) {
Success = '200'
}
}
'Export-RubrikVApp' = @{
'1.0' = @{
Description = 'Exports a given snapshot for a vCD vApp'
URI = '/api/internal/vcd/vapp/snapshot/{id}/export'
Method = 'Post'
Body = @{
exportMode = 'exportMode'
networksToRestore = [System.Collections.ArrayList]@()
vmsToExport = @(
@{
name = 'name'
vcdMoid = 'vcdMoid'
networkConnections = @{
nicIndex = 'nicIndex'
addressingMode = 'addressingMode'
ipAddress = 'ipAddress'
isConnected = 'isConnected'
vappNetworkName = 'vappNetworkName'
}
}
)
shouldPowerOnVmsAfterRecovery = 'shouldPowerOnVmsAfterRecovery'
newVappParams = @{
name = 'name'
orgVdcId = 'orgVdcId'
}
}
Query = ''
Result = ''
Filter = ''
Success = '202'
}
}
'Export-RubrikVcdTemplate' = @{
'1.0' = @{
Description = 'Exports a given vCD template'
URI = '/api/v1/vcd/vapp/template/snapshot/{id}/export'
Method = 'Post'
Body = @{
name = 'name'
catalogId = 'catalogId'
orgVdcId = 'orgVdcId'
storagePolicyId = 'storagePolicyId'
}
Query = ''
Result = ''
Filter = ''
Success = '202'
}
}
'Get-RubrikAPIToken' = @{
'5.0' = @{
Description = 'Retrieves list of generated API tokens from the Rubrik cluster'
Expand Down Expand Up @@ -627,6 +677,7 @@ function Get-RubrikAPIData($endpoint) {
Nutanix = '/api/internal/nutanix/vm/{id}/snapshot'
VolumeGroup = '/api/internal/volume_group/{id}/snapshot'
Oracle = '/api/internal/oracle/db/{id}/snapshot'
VcdVapp = '/api/internal/vcd/vapp/{id}/snapshot'
}
Method = 'Get'
Body = ''
Expand Down Expand Up @@ -698,6 +749,106 @@ function Get-RubrikAPIData($endpoint) {
Success = '200'
}
}
'Get-RubrikVApp' = @{
'1.0' = @{
Description = 'Get summary of all the vCD vApps'
URI = '/api/internal/vcd/vapp'
Method = 'Get'
Body = ''
Query = @{
is_relic = 'is_relic'
name = 'name'
effective_sla_domain_id = 'effective_sla_domain_id'
sla_assignment = 'sla_assignment'
primary_cluster_id = 'primary_cluster_id'
}
Result = 'data'
Filter = @{
'Name' = 'name'
'SLA' = 'effectiveSlaDomainName'
'SourceObjectId' = 'effectiveSlaSourceObjectId'
'SourceObjectName' = 'effectiveSlaSourceObjectName'
'vcdClusterId' = 'vcdClusterId'
'vcdClusterName' = 'vcdClusterName'
}
Success = '200'
}
}
'Get-RubrikVAppExportOptions' = @{
'1.0' = @{
Description = 'Retrieves export options for a vCD vApp'
URI = '/api/internal/vcd/vapp/snapshot/{id}/export/options'
Method = 'Get'
Body = ''
Query = @{
export_mode = 'export_mode'
target_vapp_id = 'target_vapp_id'
target_org_vdc_id = 'target_org_vdc_id'
}
Result = ''
Filter = ''
Success = '200'
}
}
'Get-RubrikVAppRecoverOptions' = @{
'1.0' = @{
Description = 'Retrieves instant recovery options for a vCD vApp'
URI = '/api/internal/vcd/vapp/snapshot/{id}/instant_recover/options'
Method = 'Get'
Body = ''
Query = @{}
Result = ''
Filter = ''
Success = '200'
}
}
'Get-RubrikVcdTemplateExportOptions' = @{
'1.0' = @{
Description = 'Retrieves export options for a vCD Template'
URI = '/api/v1/vcd/vapp/template/snapshot/{id}/export/options'
Method = 'Get'
Body = ''
Query = @{
catalog_id = 'catalog_id'
name = 'name'
org_vdc_id = 'org_vdc_id'
}
Result = ''
Filter = ''
Success = '200'
}
}
'Get-RubrikVAppSnapshot' = @{
'1.0' = @{
Description = 'Retrieve information of a vCD vApp snapshot'
URI = '/api/internal/vcd/vapp/snapshot/{id}'
Method = 'Get'
Body = ''
Query = @{
id = 'id'
}
Result = 'data'
Filter = ''
Success = '200'
}
}
'Get-RubrikVCD' = @{
'1.0' = @{
Description = 'Retrieve summary information for all vCD cluster objects'
URI = '/api/internal/vcd/cluster'
Method = 'Get'
Body = ''
Query = @{
name = 'name'
status = 'status'
}
Result = 'data'
Filter = @{
'Hostname' = 'hostname'
}
Success = '200'
}
}
'Get-RubrikVCenter' = @{
'1.0' = @{
Description = 'Retrieves all vCenter settings of the Rubrik cluster'
Expand Down Expand Up @@ -1197,6 +1348,7 @@ function Get-RubrikAPIData($endpoint) {
VMware = '/api/v1/vmware/vm/{id}/snapshot'
VolumeGroup = '/api/internal/volume_group/{id}/snapshot'
Oracle = '/api/internal/oracle/db/{id}/snapshot'
VcdVapp = '/api/internal/vcd/vapp/{id}/snapshot'
}
Method = 'Post'
Body = @{
Expand Down Expand Up @@ -1281,6 +1433,20 @@ function Get-RubrikAPIData($endpoint) {
Success = '204'
}
}
'Protect-RubrikVApp' = @{
'1.0' = @{
Description = 'Update a vCD vApp with the specified SLA Domain.'
URI = '/api/internal/vcd/vapp/{id}'
Method = 'Patch'
Body = @{
configuredSlaDomainId = 'configuredSlaDomainId'
}
Query = ''
Result = ''
Filter = ''
Success = '200'
}
}
'Protect-RubrikVM' = @{
'1.0' = @{
Description = 'Update a VM with the specified SLA Domain.'
Expand Down Expand Up @@ -1522,6 +1688,31 @@ function Get-RubrikAPIData($endpoint) {
Success = '202'
}
}
'Restore-RubrikVApp' = @{
'1.0' = @{
Description = 'Restores a given snapshot for a vCD vApp'
URI = '/api/internal/vcd/vapp/snapshot/{id}/instant_recover'
Method = 'Post'
Body = @{
vmsToRestore = @{
name = 'name'
vcdMoid = 'vcdMoid'
networkConnections = @{
nicIndex = 'nicIndex'
addressingMode = 'addressingMode'
ipAddress = 'ipAddress'
isConnected = 'isConnected'
vappNetworkName = 'vappNetworkName'
}
}
shouldPowerOnVmsAfterRecovery = 'shouldPowerOnVmsAfterRecovery'
}
Query = ''
Result = ''
Filter = ''
Success = '202'
}
}
'Set-RubrikAvailabilityGroup' = @{
'1.0' = @{
Description = 'Update a Microsoft SQL availability group.'
Expand Down Expand Up @@ -1863,6 +2054,23 @@ function Get-RubrikAPIData($endpoint) {
Success = '200'
}
}
'Set-RubrikVCD' = @{
'1.0' = @{
Description = 'Updates settings of a vCD connection'
URI = '/api/internal/vcd/cluster/{id}'
Method = 'Patch'
Body = @{
hostname = "hostname"
username = "username"
password = "password"
configuredSlaDomainId = "configuredSlaDomainId"
}
Query = ''
Result = ''
Filter = ''
Success = '200'
}
}
'Set-RubrikVM' = @{
'1.0' = @{
Description = 'Update VM with specified properties'
Expand Down Expand Up @@ -2073,6 +2281,18 @@ function Get-RubrikAPIData($endpoint) {
Success = '202'
}
}
'Update-RubrikVCD' = @{
'1.0' = @{
Description = 'Refresh the metadata for the specified vCD Server'
URI = '/api/internal/vcd/cluster/{id}/refresh'
Method = 'Post'
Body = ''
Query = ''
Result = ''
Filter = ''
Success = '202'
}
}
'Update-RubrikVMwareVM' = @{
'1.0' = @{
Description = 'Refresh the metadata for the specified VMware VM'
Expand Down
5 changes: 5 additions & 0 deletions Rubrik/Private/Test-QueryParam.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@
Write-Verbose -Message 'Loading OracleDatabase API data'
$uri = ('https://'+$Server+$resources.URI.Oracle) -replace '{id}', $id
}
'VcdVapp::*'
{
Write-Verbose -Message 'Loading vCD API data'
$uri = ('https://'+$Server+$resources.URI.VcdVapp) -replace '{id}', $id
}
default
{
throw 'The supplied id value has no matching endpoint'
Expand Down
Loading