Skip to content

Commit

Permalink
v0.0.19 - Update libs for JSON serialization & HTTP retries
Browse files Browse the repository at this point in the history
* Update to lib version 0.0.10
* Fixes issues with Marshal/UnmarshalJSON functions not being invoked
* Refactor HTTP retry logic, including not retrying on 404s
  • Loading branch information
evanverneyfink committed Oct 11, 2022
1 parent 49fe12f commit e9f4632
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/ebu/terraform-provider-mcma
go 1.18

require (
github.com/ebu/mcma-libraries-go v0.0.4
github.com/ebu/mcma-libraries-go v0.0.10
github.com/hashicorp/terraform-plugin-docs v0.7.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.13.0
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/ebu/mcma-libraries-go v0.0.4 h1:3Toie/9EWbJkSvFLSLyN/Ijge/vUJGeajCB6iLhbikk=
github.com/ebu/mcma-libraries-go v0.0.4/go.mod h1:RnT/sTbg7ICp6NHDxyj/xX9xI+bqbcm9SUkPTIJnqs4=
github.com/ebu/mcma-libraries-go v0.0.10 h1:/1NuRPq+5saXLOScvv2Gydfg9HjKqE8gXsC1eFTGlYY=
github.com/ebu/mcma-libraries-go v0.0.10/go.mod h1:RnT/sTbg7ICp6NHDxyj/xX9xI+bqbcm9SUkPTIJnqs4=
github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg=
github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
Expand Down
1 change: 0 additions & 1 deletion mcma/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ func configure(d *schema.ResourceData) (interface{}, diag.Diagnostics) {
}

func getResourceManager(m interface{}) (*mcmaclient.ResourceManager, diag.Diagnostics) {
println("getResourceManager")
if m == nil {
return nil, diag.Diagnostics{
diag.Diagnostic{
Expand Down
6 changes: 2 additions & 4 deletions mcma/resource_job_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func resourceJobProfile() *schema.Resource {
Type: schema.TypeString,
Description: "The ID of the job profile. MCMA IDs are always absolute urls.",
Computed: true,
ForceNew: true,
},
"date_created": {
Type: schema.TypeString,
Expand Down Expand Up @@ -137,7 +138,6 @@ func getJobProfileFromResourceData(d *schema.ResourceData) mcmamodel.JobProfile
}

func resourceJobProfileRead(_ context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
println("resourceJobProfileRead")
resourceManager, di := getResourceManager(m)
if di != nil {
return di
Expand All @@ -149,6 +149,7 @@ func resourceJobProfileRead(_ context.Context, d *schema.ResourceData, m interfa
return diag.Errorf("error getting job profile with id %s: %s", jobProfileId, err)
}
if resource == nil {
_ = d.Set("id", "")
return diag.Diagnostics{}
}

Expand Down Expand Up @@ -195,7 +196,6 @@ func resourceJobProfileRead(_ context.Context, d *schema.ResourceData, m interfa
}

func resourceJobProfileCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
println("resourceJobProfileCreate")
resourceManager, di := getResourceManager(m)
if di != nil {
return di
Expand All @@ -213,7 +213,6 @@ func resourceJobProfileCreate(ctx context.Context, d *schema.ResourceData, m int
}

func resourceJobProfileUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
println("resourceJobProfileUpdate")
resourceManager, di := getResourceManager(m)
if di != nil {
return di
Expand All @@ -231,7 +230,6 @@ func resourceJobProfileUpdate(ctx context.Context, d *schema.ResourceData, m int
}

func resourceJobProfileDelete(_ context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
println("resourceJobProfileDelete")
resourceManager, di := getResourceManager(m)
if di != nil {
return di
Expand Down
2 changes: 2 additions & 0 deletions mcma/resource_mcma_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func resourceMcmaResource() *schema.Resource {
Type: schema.TypeString,
Description: "The ID of the service. MCMA IDs are always absolute urls.",
Computed: true,
ForceNew: true,
},
"resource_json": {
Type: schema.TypeString,
Expand Down Expand Up @@ -65,6 +66,7 @@ func resourceMcmaResourceRead(_ context.Context, d *schema.ResourceData, m inter
return diag.Errorf("error getting resource of type %s with id %s: %s", resourceType, resourceId, err)
}
if resource == nil {
_ = d.Set("id", "")
return diag.Diagnostics{}
}

Expand Down
4 changes: 3 additions & 1 deletion mcma/resource_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func resourceService() *schema.Resource {
Type: schema.TypeString,
Description: "The ID of the service. MCMA IDs are always absolute urls.",
Computed: true,
ForceNew: true,
},
"date_created": {
Type: schema.TypeString,
Expand Down Expand Up @@ -152,13 +153,14 @@ func resourceServiceRead(_ context.Context, d *schema.ResourceData, m interface{
return diag.Errorf("error getting service with id %s: %s", serviceId, err)
}
if resource == nil {
_ = d.Set("id", "")
return diag.Diagnostics{}
}

service := resource.(mcmamodel.Service)

_ = d.Set("type", service.Type)
_ = d.Set("id", service.Id)
_ = d.Set("type", service.Type)
_ = d.Set("date_created", service.DateCreated.Format(time.RFC3339))
_ = d.Set("date_modified", service.DateModified.Format(time.RFC3339))
_ = d.Set("name", service.Name)
Expand Down

0 comments on commit e9f4632

Please sign in to comment.