Skip to content

Commit

Permalink
Merge branch 'bill-snapshot' of https://github.com/manukm-ibm/platfor…
Browse files Browse the repository at this point in the history
…m-services-go-sdk into bill-snapshot
  • Loading branch information
manukm-ibm committed Sep 13, 2023
2 parents 8bf0b77 + 7e755d4 commit fcab151
Show file tree
Hide file tree
Showing 13 changed files with 336 additions and 265 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.47.1
current_version = 0.49.0
commit = True
message = Update version {current_version} -> {new_version} [skip ci]

Expand Down
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
# [0.49.0](https://github.com/IBM/platform-services-go-sdk/compare/v0.48.1...v0.49.0) (2023-09-13)


### Features

* **Context-Based Restrictions:** add service group support to operations ([#277](https://github.com/IBM/platform-services-go-sdk/issues/277)) ([8ecdfa5](https://github.com/IBM/platform-services-go-sdk/commit/8ecdfa520c0254fbc366b80680b4bc7eab8565d5))

## [0.48.1](https://github.com/IBM/platform-services-go-sdk/compare/v0.48.0...v0.48.1) (2023-09-05)


### Bug Fixes

* **IAM Access Groups:** rRemove update action control from assertions ([#276](https://github.com/IBM/platform-services-go-sdk/issues/276)) ([75ec5ee](https://github.com/IBM/platform-services-go-sdk/commit/75ec5ee4d6924c7a785c1349e05cfd5060fc94ae))

# [0.48.0](https://github.com/IBM/platform-services-go-sdk/compare/v0.47.1...v0.48.0) (2023-09-01)


### Features

* **Resource Controller:** support resource group filter for list reclamations ([#264](https://github.com/IBM/platform-services-go-sdk/issues/264)) ([6985653](https://github.com/IBM/platform-services-go-sdk/commit/6985653a853b73e06189b40547f38afffa6513c0))

## [0.47.1](https://github.com/IBM/platform-services-go-sdk/compare/v0.47.0...v0.47.1) (2023-08-31)


Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[![CLA assistant](https://cla-assistant.io/readme/badge/IBM/platform-services-go-sdk)](https://cla-assistant.io/IBM/platform-services-go-sdk)


# IBM Cloud Platform Services Go SDK Version 0.47.1
# IBM Cloud Platform Services Go SDK Version 0.49.0

Go client library to interact with various
[IBM Cloud Platform Service APIs](https://cloud.ibm.com/docs?tab=api-docs&category=platform_services).
Expand Down Expand Up @@ -86,7 +86,7 @@ Service Name | Package name
* Go version 1.19 or above.

## Installation
The current version of this SDK: 0.47.1
The current version of this SDK: 0.49.0

### Go modules
If your application uses Go modules for dependency management (recommended), just add an import for each service
Expand Down
2 changes: 1 addition & 1 deletion common/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
package common

// Version of the SDK
const Version = "0.47.1"
const Version = "0.49.0"
86 changes: 66 additions & 20 deletions contextbasedrestrictionsv1/context_based_restrictions_v1.go

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// +build examples

/**
* (C) Copyright IBM Corp. 2022.
* (C) Copyright IBM Corp. 2023.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -461,9 +461,8 @@ var _ = Describe(`ContextBasedRestrictionsV1 Examples Tests`, func() {
fmt.Println("\nListAvailableServiceOperations() result:")
// begin-list_available_service_operations

listAvailableServiceOperationsOptions := contextBasedRestrictionsService.NewListAvailableServiceOperationsOptions(
"containers-kubernetes",
)
listAvailableServiceOperationsOptions := contextBasedRestrictionsService.NewListAvailableServiceOperationsOptions()
listAvailableServiceOperationsOptions.SetServiceName("containers-kubernetes")

operationsList, response, err := contextBasedRestrictionsService.ListAvailableServiceOperations(listAvailableServiceOperationsOptions)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
//go:build integration
// +build integration

/**
* (C) Copyright IBM Corp. 2022.
* (C) Copyright IBM Corp. 2023.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -688,11 +687,11 @@ var _ = Describe(`ContextBasedRestrictionsV1 Integration Tests`, func() {
Expect(response.StatusCode).To(Equal(201))
Expect(rule).ToNot(BeNil())

//list rule with service_group_id
//list rule with service_group_id
listRulesOptions := &contextbasedrestrictionsv1.ListRulesOptions{
AccountID: core.StringPtr(testAccountID),
AccountID: core.StringPtr(testAccountID),
ServiceGroupID: core.StringPtr("IAM"),
TransactionID: getTransactionID(),
TransactionID: getTransactionID(),
}

ruleList, response, err := contextBasedRestrictionsService.ListRules(listRulesOptions)
Expand All @@ -702,7 +701,7 @@ var _ = Describe(`ContextBasedRestrictionsV1 Integration Tests`, func() {
Expect(*ruleList.Count).To(Equal(int64(1)))
Expect(*ruleList.Rules[0].ID).To(Equal(*rule.ID))

// cleanup
// cleanup
deleteRuleOptions := &contextbasedrestrictionsv1.DeleteRuleOptions{
RuleID: rule.ID,
TransactionID: getTransactionID(),
Expand Down Expand Up @@ -1046,7 +1045,7 @@ var _ = Describe(`ContextBasedRestrictionsV1 Integration Tests`, func() {
})
})

Describe(`ListAvailableServiceOperations - List available service operations`, func() {
Describe(`ListAvailableServiceOperations - List available service operations with Service Name`, func() {
BeforeEach(func() {
shouldSkipTest()
})
Expand All @@ -1062,6 +1061,39 @@ var _ = Describe(`ContextBasedRestrictionsV1 Integration Tests`, func() {
Expect(operationsList).ToNot(BeNil())
})
})
Describe(`ListAvailableServiceOperations - List available service operations with Service Group ID`, func() {
BeforeEach(func() {
shouldSkipTest()
})
It(`ListAvailableServiceOperations(listAvailableServiceOperationsOptions *ListAvailableServiceOperationsOptions)`, func() {
listAvailableServiceOperationsOptions := &contextbasedrestrictionsv1.ListAvailableServiceOperationsOptions{
ServiceGroupID: core.StringPtr("IAM"),
TransactionID: getTransactionID(),
}

operationsList, response, err := contextBasedRestrictionsService.ListAvailableServiceOperations(listAvailableServiceOperationsOptions)
Expect(err).To(BeNil())
Expect(response.StatusCode).To(Equal(200))
Expect(operationsList).ToNot(BeNil())
})
})
Describe(`ListAvailableServiceOperations - List available service operations with Composite Parent`, func() {
BeforeEach(func() {
shouldSkipTest()
})
It(`ListAvailableServiceOperations(listAvailableServiceOperationsOptions *ListAvailableServiceOperationsOptions)`, func() {
listAvailableServiceOperationsOptions := &contextbasedrestrictionsv1.ListAvailableServiceOperationsOptions{
ServiceName: core.StringPtr("iam-access-management"),
ResourceType: core.StringPtr("customRole"),
TransactionID: getTransactionID(),
}

operationsList, response, err := contextBasedRestrictionsService.ListAvailableServiceOperations(listAvailableServiceOperationsOptions)
Expect(err).To(BeNil())
Expect(response.StatusCode).To(Equal(200))
Expect(operationsList).ToNot(BeNil())
})
})

//
// Cleanup the created zones and rules
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corp. 2022.
* (C) Copyright IBM Corp. 2023.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
48 changes: 30 additions & 18 deletions contextbasedrestrictionsv1/context_based_restrictions_v1_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corp. 2022.
* (C) Copyright IBM Corp. 2023.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -3381,6 +3381,8 @@ var _ = Describe(`ContextBasedRestrictionsV1`, func() {
Expect(req.Header["Transaction-Id"]).ToNot(BeNil())
Expect(req.Header["Transaction-Id"][0]).To(Equal(fmt.Sprintf("%v", "testString")))
Expect(req.URL.Query()["service_name"]).To(Equal([]string{"testString"}))
Expect(req.URL.Query()["service_group_id"]).To(Equal([]string{"testString"}))
Expect(req.URL.Query()["resource_type"]).To(Equal([]string{"testString"}))
res.Header().Set("Content-type", "application/json")
res.WriteHeader(200)
fmt.Fprint(res, `} this is not valid json {`)
Expand All @@ -3396,9 +3398,11 @@ var _ = Describe(`ContextBasedRestrictionsV1`, func() {

// Construct an instance of the ListAvailableServiceOperationsOptions model
listAvailableServiceOperationsOptionsModel := new(contextbasedrestrictionsv1.ListAvailableServiceOperationsOptions)
listAvailableServiceOperationsOptionsModel.ServiceName = core.StringPtr("testString")
listAvailableServiceOperationsOptionsModel.XCorrelationID = core.StringPtr("testString")
listAvailableServiceOperationsOptionsModel.TransactionID = core.StringPtr("testString")
listAvailableServiceOperationsOptionsModel.ServiceName = core.StringPtr("testString")
listAvailableServiceOperationsOptionsModel.ServiceGroupID = core.StringPtr("testString")
listAvailableServiceOperationsOptionsModel.ResourceType = core.StringPtr("testString")
listAvailableServiceOperationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"}
// Expect response parsing to fail since we are receiving a text/plain response
result, response, operationErr := contextBasedRestrictionsService.ListAvailableServiceOperations(listAvailableServiceOperationsOptionsModel)
Expand Down Expand Up @@ -3434,6 +3438,8 @@ var _ = Describe(`ContextBasedRestrictionsV1`, func() {
Expect(req.Header["Transaction-Id"]).ToNot(BeNil())
Expect(req.Header["Transaction-Id"][0]).To(Equal(fmt.Sprintf("%v", "testString")))
Expect(req.URL.Query()["service_name"]).To(Equal([]string{"testString"}))
Expect(req.URL.Query()["service_group_id"]).To(Equal([]string{"testString"}))
Expect(req.URL.Query()["resource_type"]).To(Equal([]string{"testString"}))
// Sleep a short time to support a timeout test
time.Sleep(100 * time.Millisecond)

Expand All @@ -3454,9 +3460,11 @@ var _ = Describe(`ContextBasedRestrictionsV1`, func() {

// Construct an instance of the ListAvailableServiceOperationsOptions model
listAvailableServiceOperationsOptionsModel := new(contextbasedrestrictionsv1.ListAvailableServiceOperationsOptions)
listAvailableServiceOperationsOptionsModel.ServiceName = core.StringPtr("testString")
listAvailableServiceOperationsOptionsModel.XCorrelationID = core.StringPtr("testString")
listAvailableServiceOperationsOptionsModel.TransactionID = core.StringPtr("testString")
listAvailableServiceOperationsOptionsModel.ServiceName = core.StringPtr("testString")
listAvailableServiceOperationsOptionsModel.ServiceGroupID = core.StringPtr("testString")
listAvailableServiceOperationsOptionsModel.ResourceType = core.StringPtr("testString")
listAvailableServiceOperationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"}

// Invoke operation with a Context to test a timeout error
Expand Down Expand Up @@ -3498,6 +3506,8 @@ var _ = Describe(`ContextBasedRestrictionsV1`, func() {
Expect(req.Header["Transaction-Id"]).ToNot(BeNil())
Expect(req.Header["Transaction-Id"][0]).To(Equal(fmt.Sprintf("%v", "testString")))
Expect(req.URL.Query()["service_name"]).To(Equal([]string{"testString"}))
Expect(req.URL.Query()["service_group_id"]).To(Equal([]string{"testString"}))
Expect(req.URL.Query()["resource_type"]).To(Equal([]string{"testString"}))
// Set mock response
res.Header().Set("Content-type", "application/json")
res.WriteHeader(200)
Expand All @@ -3520,9 +3530,11 @@ var _ = Describe(`ContextBasedRestrictionsV1`, func() {

// Construct an instance of the ListAvailableServiceOperationsOptions model
listAvailableServiceOperationsOptionsModel := new(contextbasedrestrictionsv1.ListAvailableServiceOperationsOptions)
listAvailableServiceOperationsOptionsModel.ServiceName = core.StringPtr("testString")
listAvailableServiceOperationsOptionsModel.XCorrelationID = core.StringPtr("testString")
listAvailableServiceOperationsOptionsModel.TransactionID = core.StringPtr("testString")
listAvailableServiceOperationsOptionsModel.ServiceName = core.StringPtr("testString")
listAvailableServiceOperationsOptionsModel.ServiceGroupID = core.StringPtr("testString")
listAvailableServiceOperationsOptionsModel.ResourceType = core.StringPtr("testString")
listAvailableServiceOperationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"}

// Invoke operation with valid options model (positive test)
Expand All @@ -3532,7 +3544,7 @@ var _ = Describe(`ContextBasedRestrictionsV1`, func() {
Expect(result).ToNot(BeNil())

})
It(`Invoke ListAvailableServiceOperations with error: Operation validation and request error`, func() {
It(`Invoke ListAvailableServiceOperations with error: Operation request error`, func() {
contextBasedRestrictionsService, serviceErr := contextbasedrestrictionsv1.NewContextBasedRestrictionsV1(&contextbasedrestrictionsv1.ContextBasedRestrictionsV1Options{
URL: testServer.URL,
Authenticator: &core.NoAuthAuthenticator{},
Expand All @@ -3542,9 +3554,11 @@ var _ = Describe(`ContextBasedRestrictionsV1`, func() {

// Construct an instance of the ListAvailableServiceOperationsOptions model
listAvailableServiceOperationsOptionsModel := new(contextbasedrestrictionsv1.ListAvailableServiceOperationsOptions)
listAvailableServiceOperationsOptionsModel.ServiceName = core.StringPtr("testString")
listAvailableServiceOperationsOptionsModel.XCorrelationID = core.StringPtr("testString")
listAvailableServiceOperationsOptionsModel.TransactionID = core.StringPtr("testString")
listAvailableServiceOperationsOptionsModel.ServiceName = core.StringPtr("testString")
listAvailableServiceOperationsOptionsModel.ServiceGroupID = core.StringPtr("testString")
listAvailableServiceOperationsOptionsModel.ResourceType = core.StringPtr("testString")
listAvailableServiceOperationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"}
// Invoke operation with empty URL (negative test)
err := contextBasedRestrictionsService.SetServiceURL("")
Expand All @@ -3554,13 +3568,6 @@ var _ = Describe(`ContextBasedRestrictionsV1`, func() {
Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING))
Expect(response).To(BeNil())
Expect(result).To(BeNil())
// Construct a second instance of the ListAvailableServiceOperationsOptions model with no property values
listAvailableServiceOperationsOptionsModelNew := new(contextbasedrestrictionsv1.ListAvailableServiceOperationsOptions)
// Invoke operation with invalid model (negative test)
result, response, operationErr = contextBasedRestrictionsService.ListAvailableServiceOperations(listAvailableServiceOperationsOptionsModelNew)
Expect(operationErr).ToNot(BeNil())
Expect(response).To(BeNil())
Expect(result).To(BeNil())
})
AfterEach(func() {
testServer.Close()
Expand All @@ -3585,9 +3592,11 @@ var _ = Describe(`ContextBasedRestrictionsV1`, func() {

// Construct an instance of the ListAvailableServiceOperationsOptions model
listAvailableServiceOperationsOptionsModel := new(contextbasedrestrictionsv1.ListAvailableServiceOperationsOptions)
listAvailableServiceOperationsOptionsModel.ServiceName = core.StringPtr("testString")
listAvailableServiceOperationsOptionsModel.XCorrelationID = core.StringPtr("testString")
listAvailableServiceOperationsOptionsModel.TransactionID = core.StringPtr("testString")
listAvailableServiceOperationsOptionsModel.ServiceName = core.StringPtr("testString")
listAvailableServiceOperationsOptionsModel.ServiceGroupID = core.StringPtr("testString")
listAvailableServiceOperationsOptionsModel.ResourceType = core.StringPtr("testString")
listAvailableServiceOperationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"}

// Invoke operation
Expand Down Expand Up @@ -3785,16 +3794,19 @@ var _ = Describe(`ContextBasedRestrictionsV1`, func() {
})
It(`Invoke NewListAvailableServiceOperationsOptions successfully`, func() {
// Construct an instance of the ListAvailableServiceOperationsOptions model
serviceName := "testString"
listAvailableServiceOperationsOptionsModel := contextBasedRestrictionsService.NewListAvailableServiceOperationsOptions(serviceName)
listAvailableServiceOperationsOptionsModel.SetServiceName("testString")
listAvailableServiceOperationsOptionsModel := contextBasedRestrictionsService.NewListAvailableServiceOperationsOptions()
listAvailableServiceOperationsOptionsModel.SetXCorrelationID("testString")
listAvailableServiceOperationsOptionsModel.SetTransactionID("testString")
listAvailableServiceOperationsOptionsModel.SetServiceName("testString")
listAvailableServiceOperationsOptionsModel.SetServiceGroupID("testString")
listAvailableServiceOperationsOptionsModel.SetResourceType("testString")
listAvailableServiceOperationsOptionsModel.SetHeaders(map[string]string{"foo": "bar"})
Expect(listAvailableServiceOperationsOptionsModel).ToNot(BeNil())
Expect(listAvailableServiceOperationsOptionsModel.ServiceName).To(Equal(core.StringPtr("testString")))
Expect(listAvailableServiceOperationsOptionsModel.XCorrelationID).To(Equal(core.StringPtr("testString")))
Expect(listAvailableServiceOperationsOptionsModel.TransactionID).To(Equal(core.StringPtr("testString")))
Expect(listAvailableServiceOperationsOptionsModel.ServiceName).To(Equal(core.StringPtr("testString")))
Expect(listAvailableServiceOperationsOptionsModel.ServiceGroupID).To(Equal(core.StringPtr("testString")))
Expect(listAvailableServiceOperationsOptionsModel.ResourceType).To(Equal(core.StringPtr("testString")))
Expect(listAvailableServiceOperationsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"}))
})
It(`Invoke NewListAvailableServicerefTargetsOptions successfully`, func() {
Expand Down
Loading

0 comments on commit fcab151

Please sign in to comment.