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

fix(Activity Tracker): re-gen service after recent API changes #69

Merged
merged 2 commits into from
Dec 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
20 changes: 10 additions & 10 deletions atrackerv1/atracker_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

/*
* IBM OpenAPI SDK Code Generator Version: 99-SNAPSHOT-629bbb97-20201207-171303
* IBM OpenAPI SDK Code Generator Version: 99-SNAPSHOT-d753183b-20201209-145823
*/


Expand All @@ -35,7 +35,7 @@ import (

// AtrackerV1 : IBM Cloud Activity Tracking Service (ATracker Service for short) is an activity tracker configuration
// service for your application events as well as events from IBM services under your account. It is designed to enable
// you to route activity tracker events to your designated Cloud Object Storage location in different regions.
// you to route activity tracker events to your designated Cloud Object Storage location in different regions.
//
// Version: 1.0.0
type AtrackerV1 struct {
Expand Down Expand Up @@ -176,10 +176,10 @@ func (atracker *AtrackerV1) DisableRetries() {
}

// CreateTarget : Create a Cloud Object Storage target for a region
// Creates a new Cloud Object Storage (COS) target with specified COS endpoint information and credentials. Commonly
// the COS endpoint should be on the same region as ATracker Services where this API is invoked. The Target definition
// could only be referenced by the routing rules defined in the same region through the same API endpoint. If a COS
// endpoint to be used across multiple regions, you must define a target for each region's API endpoint.
// Creates a new Cloud Object Storage (COS) target with specified COS endpoint information and credentials. Commonly the
// COS endpoint should be on the same region as ATracker Services where this API is invoked. The Target definition could
// only be referenced by the routing rules defined in the same region through the same API endpoint. If a COS endpoint
// to be used across multiple regions, you must define a target for each region's API endpoint.
func (atracker *AtrackerV1) CreateTarget(createTargetOptions *CreateTargetOptions) (result *Target, response *core.DetailedResponse, err error) {
return atracker.CreateTargetWithContext(context.Background(), createTargetOptions)
}
Expand Down Expand Up @@ -479,7 +479,7 @@ func (atracker *AtrackerV1) DeleteTargetWithContext(ctx context.Context, deleteT
}

// CreateRoute : Create a Route for the region
// Creates a route with rules defined how to route AT events to targets for a region. For each account and region, only
// Creates a route with rules defined how to route AT events to targets for a region. For each account and region, only
// one route could be defined. A route could contain multiple rules which enable atracker service to match incoming AT
// events based on the source crn and forward the events to customer configured targets.
func (atracker *AtrackerV1) CreateRoute(createRouteOptions *CreateRouteOptions) (result *Route, response *core.DetailedResponse, err error) {
Expand Down Expand Up @@ -1358,7 +1358,7 @@ type CosEndpoint struct {
Bucket *string `json:"bucket" validate:"required"`

// The IAM Api key that have writer access to this cos instance. This credential will be masked in the response.
ApiKey *string `json:"api_key" validate:"required"`
APIKey *string `json:"api_key" validate:"required"`
}


Expand All @@ -1368,7 +1368,7 @@ func (*AtrackerV1) NewCosEndpoint(endpoint string, targetCRN string, bucket stri
Endpoint: core.StringPtr(endpoint),
TargetCRN: core.StringPtr(targetCRN),
Bucket: core.StringPtr(bucket),
ApiKey: core.StringPtr(apiKey),
APIKey: core.StringPtr(apiKey),
}
err = core.ValidateStruct(model, "required parameters")
return
Expand All @@ -1389,7 +1389,7 @@ func UnmarshalCosEndpoint(m map[string]json.RawMessage, result interface{}) (err
if err != nil {
return
}
err = core.UnmarshalPrimitive(m, "api_key", &obj.ApiKey)
err = core.UnmarshalPrimitive(m, "api_key", &obj.APIKey)
if err != nil {
return
}
Expand Down
60 changes: 30 additions & 30 deletions atrackerv1/atracker_v1_examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,25 @@ package atrackerv1_test
import (
"encoding/json"
"fmt"
"os"

"github.com/IBM/go-sdk-core/v4/core"
"github.com/IBM/platform-services-go-sdk/atrackerv1"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"os"
)

const externalConfigFile = "../atracker_v1.env"

var (
atrackerService *atrackerv1.AtrackerV1
config map[string]string
configLoaded bool = false
config map[string]string
configLoaded bool = false
)

// Globlal variables to hold link values
var (
routeIDLink string
targetIDLink string
)

func shouldSkipTest() {
Expand All @@ -44,12 +49,6 @@ func shouldSkipTest() {
}

var _ = Describe(`AtrackerV1 Examples Tests`, func() {

var (
targetID string
routeID string
)

Describe(`External configuration`, func() {
It("Successfully load the configuration", func() {
var err error
Expand Down Expand Up @@ -99,15 +98,15 @@ var _ = Describe(`AtrackerV1 Examples Tests`, func() {
// begin-create_target

cosEndpointModel := &atrackerv1.CosEndpoint{
Endpoint: core.StringPtr("s3.private.us-east.cloud-object-storage.appdomain.cloud"),
Endpoint: core.StringPtr("s3.private.us-east.cloud-object-storage.appdomain.cloud"),
TargetCRN: core.StringPtr("crn:v1:bluemix:public:cloud-object-storage:global:a/11111111111111111111111111111111:22222222-2222-2222-2222-222222222222::"),
Bucket: core.StringPtr("my-atracker-bucket"),
ApiKey: core.StringPtr("xxxxxxxxxxxxxx"),
Bucket: core.StringPtr("my-atracker-bucket"),
APIKey: core.StringPtr("xxxxxxxxxxxxxx"),
}

createTargetOptions := atrackerService.NewCreateTargetOptions(
"my-cos-target",
atrackerv1.CreateTargetOptionsTargetTypeCloudObjectStorageConst,
"cloud_object_storage",
cosEndpointModel,
)

Expand All @@ -123,7 +122,8 @@ var _ = Describe(`AtrackerV1 Examples Tests`, func() {
Expect(err).To(BeNil())
Expect(response.StatusCode).To(Equal(201))
Expect(target).ToNot(BeNil())
targetID = *target.ID

targetIDLink = *target.ID;

})
It(`ListTargets request example`, func() {
Expand All @@ -149,7 +149,7 @@ var _ = Describe(`AtrackerV1 Examples Tests`, func() {
// begin-get_target

getTargetOptions := atrackerService.NewGetTargetOptions(
targetID,
targetIDLink,
)

target, response, err := atrackerService.GetTarget(getTargetOptions)
Expand All @@ -170,16 +170,16 @@ var _ = Describe(`AtrackerV1 Examples Tests`, func() {
// begin-replace_target

cosEndpointModel := &atrackerv1.CosEndpoint{
Endpoint: core.StringPtr("s3.private.us-east.cloud-object-storage.appdomain.cloud"),
Endpoint: core.StringPtr("s3.private.us-east.cloud-object-storage.appdomain.cloud"),
TargetCRN: core.StringPtr("crn:v1:bluemix:public:cloud-object-storage:global:a/11111111111111111111111111111111:22222222-2222-2222-2222-222222222222::"),
Bucket: core.StringPtr("my-atracker-bucket"),
ApiKey: core.StringPtr("xxxxxxxxxxxxxx"),
Bucket: core.StringPtr("my-atracker-bucket"),
APIKey: core.StringPtr("xxxxxxxxxxxxxx"),
}

replaceTargetOptions := atrackerService.NewReplaceTargetOptions(
targetID,
targetIDLink,
"my-cos-target-modified",
atrackerv1.CreateTargetOptionsTargetTypeCloudObjectStorageConst,
"cloud_object_storage",
cosEndpointModel,
)

Expand All @@ -201,7 +201,7 @@ var _ = Describe(`AtrackerV1 Examples Tests`, func() {
// begin-create_route

ruleModel := &atrackerv1.Rule{
TargetIds: []string{targetID},
TargetIds: []string{targetIDLink},
}

createRouteOptions := atrackerService.NewCreateRouteOptions(
Expand All @@ -222,7 +222,9 @@ var _ = Describe(`AtrackerV1 Examples Tests`, func() {
Expect(err).To(BeNil())
Expect(response.StatusCode).To(Equal(201))
Expect(route).ToNot(BeNil())
routeID = *route.ID

routeIDLink = *route.ID;

})
It(`ListRoutes request example`, func() {
// begin-list_routes
Expand All @@ -247,7 +249,7 @@ var _ = Describe(`AtrackerV1 Examples Tests`, func() {
// begin-get_route

getRouteOptions := atrackerService.NewGetRouteOptions(
routeID,
routeIDLink,
)

route, response, err := atrackerService.GetRoute(getRouteOptions)
Expand All @@ -268,11 +270,11 @@ var _ = Describe(`AtrackerV1 Examples Tests`, func() {
// begin-replace_route

ruleModel := &atrackerv1.Rule{
TargetIds: []string{"c3af557f-fb0e-4476-85c3-0889e7fe7bc4"},
TargetIds: []string{targetIDLink},
}

replaceRouteOptions := atrackerService.NewReplaceRouteOptions(
routeID,
routeIDLink,
"my-route-modified",
false,
[]atrackerv1.Rule{*ruleModel},
Expand All @@ -292,12 +294,11 @@ var _ = Describe(`AtrackerV1 Examples Tests`, func() {
Expect(route).ToNot(BeNil())

})
//delete route first
It(`DeleteRoute request example`, func() {
// begin-delete_route

deleteRouteOptions := atrackerService.NewDeleteRouteOptions(
routeID,
routeIDLink,
)

response, err := atrackerService.DeleteRoute(deleteRouteOptions)
Expand All @@ -311,12 +312,11 @@ var _ = Describe(`AtrackerV1 Examples Tests`, func() {
Expect(response.StatusCode).To(Equal(204))

})
//then delete target
It(`DeleteTarget request example`, func() {
// begin-delete_target

deleteTargetOptions := atrackerService.NewDeleteTargetOptions(
targetID,
targetIDLink,
)

response, err := atrackerService.DeleteTarget(deleteTargetOptions)
Expand Down
Loading