diff --git a/converters/google/resources/apigee_endpoint_attachment.go b/converters/google/resources/apigee_endpoint_attachment.go new file mode 100644 index 000000000..2e386435e --- /dev/null +++ b/converters/google/resources/apigee_endpoint_attachment.go @@ -0,0 +1,73 @@ +// ---------------------------------------------------------------------------- +// +// *** AUTO GENERATED CODE *** Type: MMv1 *** +// +// ---------------------------------------------------------------------------- +// +// This file is automatically generated by Magic Modules and manual +// changes will be clobbered when the file is regenerated. +// +// Please read more about how to change this file in +// .github/CONTRIBUTING.md. +// +// ---------------------------------------------------------------------------- + +package google + +import "reflect" + +const ApigeeEndpointAttachmentAssetType string = "apigee.googleapis.com/EndpointAttachment" + +func resourceConverterApigeeEndpointAttachment() ResourceConverter { + return ResourceConverter{ + AssetType: ApigeeEndpointAttachmentAssetType, + Convert: GetApigeeEndpointAttachmentCaiObject, + } +} + +func GetApigeeEndpointAttachmentCaiObject(d TerraformResourceData, config *Config) ([]Asset, error) { + name, err := assetName(d, config, "//apigee.googleapis.com/{{org_id}}/endpointAttachments/{{endpoint_attachment_id}}") + if err != nil { + return []Asset{}, err + } + if obj, err := GetApigeeEndpointAttachmentApiObject(d, config); err == nil { + return []Asset{{ + Name: name, + Type: ApigeeEndpointAttachmentAssetType, + Resource: &AssetResource{ + Version: "v1", + DiscoveryDocumentURI: "https://www.googleapis.com/discovery/v1/apis/apigee/v1/rest", + DiscoveryName: "EndpointAttachment", + Data: obj, + }, + }}, nil + } else { + return []Asset{}, err + } +} + +func GetApigeeEndpointAttachmentApiObject(d TerraformResourceData, config *Config) (map[string]interface{}, error) { + obj := make(map[string]interface{}) + locationProp, err := expandApigeeEndpointAttachmentLocation(d.Get("location"), d, config) + if err != nil { + return nil, err + } else if v, ok := d.GetOkExists("location"); !isEmptyValue(reflect.ValueOf(locationProp)) && (ok || !reflect.DeepEqual(v, locationProp)) { + obj["location"] = locationProp + } + serviceAttachmentProp, err := expandApigeeEndpointAttachmentServiceAttachment(d.Get("service_attachment"), d, config) + if err != nil { + return nil, err + } else if v, ok := d.GetOkExists("service_attachment"); !isEmptyValue(reflect.ValueOf(serviceAttachmentProp)) && (ok || !reflect.DeepEqual(v, serviceAttachmentProp)) { + obj["serviceAttachment"] = serviceAttachmentProp + } + + return obj, nil +} + +func expandApigeeEndpointAttachmentLocation(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { + return v, nil +} + +func expandApigeeEndpointAttachmentServiceAttachment(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { + return v, nil +}