-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #603 from Juniper/fabric-settings
Introduce support for attributes from `FabricSettings{}` in resource `apstra_datacenter_blueprint`
- Loading branch information
Showing
15 changed files
with
2,451 additions
and
463 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
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 |
---|---|---|
|
@@ -8,4 +8,5 @@ const ( | |
Apstra411 = "4.1.1" | ||
Apstra412 = "4.1.2" | ||
Apstra420 = "4.2.0" | ||
Apstra421 = "4.2.1" | ||
) |
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,102 @@ | ||
package blueprint | ||
|
||
import ( | ||
"context" | ||
"math" | ||
|
||
"github.com/Juniper/apstra-go-sdk/apstra" | ||
"github.com/hashicorp/terraform-plugin-framework-validators/int64validator" | ||
"github.com/hashicorp/terraform-plugin-framework/attr" | ||
dataSourceSchema "github.com/hashicorp/terraform-plugin-framework/datasource/schema" | ||
"github.com/hashicorp/terraform-plugin-framework/diag" | ||
resourceSchema "github.com/hashicorp/terraform-plugin-framework/resource/schema" | ||
"github.com/hashicorp/terraform-plugin-framework/schema/validator" | ||
"github.com/hashicorp/terraform-plugin-framework/types" | ||
) | ||
|
||
type AntiAffinityPolicy struct { | ||
MaxLinksCountPerSlot types.Int64 `tfsdk:"max_links_count_per_slot"` | ||
MaxLinksCountPerSystemPerSlot types.Int64 `tfsdk:"max_links_count_per_system_per_slot"` | ||
MaxLinksCountPerPort types.Int64 `tfsdk:"max_links_count_per_port"` | ||
MaxLinksCountPerSystemPerPort types.Int64 `tfsdk:"max_links_count_per_system_per_port"` | ||
} | ||
|
||
func (o AntiAffinityPolicy) attrTypes() map[string]attr.Type { | ||
return map[string]attr.Type{ | ||
"max_links_count_per_slot": types.Int64Type, | ||
"max_links_count_per_system_per_slot": types.Int64Type, | ||
"max_links_count_per_port": types.Int64Type, | ||
"max_links_count_per_system_per_port": types.Int64Type, | ||
} | ||
} | ||
|
||
func (o AntiAffinityPolicy) datasourceAttributes() map[string]dataSourceSchema.Attribute { | ||
return map[string]dataSourceSchema.Attribute{ | ||
"max_links_count_per_slot": dataSourceSchema.Int64Attribute{ | ||
Computed: true, | ||
MarkdownDescription: "Maximum total number of links connected to ports/interfaces of the specified slot regardless of the system" + | ||
"they are targeted to. It controls how many links can be connected to one slot of one system. " + | ||
"Example: A line card slot in a chassis.", | ||
}, | ||
"max_links_count_per_system_per_slot": dataSourceSchema.Int64Attribute{ | ||
Computed: true, | ||
MarkdownDescription: "Restricts the number of links to a certain system connected to the ports/interfaces in a specific slot. " + | ||
"It controls how many links can be connected to one system to one slot of another system.", | ||
}, | ||
"max_links_count_per_port": dataSourceSchema.Int64Attribute{ | ||
Computed: true, | ||
MarkdownDescription: "Maximum total number of links connected to the interfaces of the specific port regardless of the system " + | ||
"they are targeted to. It controls how many links can be connected to one port in one system. " + | ||
"Example: Several transformations of one port. In this case, it controls how many transformations can be used in links.", | ||
}, | ||
"max_links_count_per_system_per_port": dataSourceSchema.Int64Attribute{ | ||
Computed: true, | ||
MarkdownDescription: "Restricts the number of interfaces on a port used to connect to a certain system. It controls " + | ||
"how many links can be connected from one system to one port of another system. This is the one that you will " + | ||
"most likely use, for port breakouts.", | ||
}, | ||
} | ||
} | ||
|
||
func (o AntiAffinityPolicy) resourceAttributes() map[string]resourceSchema.Attribute { | ||
return map[string]resourceSchema.Attribute{ | ||
"max_links_count_per_slot": resourceSchema.Int64Attribute{ | ||
Optional: true, | ||
Computed: true, | ||
MarkdownDescription: "Maximum total number of links connected to ports/interfaces of the specified slot regardless of the system" + | ||
"they are targeted to. It controls how many links can be connected to one slot of one system. " + | ||
"Example: A line card slot in a chassis.", | ||
Validators: []validator.Int64{int64validator.Between(0, math.MaxUint8)}, | ||
}, | ||
"max_links_count_per_system_per_slot": resourceSchema.Int64Attribute{ | ||
Optional: true, | ||
Computed: true, | ||
MarkdownDescription: "Restricts the number of links to a certain system connected to the ports/interfaces in a specific slot. " + | ||
"It controls how many links can be connected to one system to one slot of another system.", | ||
Validators: []validator.Int64{int64validator.Between(0, math.MaxUint8)}, | ||
}, | ||
"max_links_count_per_port": resourceSchema.Int64Attribute{ | ||
Optional: true, | ||
Computed: true, | ||
MarkdownDescription: "Maximum total number of links connected to the interfaces of the specific port regardless of the system " + | ||
"they are targeted to. It controls how many links can be connected to one port in one system. " + | ||
"Example: Several transformations of one port. In this case, it controls how many transformations can be used in links.", | ||
Validators: []validator.Int64{int64validator.Between(0, math.MaxUint8)}, | ||
}, | ||
"max_links_count_per_system_per_port": resourceSchema.Int64Attribute{ | ||
Optional: true, | ||
Computed: true, | ||
MarkdownDescription: "Restricts the number of interfaces on a port used to connect to a certain system. It controls " + | ||
"how many links can be connected from one system to one port of another system. This is the one that you will " + | ||
"most likely use, for port breakouts.", | ||
Validators: []validator.Int64{int64validator.Between(0, math.MaxUint8)}, | ||
}, | ||
} | ||
} | ||
|
||
func (o *AntiAffinityPolicy) loadApiData(_ context.Context, in *apstra.AntiAffinityPolicy, _ *diag.Diagnostics) { | ||
o.MaxLinksCountPerPort = types.Int64Value(int64(in.MaxLinksPerPort)) | ||
o.MaxLinksCountPerSlot = types.Int64Value(int64(in.MaxLinksPerSlot)) | ||
o.MaxLinksCountPerSystemPerPort = types.Int64Value(int64(in.MaxPerSystemLinksPerPort)) | ||
o.MaxLinksCountPerSystemPerSlot = types.Int64Value(int64(in.MaxPerSystemLinksPerSlot)) | ||
} |
Oops, something went wrong.