forked from linode/terraform-provider-linode
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into TPT-3182-pg-migrations-field
- Loading branch information
Showing
30 changed files
with
223 additions
and
1,078 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
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
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
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
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 |
---|---|---|
@@ -1,82 +1,82 @@ | ||
package networkingips | ||
|
||
import ( | ||
"github.com/hashicorp/terraform-plugin-framework/attr" | ||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema" | ||
"github.com/hashicorp/terraform-plugin-framework/types" | ||
"github.com/linode/terraform-provider-linode/v2/linode/helper/frameworkfilter" | ||
) | ||
|
||
var updatedIPObjectType = types.ObjectType{ | ||
AttrTypes: map[string]attr.Type{ | ||
"address": types.StringType, | ||
"region": types.StringType, | ||
"gateway": types.StringType, | ||
"subnet_mask": types.StringType, | ||
"prefix": types.Int64Type, | ||
"type": types.StringType, | ||
"public": types.BoolType, | ||
"rdns": types.StringType, | ||
"linode_id": types.Int64Type, | ||
"reserved": types.BoolType, | ||
}, | ||
var filterConfig = frameworkfilter.Config{ | ||
"type": {APIFilterable: true, TypeFunc: frameworkfilter.FilterTypeString}, | ||
"region": {APIFilterable: true, TypeFunc: frameworkfilter.FilterTypeString}, | ||
"rdns": {APIFilterable: true, TypeFunc: frameworkfilter.FilterTypeString}, | ||
"address": {APIFilterable: true, TypeFunc: frameworkfilter.FilterTypeString}, | ||
"prefix": {APIFilterable: true, TypeFunc: frameworkfilter.FilterTypeInt}, | ||
|
||
"gateway": {APIFilterable: false, TypeFunc: frameworkfilter.FilterTypeString}, | ||
"subnet_mask": {APIFilterable: false, TypeFunc: frameworkfilter.FilterTypeString}, | ||
"public": {APIFilterable: false, TypeFunc: frameworkfilter.FilterTypeString}, | ||
"linode_id": {APIFilterable: false, TypeFunc: frameworkfilter.FilterTypeInt}, | ||
"reserved": {APIFilterable: false, TypeFunc: frameworkfilter.FilterTypeBool}, | ||
} | ||
|
||
var frameworkDatasourceSchema = schema.Schema{ | ||
Attributes: map[string]schema.Attribute{ | ||
"address": schema.StringAttribute{ | ||
Description: "The IP address.", | ||
// Required: true, | ||
Optional: true, | ||
}, | ||
"gateway": schema.StringAttribute{ | ||
Description: "The default gateway for this address.", | ||
Computed: true, | ||
}, | ||
"subnet_mask": schema.StringAttribute{ | ||
Description: "The mask that separates host bits from network bits for this address.", | ||
Computed: true, | ||
}, | ||
"prefix": schema.Int64Attribute{ | ||
Description: "The number of bits set in the subnet mask.", | ||
Computed: true, | ||
}, | ||
"type": schema.StringAttribute{ | ||
Description: "The type of address this is (ipv4, ipv6, ipv6/pool, ipv6/range).", | ||
Computed: true, | ||
}, | ||
"public": schema.BoolAttribute{ | ||
Description: "Whether this is a public or private IP address.", | ||
Computed: true, | ||
}, | ||
"rdns": schema.StringAttribute{ | ||
Description: "The reverse DNS assigned to this address. For public IPv4 addresses, this will be set to " + | ||
"a default value provided by Linode if not explicitly set.", | ||
Computed: true, | ||
}, | ||
"linode_id": schema.Int64Attribute{ | ||
Description: "The ID of the Linode this address currently belongs to.", | ||
Computed: true, | ||
}, | ||
"region": schema.StringAttribute{ | ||
Description: "The Region this IP address resides in.", | ||
Computed: true, | ||
}, | ||
"id": schema.StringAttribute{ | ||
Description: "A unique identifier for this datasource.", | ||
Description: "The data source's unique ID.", | ||
Computed: true, | ||
}, | ||
"reserved": schema.BoolAttribute{ | ||
Computed: true, | ||
Description: "Whether this IP is reserved or not.", | ||
}, | ||
"ip_addresses": schema.ListAttribute{ | ||
Description: "A list of all IPs.", | ||
Computed: true, | ||
ElementType: updatedIPObjectType, | ||
}, | ||
"filter_reserved": schema.BoolAttribute{ | ||
Description: "Filter IPs by reserved status.", | ||
Optional: true, | ||
"order": filterConfig.OrderSchema(), | ||
"order_by": filterConfig.OrderBySchema(), | ||
}, | ||
Blocks: map[string]schema.Block{ | ||
"filter": filterConfig.Schema(), | ||
"ip_addresses": schema.ListNestedBlock{ | ||
Description: "The returned list of Images.", | ||
NestedObject: schema.NestedBlockObject{ | ||
Attributes: map[string]schema.Attribute{ | ||
"address": schema.StringAttribute{ | ||
Description: "The IP address.", | ||
Computed: true, | ||
}, | ||
"gateway": schema.StringAttribute{ | ||
Description: "The default gateway for this address.", | ||
Computed: true, | ||
}, | ||
"subnet_mask": schema.StringAttribute{ | ||
Description: "The mask that separates host bits from network bits for this address.", | ||
Computed: true, | ||
}, | ||
"prefix": schema.Int64Attribute{ | ||
Description: "The number of bits set in the subnet mask.", | ||
Computed: true, | ||
}, | ||
"type": schema.StringAttribute{ | ||
Description: "The type of address this is (ipv4, ipv6, ipv6/pool, ipv6/range).", | ||
Computed: true, | ||
}, | ||
"public": schema.BoolAttribute{ | ||
Description: "Whether this is a public or private IP address.", | ||
Computed: true, | ||
}, | ||
"rdns": schema.StringAttribute{ | ||
Description: "The reverse DNS assigned to this address. For public IPv4 addresses, this will be set to " + | ||
"a default value provided by Linode if not explicitly set.", | ||
Computed: true, | ||
}, | ||
"linode_id": schema.Int64Attribute{ | ||
Description: "The ID of the Linode this address currently belongs to.", | ||
Computed: true, | ||
}, | ||
"region": schema.StringAttribute{ | ||
Description: "The Region this IP address resides in.", | ||
Computed: true, | ||
}, | ||
"reserved": schema.BoolAttribute{ | ||
Computed: true, | ||
Description: "Whether this IP is reserved or not.", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} |
Oops, something went wrong.