Skip to content

Commit

Permalink
generating provider
Browse files Browse the repository at this point in the history
  • Loading branch information
shinmog committed Jan 10, 2025
1 parent 59793a3 commit 328b76b
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 42 deletions.
1 change: 0 additions & 1 deletion docs/data-sources/remote_network.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ data "scm_remote_network" "example" {

### Read-Only

- `connection_type` (String) The connection type for the remote network. String must be one of these: `"prisma-access"`, `"meraki"`, `"cisco-catalyst-sdwan"`, `"velocloud"`, `"prisma-sdwan"`. Default: `"prisma-access"`.
- `ecmp_load_balancing` (String) The EcmpLoadBalancing param. String must be one of these: `"enable"`, `"disable"`. Default: `"disable"`.
- `ecmp_tunnels` (Attributes List) ecmp_tunnels is required when ecmp_load_balancing is enable. (see [below for nested schema](#nestedatt--ecmp_tunnels))
- `ipsec_tunnel` (String) ipsec_tunnel is required when ecmp_load_balancing is disable.
Expand Down
1 change: 0 additions & 1 deletion docs/data-sources/remote_network_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ data "scm_remote_network_list" "example" {

Read-Only:

- `connection_type` (String) The connection type for the remote network. String must be one of these: `"prisma-access"`, `"meraki"`, `"cisco-catalyst-sdwan"`, `"velocloud"`, `"prisma-sdwan"`. Default: `"prisma-access"`.
- `ecmp_load_balancing` (String) The EcmpLoadBalancing param. String must be one of these: `"enable"`, `"disable"`. Default: `"disable"`.
- `ecmp_tunnels` (Attributes List) ecmp_tunnels is required when ecmp_load_balancing is enable. (see [below for nested schema](#nestedatt--data--ecmp_tunnels))
- `id` (String) UUID of the resource.
Expand Down
1 change: 0 additions & 1 deletion docs/resources/remote_network.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ resource "scm_remote_network" "example" {

### Optional

- `connection_type` (String) The connection type for the remote network. String must be one of these: `"prisma-access"`, `"meraki"`, `"cisco-catalyst-sdwan"`, `"velocloud"`, `"prisma-sdwan"`. Default: `"prisma-access"`.
- `ecmp_load_balancing` (String) The EcmpLoadBalancing param. String must be one of these: `"enable"`, `"disable"`. Default: `"disable"`.
- `ecmp_tunnels` (Attributes List) ecmp_tunnels is required when ecmp_load_balancing is enable. (see [below for nested schema](#nestedatt--ecmp_tunnels))
- `folder` (String) The Folder param. String can either be a specific string(`"Remote Networks"`) or match this regex: `^[\s0-9a-zA-Z._-]{1,}$`. Default: `"Remote Networks"`.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/hashicorp/terraform-plugin-framework v1.4.2
github.com/hashicorp/terraform-plugin-framework-validators v0.12.0
github.com/hashicorp/terraform-plugin-log v0.9.0
github.com/paloaltonetworks/scm-go v0.10.0
github.com/paloaltonetworks/scm-go v0.11.0
)

require (
Expand Down
41 changes: 3 additions & 38 deletions internal/provider/remote_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ type remoteNetworkListDsModel struct {
}

type remoteNetworkListDsModel_uewNibC_Config struct {
ConnectionType types.String `tfsdk:"connection_type"`
EcmpLoadBalancing types.String `tfsdk:"ecmp_load_balancing"`
EcmpTunnels []remoteNetworkListDsModel_uewNibC_EcmpTunnelObject `tfsdk:"ecmp_tunnels"`
Id types.String `tfsdk:"id"`
Expand Down Expand Up @@ -126,11 +125,7 @@ func (d *remoteNetworkListDataSource) Schema(_ context.Context, _ datasource.Sch
Computed: true,
NestedObject: dsschema.NestedAttributeObject{
Attributes: map[string]dsschema.Attribute{
// inputs:map[string]bool{} outputs:map[string]bool{"connection_type":true, "ecmp_load_balancing":true, "ecmp_tunnels":true, "id":true, "ipsec_tunnel":true, "license_type":true, "name":true, "protocol":true, "region":true, "secondary_ipsec_tunnel":true, "spn_name":true, "subnets":true} forceNew:map[string]bool(nil)
"connection_type": dsschema.StringAttribute{
Description: "The connection type for the remote network. String must be one of these: `\"prisma-access\"`, `\"meraki\"`, `\"cisco-catalyst-sdwan\"`, `\"velocloud\"`, `\"prisma-sdwan\"`. Default: `\"prisma-access\"`.",
Computed: true,
},
// inputs:map[string]bool{} outputs:map[string]bool{"ecmp_load_balancing":true, "ecmp_tunnels":true, "id":true, "ipsec_tunnel":true, "license_type":true, "name":true, "protocol":true, "region":true, "secondary_ipsec_tunnel":true, "spn_name":true, "subnets":true} forceNew:map[string]bool(nil)
"ecmp_load_balancing": dsschema.StringAttribute{
Description: "The EcmpLoadBalancing param. String must be one of these: `\"enable\"`, `\"disable\"`. Default: `\"disable\"`.",
Computed: true,
Expand Down Expand Up @@ -423,8 +418,6 @@ func (d *remoteNetworkListDataSource) Read(ctx context.Context, req datasource.R
for _, var0 := range ans.Data {
var1 := remoteNetworkListDsModel_uewNibC_Config{}

var1.ConnectionType = types.StringPointerValue(var0.ConnectionType)

var1.EcmpLoadBalancing = types.StringPointerValue(var0.EcmpLoadBalancing)

if len(var0.EcmpTunnels) == 0 {
Expand Down Expand Up @@ -565,7 +558,6 @@ type remoteNetworkDsModel struct {
Id types.String `tfsdk:"id"`

// Output.
ConnectionType types.String `tfsdk:"connection_type"`
EcmpLoadBalancing types.String `tfsdk:"ecmp_load_balancing"`
EcmpTunnels []remoteNetworkDsModel_uewNibC_EcmpTunnelObject `tfsdk:"ecmp_tunnels"`
// omit input: id
Expand Down Expand Up @@ -624,11 +616,7 @@ func (d *remoteNetworkDataSource) Schema(_ context.Context, _ datasource.SchemaR
Description: "Retrieves a config item.",

Attributes: map[string]dsschema.Attribute{
// inputs:map[string]bool{"folder":true, "id":true} outputs:map[string]bool{"connection_type":true, "ecmp_load_balancing":true, "ecmp_tunnels":true, "id":true, "ipsec_tunnel":true, "license_type":true, "name":true, "protocol":true, "region":true, "secondary_ipsec_tunnel":true, "spn_name":true, "subnets":true, "tfid":true} forceNew:map[string]bool{"folder":true, "id":true}
"connection_type": dsschema.StringAttribute{
Description: "The connection type for the remote network. String must be one of these: `\"prisma-access\"`, `\"meraki\"`, `\"cisco-catalyst-sdwan\"`, `\"velocloud\"`, `\"prisma-sdwan\"`. Default: `\"prisma-access\"`.",
Computed: true,
},
// inputs:map[string]bool{"folder":true, "id":true} outputs:map[string]bool{"ecmp_load_balancing":true, "ecmp_tunnels":true, "id":true, "ipsec_tunnel":true, "license_type":true, "name":true, "protocol":true, "region":true, "secondary_ipsec_tunnel":true, "spn_name":true, "subnets":true, "tfid":true} forceNew:map[string]bool{"folder":true, "id":true}
"ecmp_load_balancing": dsschema.StringAttribute{
Description: "The EcmpLoadBalancing param. String must be one of these: `\"enable\"`, `\"disable\"`. Default: `\"disable\"`.",
Computed: true,
Expand Down Expand Up @@ -875,8 +863,6 @@ func (d *remoteNetworkDataSource) Read(ctx context.Context, req datasource.ReadR

state.Tfid = types.StringValue(idBuilder.String())

state.ConnectionType = types.StringPointerValue(ans.ConnectionType)

state.EcmpLoadBalancing = types.StringPointerValue(ans.EcmpLoadBalancing)

if len(ans.EcmpTunnels) == 0 {
Expand Down Expand Up @@ -1004,7 +990,6 @@ type remoteNetworkRsModel struct {
Tfid types.String `tfsdk:"tfid"`

// Input.
ConnectionType types.String `tfsdk:"connection_type"`
EcmpLoadBalancing types.String `tfsdk:"ecmp_load_balancing"`
EcmpTunnels []remoteNetworkRsModel_uewNibC_EcmpTunnelObject `tfsdk:"ecmp_tunnels"`
Folder types.String `tfsdk:"folder"`
Expand All @@ -1020,7 +1005,6 @@ type remoteNetworkRsModel struct {

// Output.
EncryptedValues types.Map `tfsdk:"encrypted_values"`
// omit input: connection_type
// omit input: ecmp_load_balancing
// omit input: ecmp_tunnels
// omit input: id
Expand Down Expand Up @@ -1079,22 +1063,13 @@ func (r *remoteNetworkResource) Schema(_ context.Context, _ resource.SchemaReque
Description: "Retrieves a config item.",

Attributes: map[string]rsschema.Attribute{
// inputs:map[string]bool{"connection_type":true, "ecmp_load_balancing":true, "ecmp_tunnels":true, "folder":true, "id":true, "ipsec_tunnel":true, "license_type":true, "name":true, "protocol":true, "region":true, "secondary_ipsec_tunnel":true, "spn_name":true, "subnets":true} outputs:map[string]bool{"connection_type":true, "ecmp_load_balancing":true, "ecmp_tunnels":true, "id":true, "ipsec_tunnel":true, "license_type":true, "name":true, "protocol":true, "region":true, "secondary_ipsec_tunnel":true, "spn_name":true, "subnets":true, "tfid":true} forceNew:map[string]bool{"folder":true}
// inputs:map[string]bool{"ecmp_load_balancing":true, "ecmp_tunnels":true, "folder":true, "id":true, "ipsec_tunnel":true, "license_type":true, "name":true, "protocol":true, "region":true, "secondary_ipsec_tunnel":true, "spn_name":true, "subnets":true} outputs:map[string]bool{"ecmp_load_balancing":true, "ecmp_tunnels":true, "id":true, "ipsec_tunnel":true, "license_type":true, "name":true, "protocol":true, "region":true, "secondary_ipsec_tunnel":true, "spn_name":true, "subnets":true, "tfid":true} forceNew:map[string]bool{"folder":true}
"encrypted_values": rsschema.MapAttribute{
Description: "(Internal use) Encrypted values returned from the API.",
Computed: true,
Sensitive: true,
ElementType: types.StringType,
},
"connection_type": rsschema.StringAttribute{
Description: "The connection type for the remote network. String must be one of these: `\"prisma-access\"`, `\"meraki\"`, `\"cisco-catalyst-sdwan\"`, `\"velocloud\"`, `\"prisma-sdwan\"`. Default: `\"prisma-access\"`.",
Optional: true,
Computed: true,
Default: stringdefault.StaticString("prisma-access"),
Validators: []validator.String{
stringvalidator.OneOf("prisma-access", "meraki", "cisco-catalyst-sdwan", "velocloud", "prisma-sdwan"),
},
},
"ecmp_load_balancing": rsschema.StringAttribute{
Description: "The EcmpLoadBalancing param. String must be one of these: `\"enable\"`, `\"disable\"`. Default: `\"disable\"`.",
Optional: true,
Expand Down Expand Up @@ -1361,8 +1336,6 @@ func (r *remoteNetworkResource) Create(ctx context.Context, req resource.CreateR
input.Folder = state.Folder.ValueString()
input.Request = &uewNibC.Config{}

input.Request.ConnectionType = state.ConnectionType.ValueStringPointer()

input.Request.EcmpLoadBalancing = state.EcmpLoadBalancing.ValueStringPointer()

if len(state.EcmpTunnels) != 0 {
Expand Down Expand Up @@ -1485,8 +1458,6 @@ func (r *remoteNetworkResource) Create(ctx context.Context, req resource.CreateR

state.Tfid = types.StringValue(idBuilder.String())

state.ConnectionType = types.StringPointerValue(ans.ConnectionType)

state.EcmpLoadBalancing = types.StringPointerValue(ans.EcmpLoadBalancing)

if len(ans.EcmpTunnels) == 0 {
Expand Down Expand Up @@ -1687,8 +1658,6 @@ func (r *remoteNetworkResource) Read(ctx context.Context, req resource.ReadReque
}
state.Tfid = savestate.Tfid

state.ConnectionType = types.StringPointerValue(ans.ConnectionType)

state.EcmpLoadBalancing = types.StringPointerValue(ans.EcmpLoadBalancing)

if len(ans.EcmpTunnels) == 0 {
Expand Down Expand Up @@ -1880,8 +1849,6 @@ func (r *remoteNetworkResource) Update(ctx context.Context, req resource.UpdateR
}
input.Request = &uewNibC.Config{}

input.Request.ConnectionType = plan.ConnectionType.ValueStringPointer()

input.Request.EcmpLoadBalancing = plan.EcmpLoadBalancing.ValueStringPointer()

if len(plan.EcmpTunnels) != 0 {
Expand Down Expand Up @@ -1995,8 +1962,6 @@ func (r *remoteNetworkResource) Update(ctx context.Context, req resource.UpdateR
// Note: when supporting importing a resource, this will need to change to taking
// values from the savestate.Tfid param and locMap.

state.ConnectionType = types.StringPointerValue(ans.ConnectionType)

state.EcmpLoadBalancing = types.StringPointerValue(ans.EcmpLoadBalancing)

if len(ans.EcmpTunnels) == 0 {
Expand Down

0 comments on commit 328b76b

Please sign in to comment.