Skip to content

Commit

Permalink
enh: Update JSON data/resource with Netbox 3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
smutel committed Jun 9, 2022
1 parent 00891aa commit 973ab72
Show file tree
Hide file tree
Showing 93 changed files with 2,922 additions and 2,202 deletions.
24 changes: 24 additions & 0 deletions docs/data-sources/json_ipam_asns_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# netbox\_json\_ipam\_asns\_list Data Source

Get json output from the ipam_asns_list Netbox endpoint

## Example Usage

```hcl
data "netbox_json_ipam_asns_list" "test" {
limit = 0
}
output "example" {
value = jsondecode(data.netbox_json_ipam_asns_list.test.json)
}
```

## Argument Reference

* ``limit`` (Optional). The max number of returned results. If 0 is specified, all records will be returned.

## Attributes Reference

In addition to the above arguments, the following attributes are exported:
* ``json`` - JSON output of the list of objects for this Netbox endpoint.

24 changes: 24 additions & 0 deletions docs/data-sources/json_ipam_fhrp_group_assignments_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# netbox\_json\_ipam\_fhrp\_group\_assignments\_list Data Source

Get json output from the ipam_fhrp_group_assignments_list Netbox endpoint

## Example Usage

```hcl
data "netbox_json_ipam_fhrp_group_assignments_list" "test" {
limit = 0
}
output "example" {
value = jsondecode(data.netbox_json_ipam_fhrp_group_assignments_list.test.json)
}
```

## Argument Reference

* ``limit`` (Optional). The max number of returned results. If 0 is specified, all records will be returned.

## Attributes Reference

In addition to the above arguments, the following attributes are exported:
* ``json`` - JSON output of the list of objects for this Netbox endpoint.

24 changes: 24 additions & 0 deletions docs/data-sources/json_ipam_fhrp_groups_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# netbox\_json\_ipam\_fhrp\_groups\_list Data Source

Get json output from the ipam_fhrp_groups_list Netbox endpoint

## Example Usage

```hcl
data "netbox_json_ipam_fhrp_groups_list" "test" {
limit = 0
}
output "example" {
value = jsondecode(data.netbox_json_ipam_fhrp_groups_list.test.json)
}
```

## Argument Reference

* ``limit`` (Optional). The max number of returned results. If 0 is specified, all records will be returned.

## Attributes Reference

In addition to the above arguments, the following attributes are exported:
* ``json`` - JSON output of the list of objects for this Netbox endpoint.

24 changes: 24 additions & 0 deletions docs/data-sources/json_tenancy_contact_assignments_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# netbox\_json\_tenancy\_contact\_assignments\_list Data Source

Get json output from the tenancy_contact_assignments_list Netbox endpoint

## Example Usage

```hcl
data "netbox_json_tenancy_contact_assignments_list" "test" {
limit = 0
}
output "example" {
value = jsondecode(data.netbox_json_tenancy_contact_assignments_list.test.json)
}
```

## Argument Reference

* ``limit`` (Optional). The max number of returned results. If 0 is specified, all records will be returned.

## Attributes Reference

In addition to the above arguments, the following attributes are exported:
* ``json`` - JSON output of the list of objects for this Netbox endpoint.

24 changes: 24 additions & 0 deletions docs/data-sources/json_tenancy_contact_groups_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# netbox\_json\_tenancy\_contact\_groups\_list Data Source

Get json output from the tenancy_contact_groups_list Netbox endpoint

## Example Usage

```hcl
data "netbox_json_tenancy_contact_groups_list" "test" {
limit = 0
}
output "example" {
value = jsondecode(data.netbox_json_tenancy_contact_groups_list.test.json)
}
```

## Argument Reference

* ``limit`` (Optional). The max number of returned results. If 0 is specified, all records will be returned.

## Attributes Reference

In addition to the above arguments, the following attributes are exported:
* ``json`` - JSON output of the list of objects for this Netbox endpoint.

24 changes: 24 additions & 0 deletions docs/data-sources/json_tenancy_contact_roles_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# netbox\_json\_tenancy\_contact\_roles\_list Data Source

Get json output from the tenancy_contact_roles_list Netbox endpoint

## Example Usage

```hcl
data "netbox_json_tenancy_contact_roles_list" "test" {
limit = 0
}
output "example" {
value = jsondecode(data.netbox_json_tenancy_contact_roles_list.test.json)
}
```

## Argument Reference

* ``limit`` (Optional). The max number of returned results. If 0 is specified, all records will be returned.

## Attributes Reference

In addition to the above arguments, the following attributes are exported:
* ``json`` - JSON output of the list of objects for this Netbox endpoint.

24 changes: 24 additions & 0 deletions docs/data-sources/json_tenancy_contacts_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# netbox\_json\_tenancy\_contacts\_list Data Source

Get json output from the tenancy_contacts_list Netbox endpoint

## Example Usage

```hcl
data "netbox_json_tenancy_contacts_list" "test" {
limit = 0
}
output "example" {
value = jsondecode(data.netbox_json_tenancy_contacts_list.test.json)
}
```

## Argument Reference

* ``limit`` (Optional). The max number of returned results. If 0 is specified, all records will be returned.

## Attributes Reference

In addition to the above arguments, the following attributes are exported:
* ``json`` - JSON output of the list of objects for this Netbox endpoint.

24 changes: 24 additions & 0 deletions docs/data-sources/json_wireless_wireless_lan_groups_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# netbox\_json\_wireless\_wireless\_lan\_groups\_list Data Source

Get json output from the wireless_wireless_lan_groups_list Netbox endpoint

## Example Usage

```hcl
data "netbox_json_wireless_wireless_lan_groups_list" "test" {
limit = 0
}
output "example" {
value = jsondecode(data.netbox_json_wireless_wireless_lan_groups_list.test.json)
}
```

## Argument Reference

* ``limit`` (Optional). The max number of returned results. If 0 is specified, all records will be returned.

## Attributes Reference

In addition to the above arguments, the following attributes are exported:
* ``json`` - JSON output of the list of objects for this Netbox endpoint.

24 changes: 24 additions & 0 deletions docs/data-sources/json_wireless_wireless_lans_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# netbox\_json\_wireless\_wireless\_lans\_list Data Source

Get json output from the wireless_wireless_lans_list Netbox endpoint

## Example Usage

```hcl
data "netbox_json_wireless_wireless_lans_list" "test" {
limit = 0
}
output "example" {
value = jsondecode(data.netbox_json_wireless_wireless_lans_list.test.json)
}
```

## Argument Reference

* ``limit`` (Optional). The max number of returned results. If 0 is specified, all records will be returned.

## Attributes Reference

In addition to the above arguments, the following attributes are exported:
* ``json`` - JSON output of the list of objects for this Netbox endpoint.

24 changes: 24 additions & 0 deletions docs/data-sources/json_wireless_wireless_links_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# netbox\_json\_wireless\_wireless\_links\_list Data Source

Get json output from the wireless_wireless_links_list Netbox endpoint

## Example Usage

```hcl
data "netbox_json_wireless_wireless_links_list" "test" {
limit = 0
}
output "example" {
value = jsondecode(data.netbox_json_wireless_wireless_links_list.test.json)
}
```

## Argument Reference

* ``limit`` (Optional). The max number of returned results. If 0 is specified, all records will be returned.

## Attributes Reference

In addition to the above arguments, the following attributes are exported:
* ``json`` - JSON output of the list of objects for this Netbox endpoint.

62 changes: 31 additions & 31 deletions netbox/data_netbox_json_circuits_circuit_terminations_list.go
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
package netbox

import (
"encoding/json"
"encoding/json"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
netboxclient "github.com/smutel/go-netbox/netbox/client"
"github.com/smutel/go-netbox/netbox/client/circuits"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
netboxclient "github.com/smutel/go-netbox/netbox/client"
"github.com/smutel/go-netbox/netbox/client/circuits"
)

func dataNetboxJSONCircuitsCircuitTerminationsList() *schema.Resource {
return &schema.Resource{
Read: dataNetboxJSONCircuitsCircuitTerminationsListRead,

Schema: map[string]*schema.Schema{
"limit": {
Type: schema.TypeInt,
Optional: true,
Default: 0,
},
"json": {
Type: schema.TypeString,
Computed: true,
},
},
}
return &schema.Resource{
Read: dataNetboxJSONCircuitsCircuitTerminationsListRead,

Schema: map[string]*schema.Schema{
"limit": {
Type: schema.TypeInt,
Optional: true,
Default: 0,
},
"json": {
Type: schema.TypeString,
Computed: true,
},
},
}
}

func dataNetboxJSONCircuitsCircuitTerminationsListRead(d *schema.ResourceData, m interface{}) error {
client := m.(*netboxclient.NetBoxAPI)
client := m.(*netboxclient.NetBoxAPI)

params := circuits.NewCircuitsCircuitTerminationsListParams()
limit := int64(d.Get("limit").(int))
params.Limit = &limit
params := circuits.NewCircuitsCircuitTerminationsListParams()
limit := int64(d.Get("limit").(int))
params.Limit = &limit

list, err := client.Circuits.CircuitsCircuitTerminationsList(params, nil)
if err != nil {
return err
}
list, err := client.Circuits.CircuitsCircuitTerminationsList(params, nil)
if err != nil {
return err
}

j, _ := json.Marshal(list.Payload.Results)
j, _ := json.Marshal(list.Payload.Results)

d.Set("json", string(j))
d.SetId("NetboxJSONCircuitsCircuitTerminationsList")
d.Set("json", string(j))
d.SetId("NetboxJSONCircuitsCircuitTerminationsList")

return nil
return nil
}
Loading

0 comments on commit 973ab72

Please sign in to comment.