Skip to content

Commit

Permalink
Add apikeys key resource (GoogleCloudPlatform#5637)
Browse files Browse the repository at this point in the history
* Add apikeys key resource

* Update branch

* Update go.mod & sum for required fields
  • Loading branch information
slevenick authored and lcaggio committed Mar 18, 2022
1 parent 0fd2dda commit bd9f8bc
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
4 changes: 3 additions & 1 deletion mmv1/third_party/terraform/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1530,4 +1530,6 @@ rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20220225200700-e76d50f1e637 h1:+s2wWcAciNo96AT+Ci9pwXuWm9qlY/ubLFWRaqE0tZg=
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20220225200700-e76d50f1e637/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E=
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20220225200700-e76d50f1e637/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E=
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20220304175357-35332d17a512 h1:8/Sn9pDdk/RxECtLUh4xum2eyUvf0h7bpx8h+lYvE+Q=
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20220304175357-35332d17a512/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E=
Empty file.
4 changes: 4 additions & 0 deletions tpgtools/property.go
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,10 @@ func createPropertiesFromSchema(schema *openapi.Schema, typeFetcher *TypeFetcher
}

if !p.Computed {
if v.Title == "allowedApplications" {
glog.Errorf("Looking for %#v.", schema)
}
glog.Errorf("Looking for %q in %v.", v.Title, schema.Required)
if stringInSlice(v.Title, schema.Required) {
p.Required = true
} else {
Expand Down
16 changes: 8 additions & 8 deletions tpgtools/serialization.go
Original file line number Diff line number Diff line change
Expand Up @@ -641,16 +641,16 @@ func convertApikeysKeyBetaRestrictionsApiTargetsToHCL(r *apikeysBeta.KeyRestrict
return ""
}
outputConfig := "{\n"
if r.Service != nil {
outputConfig += fmt.Sprintf("\tservice = %#v\n", *r.Service)
}
if r.Methods != nil {
outputConfig += "\tmethods = ["
for _, v := range r.Methods {
outputConfig += fmt.Sprintf("%#v, ", v)
}
outputConfig += "]\n"
}
if r.Service != nil {
outputConfig += fmt.Sprintf("\tservice = %#v\n", *r.Service)
}
return outputConfig + "}"
}

Expand Down Expand Up @@ -5514,16 +5514,16 @@ func convertApikeysKeyRestrictionsApiTargetsToHCL(r *apikeys.KeyRestrictionsApiT
return ""
}
outputConfig := "{\n"
if r.Service != nil {
outputConfig += fmt.Sprintf("\tservice = %#v\n", *r.Service)
}
if r.Methods != nil {
outputConfig += "\tmethods = ["
for _, v := range r.Methods {
outputConfig += fmt.Sprintf("%#v, ", v)
}
outputConfig += "]\n"
}
if r.Service != nil {
outputConfig += fmt.Sprintf("\tservice = %#v\n", *r.Service)
}
return outputConfig + "}"
}

Expand Down Expand Up @@ -10063,8 +10063,8 @@ func convertApikeysKeyBetaRestrictionsApiTargets(i interface{}) map[string]inter
}
in := i.(map[string]interface{})
return map[string]interface{}{
"service": in["service"],
"methods": in["methods"],
"service": in["service"],
}
}

Expand Down Expand Up @@ -14621,8 +14621,8 @@ func convertApikeysKeyRestrictionsApiTargets(i interface{}) map[string]interface
}
in := i.(map[string]interface{})
return map[string]interface{}{
"service": in["service"],
"methods": in["methods"],
"service": in["service"],
}
}

Expand Down

0 comments on commit bd9f8bc

Please sign in to comment.