/
source_ip2whois_resource_sdk.go
83 lines (78 loc) · 2.4 KB
/
source_ip2whois_resource_sdk.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
package provider
import (
"github.com/airbytehq/terraform-provider-airbyte/internal/sdk/pkg/models/shared"
"github.com/hashicorp/terraform-plugin-framework/types"
)
func (r *SourceIp2whoisResourceModel) ToSharedSourceIp2whoisCreateRequest() *shared.SourceIp2whoisCreateRequest {
apiKey := new(string)
if !r.Configuration.APIKey.IsUnknown() && !r.Configuration.APIKey.IsNull() {
*apiKey = r.Configuration.APIKey.ValueString()
} else {
apiKey = nil
}
domain := new(string)
if !r.Configuration.Domain.IsUnknown() && !r.Configuration.Domain.IsNull() {
*domain = r.Configuration.Domain.ValueString()
} else {
domain = nil
}
configuration := shared.SourceIp2whois{
APIKey: apiKey,
Domain: domain,
}
definitionID := new(string)
if !r.DefinitionID.IsUnknown() && !r.DefinitionID.IsNull() {
*definitionID = r.DefinitionID.ValueString()
} else {
definitionID = nil
}
name := r.Name.ValueString()
secretID := new(string)
if !r.SecretID.IsUnknown() && !r.SecretID.IsNull() {
*secretID = r.SecretID.ValueString()
} else {
secretID = nil
}
workspaceID := r.WorkspaceID.ValueString()
out := shared.SourceIp2whoisCreateRequest{
Configuration: configuration,
DefinitionID: definitionID,
Name: name,
SecretID: secretID,
WorkspaceID: workspaceID,
}
return &out
}
func (r *SourceIp2whoisResourceModel) RefreshFromSharedSourceResponse(resp *shared.SourceResponse) {
r.Name = types.StringValue(resp.Name)
r.SourceID = types.StringValue(resp.SourceID)
r.SourceType = types.StringValue(resp.SourceType)
r.WorkspaceID = types.StringValue(resp.WorkspaceID)
}
func (r *SourceIp2whoisResourceModel) ToSharedSourceIp2whoisPutRequest() *shared.SourceIp2whoisPutRequest {
apiKey := new(string)
if !r.Configuration.APIKey.IsUnknown() && !r.Configuration.APIKey.IsNull() {
*apiKey = r.Configuration.APIKey.ValueString()
} else {
apiKey = nil
}
domain := new(string)
if !r.Configuration.Domain.IsUnknown() && !r.Configuration.Domain.IsNull() {
*domain = r.Configuration.Domain.ValueString()
} else {
domain = nil
}
configuration := shared.SourceIp2whoisUpdate{
APIKey: apiKey,
Domain: domain,
}
name := r.Name.ValueString()
workspaceID := r.WorkspaceID.ValueString()
out := shared.SourceIp2whoisPutRequest{
Configuration: configuration,
Name: name,
WorkspaceID: workspaceID,
}
return &out
}