-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Pub/Sub Lite reservation support to terraform. (#5284) (#794)
* Add Pub/Sub Lite reservation support to terraform. Also fix doc links for Pub/Sub Lite. * Add Pub/Sub Lite reservation support to terraform. Also fix doc links for Pub/Sub Lite. * Add Pub/Sub Lite reservation support to terraform. Also fix doc links for Pub/Sub Lite. * Add Pub/Sub Lite reservation support to terraform. Also fix doc links for Pub/Sub Lite. * Update to expander to use 'locations' instead of 'regions'. Co-authored-by: Nathan Mckinley <[email protected]> Signed-off-by: Modular Magician <[email protected]> Co-authored-by: Nathan Mckinley <[email protected]>
- Loading branch information
1 parent
e8ae8fe
commit 20190b3
Showing
2 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// ---------------------------------------------------------------------------- | ||
// | ||
// *** 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 PubsubLiteReservationAssetType string = "{{region}}-pubsublite.googleapis.com/Reservation" | ||
|
||
func resourceConverterPubsubLiteReservation() ResourceConverter { | ||
return ResourceConverter{ | ||
AssetType: PubsubLiteReservationAssetType, | ||
Convert: GetPubsubLiteReservationCaiObject, | ||
} | ||
} | ||
|
||
func GetPubsubLiteReservationCaiObject(d TerraformResourceData, config *Config) ([]Asset, error) { | ||
name, err := assetName(d, config, "//{{region}}-pubsublite.googleapis.com/projects/{{project}}/locations/{{region}}/reservations/{{name}}") | ||
if err != nil { | ||
return []Asset{}, err | ||
} | ||
if obj, err := GetPubsubLiteReservationApiObject(d, config); err == nil { | ||
return []Asset{{ | ||
Name: name, | ||
Type: PubsubLiteReservationAssetType, | ||
Resource: &AssetResource{ | ||
Version: "admin", | ||
DiscoveryDocumentURI: "https://www.googleapis.com/discovery/v1/apis/{{region}}-pubsublite/admin/rest", | ||
DiscoveryName: "Reservation", | ||
Data: obj, | ||
}, | ||
}}, nil | ||
} else { | ||
return []Asset{}, err | ||
} | ||
} | ||
|
||
func GetPubsubLiteReservationApiObject(d TerraformResourceData, config *Config) (map[string]interface{}, error) { | ||
obj := make(map[string]interface{}) | ||
throughputCapacityProp, err := expandPubsubLiteReservationThroughputCapacity(d.Get("throughput_capacity"), d, config) | ||
if err != nil { | ||
return nil, err | ||
} else if v, ok := d.GetOkExists("throughput_capacity"); !isEmptyValue(reflect.ValueOf(throughputCapacityProp)) && (ok || !reflect.DeepEqual(v, throughputCapacityProp)) { | ||
obj["throughputCapacity"] = throughputCapacityProp | ||
} | ||
|
||
return obj, nil | ||
} | ||
|
||
func expandPubsubLiteReservationThroughputCapacity(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { | ||
return v, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters