|
| 1 | +// ---------------------------------------------------------------------------- |
| 2 | +// |
| 3 | +// *** AUTO GENERATED CODE *** Type: MMv1 *** |
| 4 | +// |
| 5 | +// ---------------------------------------------------------------------------- |
| 6 | +// |
| 7 | +// This code is generated by Magic Modules using the following: |
| 8 | +// |
| 9 | +// Configuration: https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/products/iamworkforcepool/OauthClientCredential.yaml |
| 10 | +// Template: https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/templates/tgc/resource_converter.go.tmpl |
| 11 | +// |
| 12 | +// DO NOT EDIT this file directly. Any changes made to this file will be |
| 13 | +// overwritten during the next generation cycle. |
| 14 | +// |
| 15 | +// ---------------------------------------------------------------------------- |
| 16 | + |
| 17 | +package iamworkforcepool |
| 18 | + |
| 19 | +import ( |
| 20 | + "reflect" |
| 21 | + |
| 22 | + "github.com/GoogleCloudPlatform/terraform-google-conversion/v6/tfplan2cai/converters/google/resources/cai" |
| 23 | + "github.com/hashicorp/terraform-provider-google-beta/google-beta/tpgresource" |
| 24 | + transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport" |
| 25 | +) |
| 26 | + |
| 27 | +const IAMWorkforcePoolOauthClientCredentialAssetType string = "iam.googleapis.com/OauthClientCredential" |
| 28 | + |
| 29 | +func ResourceConverterIAMWorkforcePoolOauthClientCredential() cai.ResourceConverter { |
| 30 | + return cai.ResourceConverter{ |
| 31 | + AssetType: IAMWorkforcePoolOauthClientCredentialAssetType, |
| 32 | + Convert: GetIAMWorkforcePoolOauthClientCredentialCaiObject, |
| 33 | + } |
| 34 | +} |
| 35 | + |
| 36 | +func GetIAMWorkforcePoolOauthClientCredentialCaiObject(d tpgresource.TerraformResourceData, config *transport_tpg.Config) ([]cai.Asset, error) { |
| 37 | + name, err := cai.AssetName(d, config, "//iam.googleapis.com/projects/{{project}}/locations/{{location}}/oauthClients/{{oauthclient}}/credentials/{{oauth_client_credential_id}}") |
| 38 | + if err != nil { |
| 39 | + return []cai.Asset{}, err |
| 40 | + } |
| 41 | + if obj, err := GetIAMWorkforcePoolOauthClientCredentialApiObject(d, config); err == nil { |
| 42 | + return []cai.Asset{{ |
| 43 | + Name: name, |
| 44 | + Type: IAMWorkforcePoolOauthClientCredentialAssetType, |
| 45 | + Resource: &cai.AssetResource{ |
| 46 | + Version: "v1", |
| 47 | + DiscoveryDocumentURI: "https://www.googleapis.com/discovery/v1/apis/iam/v1/rest", |
| 48 | + DiscoveryName: "OauthClientCredential", |
| 49 | + Data: obj, |
| 50 | + }, |
| 51 | + }}, nil |
| 52 | + } else { |
| 53 | + return []cai.Asset{}, err |
| 54 | + } |
| 55 | +} |
| 56 | + |
| 57 | +func GetIAMWorkforcePoolOauthClientCredentialApiObject(d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string]interface{}, error) { |
| 58 | + obj := make(map[string]interface{}) |
| 59 | + disabledProp, err := expandIAMWorkforcePoolOauthClientCredentialDisabled(d.Get("disabled"), d, config) |
| 60 | + if err != nil { |
| 61 | + return nil, err |
| 62 | + } else if v, ok := d.GetOkExists("disabled"); !tpgresource.IsEmptyValue(reflect.ValueOf(disabledProp)) && (ok || !reflect.DeepEqual(v, disabledProp)) { |
| 63 | + obj["disabled"] = disabledProp |
| 64 | + } |
| 65 | + displayNameProp, err := expandIAMWorkforcePoolOauthClientCredentialDisplayName(d.Get("display_name"), d, config) |
| 66 | + if err != nil { |
| 67 | + return nil, err |
| 68 | + } else if v, ok := d.GetOkExists("display_name"); !tpgresource.IsEmptyValue(reflect.ValueOf(displayNameProp)) && (ok || !reflect.DeepEqual(v, displayNameProp)) { |
| 69 | + obj["displayName"] = displayNameProp |
| 70 | + } |
| 71 | + |
| 72 | + return obj, nil |
| 73 | +} |
| 74 | + |
| 75 | +func expandIAMWorkforcePoolOauthClientCredentialDisabled(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| 76 | + return v, nil |
| 77 | +} |
| 78 | + |
| 79 | +func expandIAMWorkforcePoolOauthClientCredentialDisplayName(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| 80 | + return v, nil |
| 81 | +} |
0 commit comments