1
1
// Copyright (c) HashiCorp, Inc.
2
2
// SPDX-License-Identifier: MPL-2.0
3
+
3
4
// ----------------------------------------------------------------------------
4
5
//
5
- // *** AUTO GENERATED CODE *** Type: Handwritten ***
6
+ // *** AUTO GENERATED CODE *** Type: MMv1 ***
6
7
//
7
8
// ----------------------------------------------------------------------------
8
9
//
9
10
// This code is generated by Magic Modules using the following:
10
11
//
11
- // Source file: https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/services/iap/data_source_iap_client.go
12
+ // Configuration: https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/products/iap/Client.yaml
13
+ // Template: https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/templates/terraform/datasource.go.tmpl
12
14
//
13
15
// DO NOT EDIT this file directly. Any changes made to this file will be
14
16
// overwritten during the next generation cycle.
@@ -20,29 +22,37 @@ import (
20
22
"fmt"
21
23
22
24
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
25
+
23
26
"github.com/hashicorp/terraform-provider-google/google/tpgresource"
24
27
transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport"
25
28
)
26
29
27
- func DataSourceGoogleIapClient () * schema.Resource {
30
+ func DataSourceIapClient () * schema.Resource {
31
+ rs := ResourceIapClient ().Schema
28
32
29
- dsSchema := tpgresource .DatasourceSchemaFromResourceSchema (ResourceIapClient ().Schema )
33
+ dsSchema := tpgresource .DatasourceSchemaFromResourceSchema (rs )
34
+
35
+ // Set 'Required' schema elements
30
36
tpgresource .AddRequiredFieldsToSchema (dsSchema , "brand" , "client_id" )
31
37
38
+ // Set 'Optional' schema elements
39
+ tpgresource .AddOptionalFieldsToSchema (dsSchema )
40
+
32
41
return & schema.Resource {
33
- Read : dataSourceGoogleIapClientRead ,
42
+ Read : dataSourceIapClientRead ,
34
43
Schema : dsSchema ,
35
44
}
36
45
}
37
46
38
- func dataSourceGoogleIapClientRead (d * schema.ResourceData , meta interface {}) error {
47
+ func dataSourceIapClientRead (d * schema.ResourceData , meta interface {}) error {
39
48
config := meta .(* transport_tpg.Config )
40
49
41
50
id , err := tpgresource .ReplaceVars (d , config , "{{brand}}/identityAwareProxyClients/{{client_id}}" )
42
51
if err != nil {
43
- return fmt . Errorf ( "Error constructing id: %s" , err )
52
+ return err
44
53
}
45
54
d .SetId (id )
55
+
46
56
err = resourceIapClientRead (d , meta )
47
57
if err != nil {
48
58
return err
@@ -51,5 +61,6 @@ func dataSourceGoogleIapClientRead(d *schema.ResourceData, meta interface{}) err
51
61
if d .Id () == "" {
52
62
return fmt .Errorf ("%s not found" , id )
53
63
}
64
+
54
65
return nil
55
66
}
0 commit comments