Skip to content

Commit

Permalink
Update computed attributes for port and connection
Browse files Browse the repository at this point in the history
  • Loading branch information
thogarty committed Jan 24, 2024
1 parent 2ce2ea0 commit a0352fc
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 34 deletions.
2 changes: 2 additions & 0 deletions equinix/data_source_fabric_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ func readFabricConnectionResourceSchema() map[string]*schema.Schema {
sch[key].Required = false
sch[key].Optional = false
sch[key].Computed = true
sch[key].MaxItems = 0
sch[key].ValidateFunc = nil
}
}
return sch
Expand Down
3 changes: 0 additions & 3 deletions equinix/resource_fabric_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ func FabricConnectionResourceSchema() map[string]*schema.Schema {
Type: schema.TypeSet,
Computed: true,
Description: "Connection type-specific operational data",
MaxItems: 1,
Elem: &schema.Resource{
Schema: operationSch(),
},
Expand All @@ -136,7 +135,6 @@ func FabricConnectionResourceSchema() map[string]*schema.Schema {
Type: schema.TypeSet,
Computed: true,
Description: "Customer account information that is associated with this connection",
MaxItems: 1,
Elem: &schema.Resource{
Schema: equinix_schema.AccountSch(),
},
Expand All @@ -145,7 +143,6 @@ func FabricConnectionResourceSchema() map[string]*schema.Schema {
Type: schema.TypeSet,
Computed: true,
Description: "Captures connection lifecycle change information",
MaxItems: 1,
Elem: &schema.Resource{
Schema: equinix_schema.ChangeLogSch(),
},
Expand Down
62 changes: 31 additions & 31 deletions equinix/resource_fabric_port.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,26 +132,6 @@ func FabricPortResourceSchema() map[string]*schema.Schema {
Schema: portOperationSch(),
},
},
"bandwidth": {
Type: schema.TypeInt,
Computed: true,
Description: "Port bandwidth in Mbps",
},
"available_bandwidth": {
Type: schema.TypeInt,
Computed: true,
Description: "Port available bandwidth in Mbps",
},
"used_bandwidth": {
Type: schema.TypeInt,
Computed: true,
Description: "Port used bandwidth in Mbps",
},
"service_type": {
Type: schema.TypeString,
Computed: true,
Description: "Port service type",
},
"account": {
Type: schema.TypeSet,
Computed: true,
Expand All @@ -168,6 +148,26 @@ func FabricPortResourceSchema() map[string]*schema.Schema {
Schema: equinix_schema.ChangeLogSch(),
},
},
"service_type": {
Type: schema.TypeString,
Computed: true,
Description: "Port service type",
},
"bandwidth": {
Type: schema.TypeInt,
Computed: true,
Description: "Port bandwidth in Mbps",
},
"available_bandwidth": {
Type: schema.TypeInt,
Computed: true,
Description: "Port available bandwidth in Mbps",
},
"used_bandwidth": {
Type: schema.TypeInt,
Computed: true,
Description: "Port used bandwidth in Mbps",
},
"location": {
Type: schema.TypeSet,
Computed: true,
Expand Down Expand Up @@ -208,16 +208,6 @@ func FabricPortResourceSchema() map[string]*schema.Schema {
}
}

func readGetPortsByNameQueryParamSch() map[string]*schema.Schema {
return map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Optional: true,
Description: "Query Parameter to Get Ports By Name",
},
}
}

func readFabricPortResourceSchemaUpdated() map[string]*schema.Schema {
sch := FabricPortResourceSchema()
sch["uuid"].Computed = true
Expand All @@ -238,7 +228,7 @@ func readFabricPortsResponseSchema() map[string]*schema.Schema {
},
"filters": {
Type: schema.TypeSet,
Optional: true,
Required: true,
Description: "name",
Elem: &schema.Resource{
Schema: readGetPortsByNameQueryParamSch(),
Expand All @@ -247,6 +237,16 @@ func readFabricPortsResponseSchema() map[string]*schema.Schema {
}
}

func readGetPortsByNameQueryParamSch() map[string]*schema.Schema {
return map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
Description: "Query Parameter to Get Ports By Name",
},
}
}

func portToFabric(portList []interface{}) v4.SimplifiedPort {
p := v4.SimplifiedPort{}
for _, pl := range portList {
Expand Down

0 comments on commit a0352fc

Please sign in to comment.