Skip to content
This repository has been archived by the owner on May 15, 2023. It is now read-only.

Add endpointAttachment in Apigee #545

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions converters/google/resources/apigee_endpoint_attachment.go
Original file line number Diff line number Diff line change
@@ -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
}