From e0d0a501cabc6a488e96865b78c0560c3c005540 Mon Sep 17 00:00:00 2001 From: Ka Ieong Chan Date: Thu, 21 Mar 2024 16:33:47 -0400 Subject: [PATCH] Update to newer GO client version --- go.mod | 2 +- go.sum | 4 ++-- ...event_orchestration_cache_variable_util.go | 14 ++++++------- ...rchestration_global_cache_variable_test.go | 4 ++-- ...chestration_service_cache_variable_test.go | 4 ++-- .../event_orchestration_cache_variable.go | 21 +++++++------------ vendor/modules.txt | 4 ++-- 7 files changed, 23 insertions(+), 30 deletions(-) diff --git a/go.mod b/go.mod index bdd8d6ec8..7ab7f83ad 100644 --- a/go.mod +++ b/go.mod @@ -76,4 +76,4 @@ require ( gopkg.in/ini.v1 v1.67.0 // indirect ) -replace github.com/heimweh/go-pagerduty => github.com/c-kaieong/go-pagerduty v0.0.0-20240311200326-919db4bc1266 +replace github.com/heimweh/go-pagerduty => github.com/c-kaieong/go-pagerduty v0.0.0-20240321202501-cb1dc594997d diff --git a/go.sum b/go.sum index 6eb33b388..8999e9a2e 100644 --- a/go.sum +++ b/go.sum @@ -11,8 +11,8 @@ github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= -github.com/c-kaieong/go-pagerduty v0.0.0-20240311200326-919db4bc1266 h1:8b11EQOZpqOS6GgFDSF+3Nxo5kQ5DIFvNEZPAJtdTxA= -github.com/c-kaieong/go-pagerduty v0.0.0-20240311200326-919db4bc1266/go.mod h1:r59w5iyN01Qvi734yA5hZldbSeJJmsJzee/1kQ/MK7s= +github.com/c-kaieong/go-pagerduty v0.0.0-20240321202501-cb1dc594997d h1:Mk6+b9U0C4JlW3yt9YOeTRat0/5jSmNdyXmDSUDw0jI= +github.com/c-kaieong/go-pagerduty v0.0.0-20240321202501-cb1dc594997d/go.mod h1:r59w5iyN01Qvi734yA5hZldbSeJJmsJzee/1kQ/MK7s= github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= diff --git a/pagerduty/event_orchestration_cache_variable_util.go b/pagerduty/event_orchestration_cache_variable_util.go index e1a0af4fe..41423b741 100644 --- a/pagerduty/event_orchestration_cache_variable_util.go +++ b/pagerduty/event_orchestration_cache_variable_util.go @@ -125,7 +125,7 @@ func fetchPagerDutyEventOrchestrationCacheVariable(ctx context.Context, d *schem return nil, err } - if cacheVariable, _, err := client.EventOrchestrationCacheVariables.GetContext(ctx, cacheVariableType, oid, id); err != nil { + if cacheVariable, _, err := client.EventOrchestrationCacheVariables.Get(ctx, cacheVariableType, oid, id); err != nil { return nil, err } else if cacheVariable != nil { d.SetId(id) @@ -253,7 +253,7 @@ func resourceEventOrchestrationCacheVariableCreate(ctx context.Context, d *schem retryErr := retry.RetryContext(ctx, 2*time.Minute, func() *retry.RetryError { log.Printf("[INFO] Creating Cache Variable '%s' for PagerDuty Event Orchestration '%s'", payload.Name, oid) - if cacheVariable, _, err := client.EventOrchestrationCacheVariables.CreateContext(ctx, cacheVariableType, oid, payload); err != nil { + if cacheVariable, _, err := client.EventOrchestrationCacheVariables.Create(ctx, cacheVariableType, oid, payload); err != nil { if isErrCode(err, http.StatusBadRequest) || isErrCode(err, http.StatusNotFound) || isErrCode(err, http.StatusForbidden) { return retry.NonRetryableError(err) } @@ -316,7 +316,7 @@ func resourceEventOrchestrationCacheVariableUpdate(ctx context.Context, d *schem retryErr := retry.RetryContext(ctx, 2*time.Minute, func() *retry.RetryError { log.Printf("[INFO] Updating Cache Variable '%s' for PagerDuty Event Orchestration: %s", id, oid) - if cacheVariable, _, err := client.EventOrchestrationCacheVariables.UpdateContext(ctx, cacheVariableType, oid, id, payload); err != nil { + if cacheVariable, _, err := client.EventOrchestrationCacheVariables.Update(ctx, cacheVariableType, oid, id, payload); err != nil { if isErrCode(err, http.StatusBadRequest) || isErrCode(err, http.StatusNotFound) || isErrCode(err, http.StatusForbidden) { return retry.NonRetryableError(err) } @@ -347,7 +347,7 @@ func resourceEventOrchestrationCacheVariableDelete(ctx context.Context, d *schem retryErr := retry.RetryContext(ctx, 2*time.Minute, func() *retry.RetryError { log.Printf("[INFO] Deleting Cache Variable '%s' for PagerDuty Event Orchestration: %s", id, oid) - if _, err := client.EventOrchestrationCacheVariables.DeleteContext(ctx, cacheVariableType, oid, id); err != nil { + if _, err := client.EventOrchestrationCacheVariables.Delete(ctx, cacheVariableType, oid, id); err != nil { if isErrCode(err, http.StatusBadRequest) || isErrCode(err, http.StatusNotFound) || isErrCode(err, http.StatusForbidden) { return retry.NonRetryableError(err) } @@ -355,7 +355,7 @@ func resourceEventOrchestrationCacheVariableDelete(ctx context.Context, d *schem return retry.RetryableError(err) } else { // Try reading an cache variable after deletion, retry if still found: - if cacheVariable, _, readErr := client.EventOrchestrationCacheVariables.GetContext(ctx, cacheVariableType, oid, id); readErr == nil && cacheVariable != nil { + if cacheVariable, _, readErr := client.EventOrchestrationCacheVariables.Get(ctx, cacheVariableType, oid, id); readErr == nil && cacheVariable != nil { log.Printf("[WARN] Cache Variable '%s' still exists on PagerDuty Event Orchestration '%s'. Retrying deletion...", id, oid) return retry.RetryableError(fmt.Errorf("Cache Variable '%s' still exists on PagerDuty Event Orchestration '%s'.", id, oid)) } @@ -417,7 +417,7 @@ func getEventOrchestrationCacheVariableById(ctx context.Context, d *schema.Resou retryErr := retry.RetryContext(ctx, 2*time.Minute, func() *retry.RetryError { log.Printf("[INFO] Reading Cache Variable data source by ID '%s' for PagerDuty Event Orchestration '%s'", id, oid) - if cacheVariable, _, err := client.EventOrchestrationCacheVariables.GetContext(ctx, cacheVariableType, oid, id); err != nil { + if cacheVariable, _, err := client.EventOrchestrationCacheVariables.Get(ctx, cacheVariableType, oid, id); err != nil { if isErrCode(err, http.StatusBadRequest) { return retry.NonRetryableError(err) } @@ -451,7 +451,7 @@ func getEventOrchestrationCacheVariableByName(ctx context.Context, d *schema.Res retryErr := retry.RetryContext(ctx, 2*time.Minute, func() *retry.RetryError { log.Printf("[INFO] Reading Cache Variable data source by name '%s' for PagerDuty Event Orchestration '%s'", name, oid) - resp, _, err := client.EventOrchestrationCacheVariables.ListContext(ctx, cacheVariableType, oid) + resp, _, err := client.EventOrchestrationCacheVariables.List(ctx, cacheVariableType, oid) if err != nil { if isErrCode(err, http.StatusBadRequest) { return retry.NonRetryableError(err) diff --git a/pagerduty/resource_pagerduty_event_orchestration_global_cache_variable_test.go b/pagerduty/resource_pagerduty_event_orchestration_global_cache_variable_test.go index 08e3a2267..0fa2fe51d 100644 --- a/pagerduty/resource_pagerduty_event_orchestration_global_cache_variable_test.go +++ b/pagerduty/resource_pagerduty_event_orchestration_global_cache_variable_test.go @@ -112,7 +112,7 @@ func testAccCheckPagerDutyEventOrchestrationGlobalCacheVariableDestroy(s *terraf if r.Type != "pagerduty_event_orchestration_global_cache_variable" { continue } - if _, _, err := client.EventOrchestrationCacheVariables.GetContext(context.Background(), pagerduty.CacheVariableTypeGlobal, r.Primary.Attributes["event_orchestration"], r.Primary.ID); err == nil { + if _, _, err := client.EventOrchestrationCacheVariables.Get(context.Background(), pagerduty.CacheVariableTypeGlobal, r.Primary.Attributes["event_orchestration"], r.Primary.ID); err == nil { return fmt.Errorf("Event Orchestration Cache Variables still exist") } } @@ -143,7 +143,7 @@ func testAccCheckPagerDutyEventOrchestrationGlobalCacheVariableID(cv, orchn stri id := ir.Primary.ID client, _ := testAccProvider.Meta().(*Config).Client() - i, _, err := client.EventOrchestrationCacheVariables.GetContext(context.Background(), pagerduty.CacheVariableTypeGlobal, oid, id) + i, _, err := client.EventOrchestrationCacheVariables.Get(context.Background(), pagerduty.CacheVariableTypeGlobal, oid, id) eo, _, _ := client.EventOrchestrations.Get(eor.Primary.ID) if err != nil { diff --git a/pagerduty/resource_pagerduty_event_orchestration_service_cache_variable_test.go b/pagerduty/resource_pagerduty_event_orchestration_service_cache_variable_test.go index 597701ef9..65affa12a 100644 --- a/pagerduty/resource_pagerduty_event_orchestration_service_cache_variable_test.go +++ b/pagerduty/resource_pagerduty_event_orchestration_service_cache_variable_test.go @@ -112,7 +112,7 @@ func testAccCheckPagerDutyEventOrchestrationServiceCacheVariableDestroy(s *terra if r.Type != "pagerduty_event_orchestration_service_cache_variable" { continue } - if _, _, err := client.EventOrchestrationCacheVariables.GetContext(context.Background(), pagerduty.CacheVariableTypeService, r.Primary.Attributes["event_orchestration"], r.Primary.ID); err == nil { + if _, _, err := client.EventOrchestrationCacheVariables.Get(context.Background(), pagerduty.CacheVariableTypeService, r.Primary.Attributes["event_orchestration"], r.Primary.ID); err == nil { return fmt.Errorf("Event Orchestration Cache Variables still exist") } } @@ -143,7 +143,7 @@ func testAccCheckPagerDutyEventOrchestrationServiceCacheVariableID(cv, svcn stri id := ir.Primary.ID client, _ := testAccProvider.Meta().(*Config).Client() - i, _, err := client.EventOrchestrationCacheVariables.GetContext(context.Background(), pagerduty.CacheVariableTypeService, sid, id) + i, _, err := client.EventOrchestrationCacheVariables.Get(context.Background(), pagerduty.CacheVariableTypeService, sid, id) svc, _, _ := client.Services.Get(svcr.Primary.ID, &pagerduty.GetServiceOptions{}) if err != nil { diff --git a/vendor/github.com/heimweh/go-pagerduty/pagerduty/event_orchestration_cache_variable.go b/vendor/github.com/heimweh/go-pagerduty/pagerduty/event_orchestration_cache_variable.go index 8cc976a2d..6df0fa845 100644 --- a/vendor/github.com/heimweh/go-pagerduty/pagerduty/event_orchestration_cache_variable.go +++ b/vendor/github.com/heimweh/go-pagerduty/pagerduty/event_orchestration_cache_variable.go @@ -22,13 +22,6 @@ type EventOrchestrationCacheVariableConfiguration struct { TTLSeconds int `json:"ttl_seconds,omitempty"` } -// A reference to a related object (e.g. an User, etc) -type EventOrchestrationCacheVariableReference struct { - ID string `json:"id,omitempty"` - Type string `json:"type,omitempty"` - Self string `json:"self,omitempty"` -} - type EventOrchestrationCacheVariable struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` @@ -36,9 +29,9 @@ type EventOrchestrationCacheVariable struct { Conditions []*EventOrchestrationCacheVariableCondition `json:"conditions"` Configuration *EventOrchestrationCacheVariableConfiguration `json:"configuration,omitempty"` CreatedAt string `json:"created_at,omitempty"` - CreatedBy *EventOrchestrationCacheVariableReference `json:"created_by,omitempty"` + CreatedBy *UserReference `json:"created_by,omitempty"` UpdatedAt string `json:"updated_at,omitempty"` - UpdatedBy *EventOrchestrationCacheVariableReference `json:"updated_by,omitempty"` + UpdatedBy *UserReference `json:"updated_by,omitempty"` } type EventOrchestrationCacheVariablePayload struct { @@ -61,7 +54,7 @@ func buildEventOrchestrationCacheVariableUrl(cacheVariableType string, orchestra return fmt.Sprintf("%s/%s/cache_variables/%s", eventOrchestrationBaseUrl, orchestrationId, cacheVariableId) } -func (s *EventOrchestrationCacheVariableService) ListContext(ctx context.Context, cacheVariableType string, orchestrationId string) (*ListEventOrchestrationCacheVariablesResponse, *Response, error) { +func (s *EventOrchestrationCacheVariableService) List(ctx context.Context, cacheVariableType string, orchestrationId string) (*ListEventOrchestrationCacheVariablesResponse, *Response, error) { u := buildEventOrchestrationCacheVariableUrl(cacheVariableType, orchestrationId, "") v := new(ListEventOrchestrationCacheVariablesResponse) @@ -74,7 +67,7 @@ func (s *EventOrchestrationCacheVariableService) ListContext(ctx context.Context return v, resp, nil } -func (s *EventOrchestrationCacheVariableService) CreateContext(ctx context.Context, cacheVariableType string, orchestrationId string, cacheVariable *EventOrchestrationCacheVariable) (*EventOrchestrationCacheVariable, *Response, error) { +func (s *EventOrchestrationCacheVariableService) Create(ctx context.Context, cacheVariableType string, orchestrationId string, cacheVariable *EventOrchestrationCacheVariable) (*EventOrchestrationCacheVariable, *Response, error) { u := buildEventOrchestrationCacheVariableUrl(cacheVariableType, orchestrationId, "") v := new(EventOrchestrationCacheVariablePayload) p := &EventOrchestrationCacheVariablePayload{CacheVariable: cacheVariable} @@ -88,7 +81,7 @@ func (s *EventOrchestrationCacheVariableService) CreateContext(ctx context.Conte return v.CacheVariable, resp, nil } -func (s *EventOrchestrationCacheVariableService) GetContext(ctx context.Context, cacheVariableType string, orchestrationId string, cacheVariableId string) (*EventOrchestrationCacheVariable, *Response, error) { +func (s *EventOrchestrationCacheVariableService) Get(ctx context.Context, cacheVariableType string, orchestrationId string, cacheVariableId string) (*EventOrchestrationCacheVariable, *Response, error) { u := buildEventOrchestrationCacheVariableUrl(cacheVariableType, orchestrationId, cacheVariableId) v := new(EventOrchestrationCacheVariablePayload) @@ -100,7 +93,7 @@ func (s *EventOrchestrationCacheVariableService) GetContext(ctx context.Context, return v.CacheVariable, resp, nil } -func (s *EventOrchestrationCacheVariableService) UpdateContext(ctx context.Context, cacheVariableType string, orchestrationId string, cacheVariableId string, cacheVariable *EventOrchestrationCacheVariable) (*EventOrchestrationCacheVariable, *Response, error) { +func (s *EventOrchestrationCacheVariableService) Update(ctx context.Context, cacheVariableType string, orchestrationId string, cacheVariableId string, cacheVariable *EventOrchestrationCacheVariable) (*EventOrchestrationCacheVariable, *Response, error) { u := buildEventOrchestrationCacheVariableUrl(cacheVariableType, orchestrationId, cacheVariableId) v := new(EventOrchestrationCacheVariablePayload) p := &EventOrchestrationCacheVariablePayload{CacheVariable: cacheVariable} @@ -113,7 +106,7 @@ func (s *EventOrchestrationCacheVariableService) UpdateContext(ctx context.Conte return v.CacheVariable, resp, nil } -func (s *EventOrchestrationCacheVariableService) DeleteContext(ctx context.Context, cacheVariableType string, orchestrationId string, cacheVariableId string) (*Response, error) { +func (s *EventOrchestrationCacheVariableService) Delete(ctx context.Context, cacheVariableType string, orchestrationId string, cacheVariableId string) (*Response, error) { u := buildEventOrchestrationCacheVariableUrl(cacheVariableType, orchestrationId, cacheVariableId) return s.client.newRequestDoContext(ctx, "DELETE", u, nil, nil, nil) } diff --git a/vendor/modules.txt b/vendor/modules.txt index 0cb98da4f..e96298450 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -250,7 +250,7 @@ github.com/hashicorp/terraform-svchost # github.com/hashicorp/yamux v0.1.1 ## explicit; go 1.15 github.com/hashicorp/yamux -# github.com/heimweh/go-pagerduty v0.0.0-20240226201314-bfc8dce0a3ff => github.com/c-kaieong/go-pagerduty v0.0.0-20240311200326-919db4bc1266 +# github.com/heimweh/go-pagerduty v0.0.0-20240226201314-bfc8dce0a3ff => github.com/c-kaieong/go-pagerduty v0.0.0-20240321202501-cb1dc594997d ## explicit; go 1.17 github.com/heimweh/go-pagerduty/pagerduty github.com/heimweh/go-pagerduty/persistentconfig @@ -549,4 +549,4 @@ google.golang.org/protobuf/types/known/timestamppb # gopkg.in/ini.v1 v1.67.0 ## explicit gopkg.in/ini.v1 -# github.com/heimweh/go-pagerduty => github.com/c-kaieong/go-pagerduty v0.0.0-20240311200326-919db4bc1266 +# github.com/heimweh/go-pagerduty => github.com/c-kaieong/go-pagerduty v0.0.0-20240321202501-cb1dc594997d