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

Q2 Release 2024 #413

Merged
merged 105 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
0f966a3
Add hostgroups (#326)
michaelkad Mar 1, 2024
855f96c
Update swagger client and models to service-broker v1.140.0 (#337)
powervs-ibm Mar 1, 2024
7568b64
Update swagger client and models to service-broker v1.140.0 (#336)
powervs-ibm Mar 1, 2024
8bd10d3
Update swagger client and models to service-broker v1.140.0 (#346)
powervs-ibm Mar 13, 2024
f0cebeb
Update swagger client and models to service-broker v1.140.0 (#347)
powervs-ibm Mar 13, 2024
9e25e63
Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3
dependabot[bot] Feb 28, 2024
6966b1f
Fix golangci-lint action v4 requirement
yussufsh Mar 4, 2024
ac9384d
Add branch to dependabot (#338)
michaelkad Mar 4, 2024
f0a510c
Bump github.com/stretchr/testify from 1.8.4 to 1.9.0
dependabot[bot] Mar 5, 2024
357f6be
Bump github.com/IBM/platform-services-go-sdk from 0.59.1 to 0.60.0
dependabot[bot] Mar 11, 2024
eedc628
Add Removal of Create VPN (#315)
michaelkad Mar 13, 2024
326860e
Revert "Enable shared-processor-pool functionality on stratos" (#354)
ismirlia Mar 13, 2024
0dd5d42
Remove duplicate go setup step (#348)
yussufsh Mar 13, 2024
a5f5eef
Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3
dependabot[bot] Feb 28, 2024
b28470a
Fix golangci-lint action v4 requirement
yussufsh Mar 4, 2024
9f3e2fa
Bump github.com/IBM/platform-services-go-sdk from 0.56.4 to 0.57.0
dependabot[bot] Feb 14, 2024
c64509f
Bump github.com/IBM/platform-services-go-sdk from 0.57.0 to 0.58.0
dependabot[bot] Feb 16, 2024
282de8f
Bump github.com/IBM/platform-services-go-sdk from 0.58.0 to 0.59.0
dependabot[bot] Feb 19, 2024
4119dd9
Bump github.com/IBM/platform-services-go-sdk from 0.59.0 to 0.59.1
dependabot[bot] Feb 26, 2024
2a6db67
Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3
dependabot[bot] Feb 28, 2024
d210045
Bump github.com/stretchr/testify from 1.8.4 to 1.9.0
dependabot[bot] Mar 5, 2024
d8f3319
Bump github.com/IBM/platform-services-go-sdk from 0.59.1 to 0.60.0
dependabot[bot] Mar 11, 2024
091bf69
Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3
dependabot[bot] Feb 28, 2024
0a7cd7d
Fix golangci-lint action v4 requirement
yussufsh Mar 4, 2024
7336d57
Add branch to dependabot (#338)
michaelkad Mar 4, 2024
d7614ac
Remove duplicate go setup step (#348)
yussufsh Mar 13, 2024
b5eab50
Update swagger client and models to service-broker v1.140.0 (#337)
powervs-ibm Mar 1, 2024
6e3be4a
Update swagger client and models to service-broker v1.140.0 (#346)
powervs-ibm Mar 13, 2024
3f8867e
Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3
dependabot[bot] Feb 28, 2024
fbd1321
Add branch to dependabot (#338)
michaelkad Mar 4, 2024
50dc09e
Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3
dependabot[bot] Feb 28, 2024
79508bd
Add hostgroups (#326)
michaelkad Mar 1, 2024
cc26ee6
Update swagger client and models to service-broker v1.140.0 (#337)
powervs-ibm Mar 1, 2024
d78b577
Update swagger client and models to service-broker v1.140.0 (#346)
powervs-ibm Mar 13, 2024
8cf745a
Update swagger client and models to service-broker v1.140.0 (#347)
powervs-ibm Mar 13, 2024
de0be26
Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3
dependabot[bot] Feb 28, 2024
77e29f2
Fix golangci-lint action v4 requirement
yussufsh Mar 4, 2024
bc7627f
Add branch to dependabot (#338)
michaelkad Mar 4, 2024
1b31784
Remove duplicate go setup step (#348)
yussufsh Mar 13, 2024
d8ff7dc
Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3
dependabot[bot] Feb 28, 2024
2473bcb
Fix golangci-lint action v4 requirement
yussufsh Mar 4, 2024
768f516
Fix golangci-lint action v4 requirement
yussufsh Mar 4, 2024
8ff6540
Add branch to dependabot (#338)
michaelkad Mar 4, 2024
7f9a509
Update swagger client and models to service-broker v1.140.0 (#337)
powervs-ibm Mar 1, 2024
583e237
Update swagger client and models to service-broker v1.140.0 (#346)
powervs-ibm Mar 13, 2024
57071c4
Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3
dependabot[bot] Feb 28, 2024
f3907ff
Add branch to dependabot (#338)
michaelkad Mar 4, 2024
b1cc070
Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3
dependabot[bot] Feb 28, 2024
6958bbe
Merge branch 'dev' of https://github.com/IBM-Cloud/power-go-client in…
michaelkad Mar 14, 2024
1983051
Generated Swagger client from service-broker commit 0fecb85e68db0dcc5…
powervs-ibm Mar 14, 2024
dbe786d
Generated Swagger client from service-broker commit a74a353d92fbe6cfe…
powervs-ibm Mar 21, 2024
a49a1e4
Generated Swagger client from service-broker commit e98a290ebdfbe53e5…
powervs-ibm Mar 21, 2024
81cb569
Generated Swagger client from service-broker commit a9e6e612e2556e1c6…
powervs-ibm Mar 21, 2024
7a374ba
Merge remote-tracking branch 'power-go-client/generated-files-2024-03…
michaelkad Mar 21, 2024
9a46cb9
Merge remote-tracking branch 'power-go-client/generated-files-2024-03…
michaelkad Mar 22, 2024
991fda1
Merge remote-tracking branch 'power-go-client/generated-files-2024-03…
michaelkad Mar 22, 2024
e267fb3
Generated Swagger client from service-broker commit 70b0722398f5a64ea…
powervs-ibm Mar 26, 2024
c629e20
Generated Swagger client from service-broker commit 8ea7617cec1e857b8…
powervs-ibm Mar 28, 2024
7634d3b
Generated Swagger client from service-broker commit 384961399c43e0ea9…
powervs-ibm Mar 28, 2024
4d896a2
Update Hostgroup client and add stratos validation (#361)
michaelkad Mar 28, 2024
c62fbb1
Generated Swagger client from service-broker commit 125c585619c1c406c…
powervs-ibm Apr 1, 2024
75562d2
Generated Swagger client from service-broker commit 6238c39937d5f7a63…
powervs-ibm Apr 1, 2024
9535a83
Refactor host group name (#367)
michaelkad Apr 3, 2024
5397101
Generated Swagger client from service-broker commit 4c221d25789a0cbf9…
powervs-ibm Apr 3, 2024
197e0ec
Generated Swagger client from service-broker commit 1efc6f47450f757d1…
powervs-ibm Apr 3, 2024
2c4ff67
Generated Swagger client from service-broker commit f627067b7cfb1a503…
powervs-ibm Apr 4, 2024
1ae482a
Generated Swagger client from service-broker commit e43ad9dd41dd11d02…
powervs-ibm Apr 4, 2024
cac5670
[IBMPIHostGroupsClient]Fix typo (#369)
michaelkad Apr 4, 2024
a992fec
Add checksum gates for powervs (#372)
ismirlia Apr 5, 2024
bbb11c6
Generated Swagger client from service-broker commit 0562d1c6f66295c4e…
powervs-ibm Apr 8, 2024
31eecaa
Generated Swagger client from service-broker commit c4cb98d889ffe37cd…
powervs-ibm Apr 8, 2024
d7e5e4b
Generated Swagger client from service-broker commit 8f5f60718bab6db63…
powervs-ibm Apr 12, 2024
101ce1c
Generated Swagger client from service-broker commit b9bc7ab551a37f4cd…
powervs-ibm Apr 15, 2024
50af8de
Fix error in host-group example (#376)
ismirlia Apr 15, 2024
7fb40d4
Add deploymentTarget safeguard for Stratos (#378)
ismirlia Apr 15, 2024
5db10f2
Update spp safeguards for stratos (#379)
ismirlia Apr 15, 2024
07a43c4
Generated Swagger client from service-broker commit 2a7c3111d7d5c5567…
powervs-ibm Apr 22, 2024
111ed0b
Bump golang.org/x/net from 0.20.0 to 0.23.0 (#384)
michaelkad Apr 23, 2024
b878de3
Merge remote-tracking branch 'upstream/master'
michaelkad Apr 23, 2024
23cfcc4
Merge remote-tracking branch 'upstream/master' into dev
michaelkad Apr 23, 2024
dcd5664
Merge remote-tracking branch 'upstream/dev' into dev
michaelkad Apr 23, 2024
07351e4
Generated Swagger client from service-broker commit a76fd7fb2c0026fa0…
powervs-ibm Apr 26, 2024
6ba1f67
Generated Swagger client from service-broker commit bfe8b85d361707cf8…
powervs-ibm May 2, 2024
c376f55
Bump golangci/golangci-lint-action from 4 to 5
dependabot[bot] Apr 29, 2024
f81bbe8
Bump golangci/golangci-lint-action from 4 to 5
dependabot[bot] Apr 29, 2024
5cc53f6
Merge remote-tracking branch 'upstream/dev' into dev
michaelkad May 6, 2024
3ed5f91
Merge remote-tracking branch 'upstream/master'
michaelkad May 6, 2024
36bbcae
Generated Swagger client from service-broker commit a433c612326d69514…
powervs-ibm May 8, 2024
47f8502
Generated Swagger client from service-broker commit 6f9b593c228169c62…
powervs-ibm May 9, 2024
5900ab6
Generated Swagger client from service-broker commit a08ee4720fe926826…
powervs-ibm May 9, 2024
af13fb0
Generated Swagger client from service-broker commit bd9c5c4d29bd09306…
powervs-ibm May 13, 2024
398990d
Update to go 1.22
michaelkad May 20, 2024
9f4ca24
Generated Swagger client from service-broker commit 1a54ea3efa13779bf…
powervs-ibm May 28, 2024
3cf13d3
Update to go 1.22 (#396)
michaelkad May 31, 2024
c9095d1
Generated Swagger client from service-broker commit f43b28fb6f66ffdf7…
powervs-ibm Jun 10, 2024
be8ae86
Generated Swagger client from service-broker commit 814f6cac25d7b8aef…
powervs-ibm Jun 17, 2024
7e37813
Generated Swagger client from service-broker commit d82c42a9b20ab1dcd…
powervs-ibm Jun 17, 2024
4f8914d
Generated Swagger client from service-broker commit ad5b24d0dca3b490c…
powervs-ibm Jun 17, 2024
14463b0
Generated Swagger client from service-broker commit 5fa65c3c11cd0c147…
powervs-ibm Jun 17, 2024
a21698d
Generated Swagger client from service-broker commit c455f6094ce91e256…
powervs-ibm Jun 17, 2024
d0cf231
Generated Swagger client from service-broker commit f19df27ca2e676ba6…
powervs-ibm Jun 17, 2024
296b45b
Generated Swagger client from service-broker commit f856adaa776020988…
powervs-ibm Jun 17, 2024
dd62fa5
Generated Swagger client from service-broker commit b7a20105660b86a19…
powervs-ibm Jun 17, 2024
4fdb12b
Merge remote-tracking branch 'upstream/dev' into q2-release-2024
michaelkad Jun 18, 2024
323a301
Merge branch 'master' into q2-release-2024
michaelkad Jun 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
Expand All @@ -39,4 +39,4 @@ jobs:
run: go test -v `go list ./... | grep -v '/power/' | grep -v examples`

- name: Coverage
run: go test `go list ./... | grep -v '/power/' | grep -v examples` -coverprofile=profile.cov && go tool cover -func profile.cov
run: go test `go list ./... | grep -v '/power/' | grep -v examples` -coverprofile=profile.cov && go tool cover -func profile.cov
193 changes: 193 additions & 0 deletions clients/instance/ibm-pi-host-groups.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
package instance

import (
"context"
"fmt"

"github.com/IBM-Cloud/power-go-client/helpers"
"github.com/IBM-Cloud/power-go-client/ibmpisession"
"github.com/IBM-Cloud/power-go-client/power/client/host_groups"
"github.com/IBM-Cloud/power-go-client/power/models"
)

// IBMPIHostGroupsClient
type IBMPIHostGroupsClient struct {
IBMPIClient
}

// NewIBMPIHostGroupsClient
func NewIBMPIHostGroupsClient(ctx context.Context, sess *ibmpisession.IBMPISession, cloudInstanceID string) *IBMPIHostGroupsClient {
return &IBMPIHostGroupsClient{
*NewIBMPIClient(ctx, sess, cloudInstanceID),
}
}

// Get All available hosts
func (f *IBMPIHostGroupsClient) GetAvailableHosts() (models.AvailableHostList, error) {
if f.session.IsOnPrem() {
return nil, fmt.Errorf("operation not supported in satellite location, check documentation")
}
params := host_groups.NewV1AvailableHostsParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut)
resp, err := f.session.Power.HostGroups.V1AvailableHosts(params, f.session.AuthInfo(f.cloudInstanceID))
if err != nil {
return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to Get available hosts for %s: %w", f.cloudInstanceID, err))
}

if resp == nil || resp.Payload == nil {
return nil, fmt.Errorf("failed to get available hosts")
}
return resp.Payload, nil
}

// Get all host groups
func (f *IBMPIHostGroupsClient) GetHostGroups() (models.HostGroupList, error) {
if f.session.IsOnPrem() {
return nil, fmt.Errorf("operation not supported in satellite location, check documentation")
}
params := host_groups.NewV1HostGroupsGetParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut)
resp, err := f.session.Power.HostGroups.V1HostGroupsGet(params, f.session.AuthInfo(f.cloudInstanceID))
if err != nil {
return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to get Host groups for %s: %w", f.cloudInstanceID, err))
}

if resp == nil || resp.Payload == nil {
return nil, fmt.Errorf("failed to get host groups")
}
return resp.Payload, nil
}

// Create a host group
func (f *IBMPIHostGroupsClient) CreateHostGroup(body *models.HostGroupCreate) (*models.HostGroup, error) {
if f.session.IsOnPrem() {
return nil, fmt.Errorf("operation not supported in satellite location, check documentation")
}
params := host_groups.NewV1HostGroupsPostParams().WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut).WithBody(body)
resp, err := f.session.Power.HostGroups.V1HostGroupsPost(params, f.session.AuthInfo(f.cloudInstanceID))
if err != nil {
return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to create host group for %s: %w", f.cloudInstanceID, err))
}

if resp == nil || resp.Payload == nil {
return nil, fmt.Errorf("failed to create host groups")
}
return resp.Payload, nil
}

// Update a host group
func (f *IBMPIHostGroupsClient) UpdateHostGroup(body *models.HostGroupShareOp, id string) (*models.HostGroup, error) {
if f.session.IsOnPrem() {
return nil, fmt.Errorf("operation not supported in satellite location, check documentation")
}
params := host_groups.NewV1HostGroupsIDPutParams().WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut).WithBody(body).WithHostGroupID(id)
resp, err := f.session.Power.HostGroups.V1HostGroupsIDPut(params, f.session.AuthInfo(f.cloudInstanceID))
if err != nil {
return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to update host group for %s: %w", f.cloudInstanceID, err))
}

if resp == nil || resp.Payload == nil {
return nil, fmt.Errorf("failed to update host groups")
}
return resp.Payload, nil
}

// Get a host group
func (f *IBMPIHostGroupsClient) GetHostGroup(id string) (*models.HostGroup, error) {
if f.session.IsOnPrem() {
return nil, fmt.Errorf("operation not supported in satellite location, check documentation")
}
params := host_groups.NewV1HostGroupsIDGetParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).WithHostGroupID(id)
resp, err := f.session.Power.HostGroups.V1HostGroupsIDGet(params, f.session.AuthInfo(f.cloudInstanceID))
if err != nil {
return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to get host group %s for %s: %w", id, f.cloudInstanceID, err))
}

if resp == nil || resp.Payload == nil {
return nil, fmt.Errorf("failed to get host group %s", id)
}
return resp.Payload, nil
}

// Get all hosts
func (f *IBMPIHostGroupsClient) GetHosts() (models.HostList, error) {
if f.session.IsOnPrem() {
return nil, fmt.Errorf("operation not supported in satellite location, check documentation")
}
params := host_groups.NewV1HostsGetParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut)
resp, err := f.session.Power.HostGroups.V1HostsGet(params, f.session.AuthInfo(f.cloudInstanceID))
if err != nil {
return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to get hosts for %s: %w", f.cloudInstanceID, err))
}

if resp == nil || resp.Payload == nil {
return nil, fmt.Errorf("failed to get hosts")
}
return resp.Payload, nil
}

// Create a host
func (f *IBMPIHostGroupsClient) CreateHost(body *models.HostCreate) (models.HostList, error) {
if f.session.IsOnPrem() {
return nil, fmt.Errorf("operation not supported in satellite location, check documentation")
}
params := host_groups.NewV1HostsPostParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).WithBody(body)
resp, err := f.session.Power.HostGroups.V1HostsPost(params, f.session.AuthInfo(f.cloudInstanceID))
if err != nil {
return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to create a host for %s: %w", f.cloudInstanceID, err))
}

if resp == nil || resp.Payload == nil {
return nil, fmt.Errorf("failed to create a host")
}
return resp.Payload, nil
}

// Get a host
func (f *IBMPIHostGroupsClient) GetHost(id string) (*models.Host, error) {
if f.session.IsOnPrem() {
return nil, fmt.Errorf("operation not supported in satellite location, check documentation")
}
params := host_groups.NewV1HostsIDGetParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).WithHostID(id)
resp, err := f.session.Power.HostGroups.V1HostsIDGet(params, f.session.AuthInfo(f.cloudInstanceID))
if err != nil {
return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to get host %s for %s: %w", id, f.cloudInstanceID, err))
}

if resp == nil || resp.Payload == nil {
return nil, fmt.Errorf("failed to get host %s", id)
}
return resp.Payload, nil
}

// Update a host
func (f *IBMPIHostGroupsClient) UpdateHost(body *models.HostPut, id string) (*models.Host, error) {
if f.session.IsOnPrem() {
return nil, fmt.Errorf("operation not supported in satellite location, check documentation")
}
params := host_groups.NewV1HostsIDPutParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).WithHostID(id).WithBody(body)
resp, err := f.session.Power.HostGroups.V1HostsIDPut(params, f.session.AuthInfo(f.cloudInstanceID))
if err != nil {
return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to update host %s for %s: %w", id, f.cloudInstanceID, err))
}

if resp == nil || resp.Payload == nil {
return nil, fmt.Errorf("failed to update host %s", id)
}
return resp.Payload, nil
}

// Delete a host
func (f *IBMPIHostGroupsClient) DeleteHost(id string) error {
if f.session.IsOnPrem() {
return fmt.Errorf("operation not supported in satellite location, check documentation")
}
params := host_groups.NewV1HostsIDDeleteParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).WithHostID(id)
resp, err := f.session.Power.HostGroups.V1HostsIDDelete(params, f.session.AuthInfo(f.cloudInstanceID))
if err != nil {
return ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to delete host %s for %s: %w", id, f.cloudInstanceID, err))
}

if resp == nil || resp.Payload == nil {
return fmt.Errorf("failed to delete host %s", id)
}
return nil
}
8 changes: 8 additions & 0 deletions clients/instance/ibm-pi-image.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ func (f *IBMPIImageClient) Create(body *models.CreateImage) (*models.Image, erro

// Import an Image
func (f *IBMPIImageClient) CreateCosImage(body *models.CreateCosImageImportJob) (imageJob *models.JobReference, err error) {
// Check for satellite differences in this endpoint
if !f.session.IsOnPrem() && body.Checksum {
return nil, fmt.Errorf("checksum parameter is not supported off-premise")
}
params := p_cloud_images.NewPcloudV1CloudinstancesCosimagesPostParams().
WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut).
WithCloudInstanceID(f.cloudInstanceID).WithBody(body)
Expand All @@ -94,6 +98,10 @@ func (f *IBMPIImageClient) CreateCosImage(body *models.CreateCosImageImportJob)

// Export an Image
func (f *IBMPIImageClient) ExportImage(id string, body *models.ExportImage) (*models.JobReference, error) {
// Check for satellite differences in this endpoint
if !f.session.IsOnPrem() && body.Checksum {
return nil, fmt.Errorf("checksum parameter is not supported off-premise")
}
params := p_cloud_images.NewPcloudV2ImagesExportPostParams().
WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut).
WithCloudInstanceID(f.cloudInstanceID).WithImageID(id).WithBody(body)
Expand Down
8 changes: 6 additions & 2 deletions clients/instance/ibm-pi-instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ func (f *IBMPIInstanceClient) GetAll() (*models.PVMInstances, error) {
// Create an Instance
func (f *IBMPIInstanceClient) Create(body *models.PVMInstanceCreate) (*models.PVMInstanceList, error) {
// Check for satellite differences in this endpoint
if f.session.IsOnPrem() && (body.SoftwareLicenses != nil || body.SharedProcessorPool != "") {
return nil, fmt.Errorf("software licenses and shared processor pool parameters are not supported in satellite location, check documentation")
if f.session.IsOnPrem() && body.DeploymentTarget != nil {
return nil, fmt.Errorf("deployment target parameter is not supported in satellite location, check documentation")
}
params := p_cloud_p_vm_instances.NewPcloudPvminstancesPostParams().
WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut).
Expand Down Expand Up @@ -176,6 +176,10 @@ func (f *IBMPIInstanceClient) UpdateConsoleLanguage(id string, body *models.Cons

// Capture an Instance
func (f *IBMPIInstanceClient) CaptureInstanceToImageCatalog(id string, body *models.PVMInstanceCapture) error {
// Check for satellite differences in this endpoint
if !f.session.IsOnPrem() && body.Checksum {
return fmt.Errorf("checksum parameter is not supported off-premise")
}
params := p_cloud_p_vm_instances.NewPcloudPvminstancesCapturePostParams().
WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).
WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id).
Expand Down
17 changes: 3 additions & 14 deletions clients/instance/ibm-pi-shared-processor-pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ func NewIBMPISharedProcessorPoolClient(ctx context.Context, sess *ibmpisession.I

// Get a PI Shared Processor Pool
func (f *IBMPISharedProcessorPoolClient) Get(id string) (*models.SharedProcessorPoolDetail, error) {
if f.session.IsOnPrem() {
return nil, fmt.Errorf("operation not supported in satellite location, check documentation")
}
params := p_cloud_shared_processor_pools.NewPcloudSharedprocessorpoolsGetParams().
WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).
WithCloudInstanceID(f.cloudInstanceID).WithSharedProcessorPoolID(id)
Expand All @@ -44,9 +41,6 @@ func (f *IBMPISharedProcessorPoolClient) Get(id string) (*models.SharedProcessor

// Get All Shared Processor Pools
func (f *IBMPISharedProcessorPoolClient) GetAll() (*models.SharedProcessorPools, error) {
if f.session.IsOnPrem() {
return nil, fmt.Errorf("operation not supported in satellite location, check documentation")
}
params := p_cloud_shared_processor_pools.NewPcloudSharedprocessorpoolsGetallParams().
WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).
WithCloudInstanceID(f.cloudInstanceID)
Expand All @@ -62,8 +56,9 @@ func (f *IBMPISharedProcessorPoolClient) GetAll() (*models.SharedProcessorPools,

// Create a Shared Processor Pool
func (f *IBMPISharedProcessorPoolClient) Create(body *models.SharedProcessorPoolCreate) (*models.SharedProcessorPool, error) {
if f.session.IsOnPrem() {
return nil, fmt.Errorf("operation not supported in satellite location, check documentation")
// Check for satellite differences in this endpoint
if f.session.IsOnPrem() && body.HostID != "" {
return nil, fmt.Errorf("host id parameter is not supported in satellite location, check documentation")
}
params := p_cloud_shared_processor_pools.NewPcloudSharedprocessorpoolsPostParams().
WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut).
Expand All @@ -80,9 +75,6 @@ func (f *IBMPISharedProcessorPoolClient) Create(body *models.SharedProcessorPool

// Delete a Shared Processor Pool
func (f *IBMPISharedProcessorPoolClient) Delete(id string) error {
if f.session.IsOnPrem() {
return fmt.Errorf("operation not supported in satellite location, check documentation")
}
params := p_cloud_shared_processor_pools.NewPcloudSharedprocessorpoolsDeleteParams().
WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut).
WithCloudInstanceID(f.cloudInstanceID).WithSharedProcessorPoolID(id)
Expand All @@ -95,9 +87,6 @@ func (f *IBMPISharedProcessorPoolClient) Delete(id string) error {

// Update a PI Shared Processor Pool
func (f *IBMPISharedProcessorPoolClient) Update(id string, body *models.SharedProcessorPoolUpdate) (*models.SharedProcessorPool, error) {
if f.session.IsOnPrem() {
return nil, fmt.Errorf("operation not supported in satellite location, check documentation")
}
params := p_cloud_shared_processor_pools.NewPcloudSharedprocessorpoolsPutParams().
WithContext(f.ctx).WithTimeout(helpers.PIUpdateTimeOut).
WithCloudInstanceID(f.cloudInstanceID).WithBody(body).WithSharedProcessorPoolID(id)
Expand Down
62 changes: 62 additions & 0 deletions examples/host-groups/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package main

import (
"context"
"log"

v "github.com/IBM-Cloud/power-go-client/clients/instance"
ps "github.com/IBM-Cloud/power-go-client/ibmpisession"
"github.com/IBM/go-sdk-core/v5/core"
)

func main() {
//session Inputs
// < IAM TOKEN >
// token := ""
apiKey := ""
region := " < REGION > "
zone := " < ZONE > "
accountID := " < ACCOUNT ID > "
url := region + ".power-iaas.test.cloud.ibm.com"

// dr location inputs
piID := " < POWER INSTANCE ID > "

// authenticator := &core.BearerTokenAuthenticator{
// BearerToken: token,
// }
authenticator := &core.IamAuthenticator{
ApiKey: apiKey,
// Uncomment for test environment
URL: "https://iam.test.cloud.ibm.com",
}

// Create the session
options := &ps.IBMPIOptions{
Authenticator: authenticator,
UserAccount: accountID,
Zone: zone,
URL: url,
Debug: true,
}
session, err := ps.NewIBMPISession(options)
if err != nil {
log.Fatal(err)
}
powerClient := v.NewIBMPIHostGroupsClient(context.Background(), session, piID)
if err != nil {
log.Fatal(err)
}

getAllAvailableHost, err := powerClient.GetAvailableHosts()
if err != nil {
log.Fatal(err)
}
log.Printf("***************[0]****************** %+v \n", getAllAvailableHost)

getHostGroups, err := powerClient.GetHostGroups()
if err != nil {
log.Fatal(err)
}
log.Printf("***************[1]****************** %+v \n", getHostGroups)
}
Loading