Skip to content

Commit

Permalink
The beta API is deprecated - move to ga only. (#3027) (#1689)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician authored Jan 27, 2020
1 parent 69615ff commit 6a06d83
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 47 deletions.
3 changes: 3 additions & 0 deletions .changelog/3027.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
`binaryauthorization`: moved from beta to ga in anticipation of beta api turndown.
```
3 changes: 0 additions & 3 deletions .changelog/3032.txt

This file was deleted.

2 changes: 1 addition & 1 deletion google-beta/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ var BigQueryDefaultBasePath = "https://www.googleapis.com/bigquery/v2/"
var BigqueryDataTransferDefaultBasePath = "https://bigquerydatatransfer.googleapis.com/v1/"
var BigtableDefaultBasePath = "https://bigtableadmin.googleapis.com/v2/"
var BillingDefaultBasePath = "https://billingbudgets.googleapis.com/v1beta1/"
var BinaryAuthorizationDefaultBasePath = "https://binaryauthorization.googleapis.com/v1beta1/"
var BinaryAuthorizationDefaultBasePath = "https://binaryauthorization.googleapis.com/v1/"
var CloudBuildDefaultBasePath = "https://cloudbuild.googleapis.com/v1/"
var CloudFunctionsDefaultBasePath = "https://cloudfunctions.googleapis.com/v1/"
var CloudRunDefaultBasePath = "https://{{location}}-run.googleapis.com/"
Expand Down
48 changes: 7 additions & 41 deletions google-beta/resource_binary_authorization_attestor.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,16 +190,11 @@ func resourceBinaryAuthorizationAttestorCreate(d *schema.ResourceData, meta inte
} else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(descriptionProp)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
obj["description"] = descriptionProp
}
userOwnedDrydockNoteProp, err := expandBinaryAuthorizationAttestorAttestationAuthorityNote(d.Get("attestation_authority_note"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("attestation_authority_note"); !isEmptyValue(reflect.ValueOf(userOwnedDrydockNoteProp)) && (ok || !reflect.DeepEqual(v, userOwnedDrydockNoteProp)) {
obj["userOwnedDrydockNote"] = userOwnedDrydockNoteProp
}

obj, err = resourceBinaryAuthorizationAttestorEncoder(d, meta, obj)
userOwnedGrafeasNoteProp, err := expandBinaryAuthorizationAttestorAttestationAuthorityNote(d.Get("attestation_authority_note"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("attestation_authority_note"); !isEmptyValue(reflect.ValueOf(userOwnedGrafeasNoteProp)) && (ok || !reflect.DeepEqual(v, userOwnedGrafeasNoteProp)) {
obj["userOwnedGrafeasNote"] = userOwnedGrafeasNoteProp
}

url, err := replaceVars(d, config, "{{BinaryAuthorizationBasePath}}projects/{{project}}/attestors?attestorId={{name}}")
Expand Down Expand Up @@ -246,18 +241,6 @@ func resourceBinaryAuthorizationAttestorRead(d *schema.ResourceData, meta interf
return handleNotFoundError(err, d, fmt.Sprintf("BinaryAuthorizationAttestor %q", d.Id()))
}

res, err = resourceBinaryAuthorizationAttestorDecoder(d, meta, res)
if err != nil {
return err
}

if res == nil {
// Decoding the object has resulted in it being gone. It may be marked deleted
log.Printf("[DEBUG] Removing BinaryAuthorizationAttestor because it no longer exists.")
d.SetId("")
return nil
}

if err := d.Set("project", project); err != nil {
return fmt.Errorf("Error reading Attestor: %s", err)
}
Expand All @@ -268,7 +251,7 @@ func resourceBinaryAuthorizationAttestorRead(d *schema.ResourceData, meta interf
if err := d.Set("description", flattenBinaryAuthorizationAttestorDescription(res["description"], d)); err != nil {
return fmt.Errorf("Error reading Attestor: %s", err)
}
if err := d.Set("attestation_authority_note", flattenBinaryAuthorizationAttestorAttestationAuthorityNote(res["userOwnedDrydockNote"], d)); err != nil {
if err := d.Set("attestation_authority_note", flattenBinaryAuthorizationAttestorAttestationAuthorityNote(res["userOwnedGrafeasNote"], d)); err != nil {
return fmt.Errorf("Error reading Attestor: %s", err)
}

Expand Down Expand Up @@ -296,16 +279,11 @@ func resourceBinaryAuthorizationAttestorUpdate(d *schema.ResourceData, meta inte
} else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
obj["description"] = descriptionProp
}
userOwnedDrydockNoteProp, err := expandBinaryAuthorizationAttestorAttestationAuthorityNote(d.Get("attestation_authority_note"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("attestation_authority_note"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, userOwnedDrydockNoteProp)) {
obj["userOwnedDrydockNote"] = userOwnedDrydockNoteProp
}

obj, err = resourceBinaryAuthorizationAttestorEncoder(d, meta, obj)
userOwnedGrafeasNoteProp, err := expandBinaryAuthorizationAttestorAttestationAuthorityNote(d.Get("attestation_authority_note"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("attestation_authority_note"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, userOwnedGrafeasNoteProp)) {
obj["userOwnedGrafeasNote"] = userOwnedGrafeasNoteProp
}

url, err := replaceVars(d, config, "{{BinaryAuthorizationBasePath}}projects/{{project}}/attestors/{{name}}")
Expand Down Expand Up @@ -607,15 +585,3 @@ func expandBinaryAuthorizationAttestorAttestationAuthorityNotePublicKeysPkixPubl
func expandBinaryAuthorizationAttestorAttestationAuthorityNoteDelegationServiceAccountEmail(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}

func resourceBinaryAuthorizationAttestorEncoder(d *schema.ResourceData, meta interface{}, obj map[string]interface{}) (map[string]interface{}, error) {
// encoder logic only in GA provider

return obj, nil
}

func resourceBinaryAuthorizationAttestorDecoder(d *schema.ResourceData, meta interface{}, res map[string]interface{}) (map[string]interface{}, error) {
// decoder logic only in GA provider

return res, nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func testSweepBinaryAuthorizationAttestor(region string) error {
},
}

listTemplate := strings.Split("https://binaryauthorization.googleapis.com/v1beta1/projects/{{project}}/attestors?attestorId={{name}}", "?")[0]
listTemplate := strings.Split("https://binaryauthorization.googleapis.com/v1/projects/{{project}}/attestors?attestorId={{name}}", "?")[0]
listUrl, err := replaceVars(d, config, listTemplate)
if err != nil {
log.Printf("[INFO][SWEEPER_LOG] error preparing sweeper list url: %s", err)
Expand Down Expand Up @@ -94,7 +94,7 @@ func testSweepBinaryAuthorizationAttestor(region string) error {
continue
}

deleteTemplate := "https://binaryauthorization.googleapis.com/v1beta1/projects/{{project}}/attestors/{{name}}"
deleteTemplate := "https://binaryauthorization.googleapis.com/v1/projects/{{project}}/attestors/{{name}}"
deleteUrl, err := replaceVars(d, config, deleteTemplate)
if err != nil {
log.Printf("[INFO][SWEEPER_LOG] error preparing delete url: %s", err)
Expand Down
1 change: 1 addition & 0 deletions google-beta/resource_sql_database_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/terraform"

sqladmin "google.golang.org/api/sqladmin/v1beta4"
)

Expand Down

0 comments on commit 6a06d83

Please sign in to comment.