From 973ab72db755fbd4187fedda72ac1055aa1de9cd Mon Sep 17 00:00:00 2001 From: Samuel Mutel <12967891+smutel@users.noreply.github.com> Date: Thu, 9 Jun 2022 08:32:51 +0200 Subject: [PATCH] enh: Update JSON data/resource with Netbox 3.1 --- docs/data-sources/json_ipam_asns_list.md | 24 +++++++ .../json_ipam_fhrp_group_assignments_list.md | 24 +++++++ .../json_ipam_fhrp_groups_list.md | 24 +++++++ .../json_tenancy_contact_assignments_list.md | 24 +++++++ .../json_tenancy_contact_groups_list.md | 24 +++++++ .../json_tenancy_contact_roles_list.md | 24 +++++++ .../json_tenancy_contacts_list.md | 24 +++++++ .../json_wireless_wireless_lan_groups_list.md | 24 +++++++ .../json_wireless_wireless_lans_list.md | 24 +++++++ .../json_wireless_wireless_links_list.md | 24 +++++++ ...json_circuits_circuit_terminations_list.go | 62 +++++++++---------- ...netbox_json_circuits_circuit_types_list.go | 62 +++++++++---------- ...data_netbox_json_circuits_circuits_list.go | 62 +++++++++---------- ...ox_json_circuits_provider_networks_list.go | 62 +++++++++---------- ...ata_netbox_json_circuits_providers_list.go | 62 +++++++++---------- netbox/data_netbox_json_dcim_cables_list.go | 62 +++++++++---------- ...x_json_dcim_console_port_templates_list.go | 62 +++++++++---------- ...ata_netbox_json_dcim_console_ports_list.go | 62 +++++++++---------- ...dcim_console_server_port_templates_list.go | 62 +++++++++---------- ...box_json_dcim_console_server_ports_list.go | 62 +++++++++---------- ...box_json_dcim_device_bay_templates_list.go | 62 +++++++++---------- .../data_netbox_json_dcim_device_bays_list.go | 62 +++++++++---------- ...data_netbox_json_dcim_device_roles_list.go | 62 +++++++++---------- ...data_netbox_json_dcim_device_types_list.go | 62 +++++++++---------- netbox/data_netbox_json_dcim_devices_list.go | 62 +++++++++---------- ...box_json_dcim_front_port_templates_list.go | 62 +++++++++---------- .../data_netbox_json_dcim_front_ports_list.go | 62 +++++++++---------- ...tbox_json_dcim_interface_templates_list.go | 62 +++++++++---------- .../data_netbox_json_dcim_interfaces_list.go | 62 +++++++++---------- ...a_netbox_json_dcim_inventory_items_list.go | 62 +++++++++---------- .../data_netbox_json_dcim_locations_list.go | 62 +++++++++---------- ...ata_netbox_json_dcim_manufacturers_list.go | 62 +++++++++---------- .../data_netbox_json_dcim_platforms_list.go | 62 +++++++++---------- .../data_netbox_json_dcim_power_feeds_list.go | 62 +++++++++---------- ...x_json_dcim_power_outlet_templates_list.go | 62 +++++++++---------- ...ata_netbox_json_dcim_power_outlets_list.go | 62 +++++++++---------- ...data_netbox_json_dcim_power_panels_list.go | 62 +++++++++---------- ...box_json_dcim_power_port_templates_list.go | 62 +++++++++---------- .../data_netbox_json_dcim_power_ports_list.go | 62 +++++++++---------- ...netbox_json_dcim_rack_reservations_list.go | 62 +++++++++---------- .../data_netbox_json_dcim_rack_roles_list.go | 62 +++++++++---------- netbox/data_netbox_json_dcim_racks_list.go | 62 +++++++++---------- ...tbox_json_dcim_rear_port_templates_list.go | 62 +++++++++---------- .../data_netbox_json_dcim_rear_ports_list.go | 62 +++++++++---------- netbox/data_netbox_json_dcim_regions_list.go | 62 +++++++++---------- .../data_netbox_json_dcim_site_groups_list.go | 62 +++++++++---------- netbox/data_netbox_json_dcim_sites_list.go | 62 +++++++++---------- ...a_netbox_json_dcim_virtual_chassis_list.go | 62 +++++++++---------- ...netbox_json_extras_config_contexts_list.go | 62 +++++++++---------- ...a_netbox_json_extras_content_types_list.go | 62 +++++++++---------- ...a_netbox_json_extras_custom_fields_list.go | 62 +++++++++---------- ...ta_netbox_json_extras_custom_links_list.go | 62 +++++++++---------- ...etbox_json_extras_export_templates_list.go | 62 +++++++++---------- ...tbox_json_extras_image_attachments_list.go | 62 +++++++++---------- ...ata_netbox_json_extras_job_results_list.go | 62 +++++++++---------- ...netbox_json_extras_journal_entries_list.go | 62 +++++++++---------- ..._netbox_json_extras_object_changes_list.go | 62 +++++++++---------- netbox/data_netbox_json_extras_tags_list.go | 62 +++++++++---------- .../data_netbox_json_extras_webhooks_list.go | 62 +++++++++---------- .../data_netbox_json_ipam_aggregates_list.go | 62 +++++++++---------- netbox/data_netbox_json_ipam_asns_list.go | 47 ++++++++++++++ ...x_json_ipam_fhrp_group_assignments_list.go | 47 ++++++++++++++ .../data_netbox_json_ipam_fhrp_groups_list.go | 47 ++++++++++++++ ...data_netbox_json_ipam_ip_addresses_list.go | 62 +++++++++---------- .../data_netbox_json_ipam_ip_ranges_list.go | 62 +++++++++---------- netbox/data_netbox_json_ipam_prefixes_list.go | 62 +++++++++---------- netbox/data_netbox_json_ipam_rirs_list.go | 62 +++++++++---------- netbox/data_netbox_json_ipam_roles_list.go | 62 +++++++++---------- ...ata_netbox_json_ipam_route_targets_list.go | 62 +++++++++---------- netbox/data_netbox_json_ipam_services_list.go | 62 +++++++++---------- .../data_netbox_json_ipam_vlan_groups_list.go | 62 +++++++++---------- netbox/data_netbox_json_ipam_vlans_list.go | 62 +++++++++---------- netbox/data_netbox_json_ipam_vrfs_list.go | 62 +++++++++---------- ...x_json_tenancy_contact_assignments_list.go | 47 ++++++++++++++ ...netbox_json_tenancy_contact_groups_list.go | 47 ++++++++++++++ ..._netbox_json_tenancy_contact_roles_list.go | 47 ++++++++++++++ .../data_netbox_json_tenancy_contacts_list.go | 47 ++++++++++++++ ..._netbox_json_tenancy_tenant_groups_list.go | 62 +++++++++---------- .../data_netbox_json_tenancy_tenants_list.go | 62 +++++++++---------- netbox/data_netbox_json_users_groups_list.go | 62 +++++++++---------- ...data_netbox_json_users_permissions_list.go | 62 +++++++++---------- netbox/data_netbox_json_users_tokens_list.go | 62 +++++++++---------- netbox/data_netbox_json_users_users_list.go | 62 +++++++++---------- ...json_virtualization_cluster_groups_list.go | 62 +++++++++---------- ..._json_virtualization_cluster_types_list.go | 62 +++++++++---------- ...etbox_json_virtualization_clusters_list.go | 62 +++++++++---------- ...box_json_virtualization_interfaces_list.go | 62 +++++++++---------- ...on_virtualization_virtual_machines_list.go | 62 +++++++++---------- ..._json_wireless_wireless_lan_groups_list.go | 47 ++++++++++++++ ...netbox_json_wireless_wireless_lans_list.go | 47 ++++++++++++++ ...etbox_json_wireless_wireless_links_list.go | 47 ++++++++++++++ netbox/provider.go | 10 +++ utils/generateJsonDatasources | 2 +- 93 files changed, 2922 insertions(+), 2202 deletions(-) create mode 100644 docs/data-sources/json_ipam_asns_list.md create mode 100644 docs/data-sources/json_ipam_fhrp_group_assignments_list.md create mode 100644 docs/data-sources/json_ipam_fhrp_groups_list.md create mode 100644 docs/data-sources/json_tenancy_contact_assignments_list.md create mode 100644 docs/data-sources/json_tenancy_contact_groups_list.md create mode 100644 docs/data-sources/json_tenancy_contact_roles_list.md create mode 100644 docs/data-sources/json_tenancy_contacts_list.md create mode 100644 docs/data-sources/json_wireless_wireless_lan_groups_list.md create mode 100644 docs/data-sources/json_wireless_wireless_lans_list.md create mode 100644 docs/data-sources/json_wireless_wireless_links_list.md create mode 100644 netbox/data_netbox_json_ipam_asns_list.go create mode 100644 netbox/data_netbox_json_ipam_fhrp_group_assignments_list.go create mode 100644 netbox/data_netbox_json_ipam_fhrp_groups_list.go create mode 100644 netbox/data_netbox_json_tenancy_contact_assignments_list.go create mode 100644 netbox/data_netbox_json_tenancy_contact_groups_list.go create mode 100644 netbox/data_netbox_json_tenancy_contact_roles_list.go create mode 100644 netbox/data_netbox_json_tenancy_contacts_list.go create mode 100644 netbox/data_netbox_json_wireless_wireless_lan_groups_list.go create mode 100644 netbox/data_netbox_json_wireless_wireless_lans_list.go create mode 100644 netbox/data_netbox_json_wireless_wireless_links_list.go diff --git a/docs/data-sources/json_ipam_asns_list.md b/docs/data-sources/json_ipam_asns_list.md new file mode 100644 index 000000000..37e82b3c4 --- /dev/null +++ b/docs/data-sources/json_ipam_asns_list.md @@ -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. + diff --git a/docs/data-sources/json_ipam_fhrp_group_assignments_list.md b/docs/data-sources/json_ipam_fhrp_group_assignments_list.md new file mode 100644 index 000000000..3d9c49a4b --- /dev/null +++ b/docs/data-sources/json_ipam_fhrp_group_assignments_list.md @@ -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. + diff --git a/docs/data-sources/json_ipam_fhrp_groups_list.md b/docs/data-sources/json_ipam_fhrp_groups_list.md new file mode 100644 index 000000000..f0ce1b838 --- /dev/null +++ b/docs/data-sources/json_ipam_fhrp_groups_list.md @@ -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. + diff --git a/docs/data-sources/json_tenancy_contact_assignments_list.md b/docs/data-sources/json_tenancy_contact_assignments_list.md new file mode 100644 index 000000000..9fb02ec39 --- /dev/null +++ b/docs/data-sources/json_tenancy_contact_assignments_list.md @@ -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. + diff --git a/docs/data-sources/json_tenancy_contact_groups_list.md b/docs/data-sources/json_tenancy_contact_groups_list.md new file mode 100644 index 000000000..7a7c1ed04 --- /dev/null +++ b/docs/data-sources/json_tenancy_contact_groups_list.md @@ -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. + diff --git a/docs/data-sources/json_tenancy_contact_roles_list.md b/docs/data-sources/json_tenancy_contact_roles_list.md new file mode 100644 index 000000000..39f943429 --- /dev/null +++ b/docs/data-sources/json_tenancy_contact_roles_list.md @@ -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. + diff --git a/docs/data-sources/json_tenancy_contacts_list.md b/docs/data-sources/json_tenancy_contacts_list.md new file mode 100644 index 000000000..2422ba8ac --- /dev/null +++ b/docs/data-sources/json_tenancy_contacts_list.md @@ -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. + diff --git a/docs/data-sources/json_wireless_wireless_lan_groups_list.md b/docs/data-sources/json_wireless_wireless_lan_groups_list.md new file mode 100644 index 000000000..0723d504f --- /dev/null +++ b/docs/data-sources/json_wireless_wireless_lan_groups_list.md @@ -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. + diff --git a/docs/data-sources/json_wireless_wireless_lans_list.md b/docs/data-sources/json_wireless_wireless_lans_list.md new file mode 100644 index 000000000..7562e1339 --- /dev/null +++ b/docs/data-sources/json_wireless_wireless_lans_list.md @@ -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. + diff --git a/docs/data-sources/json_wireless_wireless_links_list.md b/docs/data-sources/json_wireless_wireless_links_list.md new file mode 100644 index 000000000..b2bf21372 --- /dev/null +++ b/docs/data-sources/json_wireless_wireless_links_list.md @@ -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. + diff --git a/netbox/data_netbox_json_circuits_circuit_terminations_list.go b/netbox/data_netbox_json_circuits_circuit_terminations_list.go index 040f26285..0091ddded 100644 --- a/netbox/data_netbox_json_circuits_circuit_terminations_list.go +++ b/netbox/data_netbox_json_circuits_circuit_terminations_list.go @@ -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 } diff --git a/netbox/data_netbox_json_circuits_circuit_types_list.go b/netbox/data_netbox_json_circuits_circuit_types_list.go index 9e21e4226..a6649f645 100644 --- a/netbox/data_netbox_json_circuits_circuit_types_list.go +++ b/netbox/data_netbox_json_circuits_circuit_types_list.go @@ -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 dataNetboxJSONCircuitsCircuitTypesList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONCircuitsCircuitTypesListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONCircuitsCircuitTypesListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONCircuitsCircuitTypesListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := circuits.NewCircuitsCircuitTypesListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := circuits.NewCircuitsCircuitTypesListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Circuits.CircuitsCircuitTypesList(params, nil) - if err != nil { - return err - } + list, err := client.Circuits.CircuitsCircuitTypesList(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("NetboxJSONCircuitsCircuitTypesList") + d.Set("json", string(j)) + d.SetId("NetboxJSONCircuitsCircuitTypesList") - return nil + return nil } diff --git a/netbox/data_netbox_json_circuits_circuits_list.go b/netbox/data_netbox_json_circuits_circuits_list.go index f3b157e81..bc370b752 100644 --- a/netbox/data_netbox_json_circuits_circuits_list.go +++ b/netbox/data_netbox_json_circuits_circuits_list.go @@ -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 dataNetboxJSONCircuitsCircuitsList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONCircuitsCircuitsListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONCircuitsCircuitsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONCircuitsCircuitsListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := circuits.NewCircuitsCircuitsListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := circuits.NewCircuitsCircuitsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Circuits.CircuitsCircuitsList(params, nil) - if err != nil { - return err - } + list, err := client.Circuits.CircuitsCircuitsList(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("NetboxJSONCircuitsCircuitsList") + d.Set("json", string(j)) + d.SetId("NetboxJSONCircuitsCircuitsList") - return nil + return nil } diff --git a/netbox/data_netbox_json_circuits_provider_networks_list.go b/netbox/data_netbox_json_circuits_provider_networks_list.go index f924266ec..3f8ddc9fc 100644 --- a/netbox/data_netbox_json_circuits_provider_networks_list.go +++ b/netbox/data_netbox_json_circuits_provider_networks_list.go @@ -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 dataNetboxJSONCircuitsProviderNetworksList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONCircuitsProviderNetworksListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONCircuitsProviderNetworksListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONCircuitsProviderNetworksListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := circuits.NewCircuitsProviderNetworksListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := circuits.NewCircuitsProviderNetworksListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Circuits.CircuitsProviderNetworksList(params, nil) - if err != nil { - return err - } + list, err := client.Circuits.CircuitsProviderNetworksList(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("NetboxJSONCircuitsProviderNetworksList") + d.Set("json", string(j)) + d.SetId("NetboxJSONCircuitsProviderNetworksList") - return nil + return nil } diff --git a/netbox/data_netbox_json_circuits_providers_list.go b/netbox/data_netbox_json_circuits_providers_list.go index 5fad30014..6e11b2a1e 100644 --- a/netbox/data_netbox_json_circuits_providers_list.go +++ b/netbox/data_netbox_json_circuits_providers_list.go @@ -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 dataNetboxJSONCircuitsProvidersList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONCircuitsProvidersListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONCircuitsProvidersListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONCircuitsProvidersListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := circuits.NewCircuitsProvidersListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := circuits.NewCircuitsProvidersListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Circuits.CircuitsProvidersList(params, nil) - if err != nil { - return err - } + list, err := client.Circuits.CircuitsProvidersList(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("NetboxJSONCircuitsProvidersList") + d.Set("json", string(j)) + d.SetId("NetboxJSONCircuitsProvidersList") - return nil + return nil } diff --git a/netbox/data_netbox_json_dcim_cables_list.go b/netbox/data_netbox_json_dcim_cables_list.go index fdb35d4d9..6e9eb8ba4 100644 --- a/netbox/data_netbox_json_dcim_cables_list.go +++ b/netbox/data_netbox_json_dcim_cables_list.go @@ -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/dcim" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/dcim" ) func dataNetboxJSONDcimCablesList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONDcimCablesListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONDcimCablesListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONDcimCablesListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := dcim.NewDcimCablesListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := dcim.NewDcimCablesListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Dcim.DcimCablesList(params, nil) - if err != nil { - return err - } + list, err := client.Dcim.DcimCablesList(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("NetboxJSONDcimCablesList") + d.Set("json", string(j)) + d.SetId("NetboxJSONDcimCablesList") - return nil + return nil } diff --git a/netbox/data_netbox_json_dcim_console_port_templates_list.go b/netbox/data_netbox_json_dcim_console_port_templates_list.go index c0474e7be..c77d0c155 100644 --- a/netbox/data_netbox_json_dcim_console_port_templates_list.go +++ b/netbox/data_netbox_json_dcim_console_port_templates_list.go @@ -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/dcim" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/dcim" ) func dataNetboxJSONDcimConsolePortTemplatesList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONDcimConsolePortTemplatesListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONDcimConsolePortTemplatesListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONDcimConsolePortTemplatesListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := dcim.NewDcimConsolePortTemplatesListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := dcim.NewDcimConsolePortTemplatesListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Dcim.DcimConsolePortTemplatesList(params, nil) - if err != nil { - return err - } + list, err := client.Dcim.DcimConsolePortTemplatesList(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("NetboxJSONDcimConsolePortTemplatesList") + d.Set("json", string(j)) + d.SetId("NetboxJSONDcimConsolePortTemplatesList") - return nil + return nil } diff --git a/netbox/data_netbox_json_dcim_console_ports_list.go b/netbox/data_netbox_json_dcim_console_ports_list.go index 42a54ff5c..7b05905f5 100644 --- a/netbox/data_netbox_json_dcim_console_ports_list.go +++ b/netbox/data_netbox_json_dcim_console_ports_list.go @@ -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/dcim" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/dcim" ) func dataNetboxJSONDcimConsolePortsList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONDcimConsolePortsListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONDcimConsolePortsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONDcimConsolePortsListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := dcim.NewDcimConsolePortsListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := dcim.NewDcimConsolePortsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Dcim.DcimConsolePortsList(params, nil) - if err != nil { - return err - } + list, err := client.Dcim.DcimConsolePortsList(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("NetboxJSONDcimConsolePortsList") + d.Set("json", string(j)) + d.SetId("NetboxJSONDcimConsolePortsList") - return nil + return nil } diff --git a/netbox/data_netbox_json_dcim_console_server_port_templates_list.go b/netbox/data_netbox_json_dcim_console_server_port_templates_list.go index 72f855571..bed1ec397 100644 --- a/netbox/data_netbox_json_dcim_console_server_port_templates_list.go +++ b/netbox/data_netbox_json_dcim_console_server_port_templates_list.go @@ -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/dcim" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/dcim" ) func dataNetboxJSONDcimConsoleServerPortTemplatesList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONDcimConsoleServerPortTemplatesListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONDcimConsoleServerPortTemplatesListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONDcimConsoleServerPortTemplatesListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := dcim.NewDcimConsoleServerPortTemplatesListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := dcim.NewDcimConsoleServerPortTemplatesListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Dcim.DcimConsoleServerPortTemplatesList(params, nil) - if err != nil { - return err - } + list, err := client.Dcim.DcimConsoleServerPortTemplatesList(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("NetboxJSONDcimConsoleServerPortTemplatesList") + d.Set("json", string(j)) + d.SetId("NetboxJSONDcimConsoleServerPortTemplatesList") - return nil + return nil } diff --git a/netbox/data_netbox_json_dcim_console_server_ports_list.go b/netbox/data_netbox_json_dcim_console_server_ports_list.go index 1fd593e91..14e7f8971 100644 --- a/netbox/data_netbox_json_dcim_console_server_ports_list.go +++ b/netbox/data_netbox_json_dcim_console_server_ports_list.go @@ -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/dcim" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/dcim" ) func dataNetboxJSONDcimConsoleServerPortsList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONDcimConsoleServerPortsListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONDcimConsoleServerPortsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONDcimConsoleServerPortsListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := dcim.NewDcimConsoleServerPortsListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := dcim.NewDcimConsoleServerPortsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Dcim.DcimConsoleServerPortsList(params, nil) - if err != nil { - return err - } + list, err := client.Dcim.DcimConsoleServerPortsList(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("NetboxJSONDcimConsoleServerPortsList") + d.Set("json", string(j)) + d.SetId("NetboxJSONDcimConsoleServerPortsList") - return nil + return nil } diff --git a/netbox/data_netbox_json_dcim_device_bay_templates_list.go b/netbox/data_netbox_json_dcim_device_bay_templates_list.go index 34ae74c4e..c48e5c9f0 100644 --- a/netbox/data_netbox_json_dcim_device_bay_templates_list.go +++ b/netbox/data_netbox_json_dcim_device_bay_templates_list.go @@ -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/dcim" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/dcim" ) func dataNetboxJSONDcimDeviceBayTemplatesList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONDcimDeviceBayTemplatesListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONDcimDeviceBayTemplatesListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONDcimDeviceBayTemplatesListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := dcim.NewDcimDeviceBayTemplatesListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := dcim.NewDcimDeviceBayTemplatesListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Dcim.DcimDeviceBayTemplatesList(params, nil) - if err != nil { - return err - } + list, err := client.Dcim.DcimDeviceBayTemplatesList(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("NetboxJSONDcimDeviceBayTemplatesList") + d.Set("json", string(j)) + d.SetId("NetboxJSONDcimDeviceBayTemplatesList") - return nil + return nil } diff --git a/netbox/data_netbox_json_dcim_device_bays_list.go b/netbox/data_netbox_json_dcim_device_bays_list.go index c11273dd2..e7e571f65 100644 --- a/netbox/data_netbox_json_dcim_device_bays_list.go +++ b/netbox/data_netbox_json_dcim_device_bays_list.go @@ -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/dcim" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/dcim" ) func dataNetboxJSONDcimDeviceBaysList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONDcimDeviceBaysListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONDcimDeviceBaysListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONDcimDeviceBaysListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := dcim.NewDcimDeviceBaysListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := dcim.NewDcimDeviceBaysListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Dcim.DcimDeviceBaysList(params, nil) - if err != nil { - return err - } + list, err := client.Dcim.DcimDeviceBaysList(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("NetboxJSONDcimDeviceBaysList") + d.Set("json", string(j)) + d.SetId("NetboxJSONDcimDeviceBaysList") - return nil + return nil } diff --git a/netbox/data_netbox_json_dcim_device_roles_list.go b/netbox/data_netbox_json_dcim_device_roles_list.go index d93ed8768..c11945a70 100644 --- a/netbox/data_netbox_json_dcim_device_roles_list.go +++ b/netbox/data_netbox_json_dcim_device_roles_list.go @@ -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/dcim" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/dcim" ) func dataNetboxJSONDcimDeviceRolesList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONDcimDeviceRolesListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONDcimDeviceRolesListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONDcimDeviceRolesListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := dcim.NewDcimDeviceRolesListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := dcim.NewDcimDeviceRolesListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Dcim.DcimDeviceRolesList(params, nil) - if err != nil { - return err - } + list, err := client.Dcim.DcimDeviceRolesList(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("NetboxJSONDcimDeviceRolesList") + d.Set("json", string(j)) + d.SetId("NetboxJSONDcimDeviceRolesList") - return nil + return nil } diff --git a/netbox/data_netbox_json_dcim_device_types_list.go b/netbox/data_netbox_json_dcim_device_types_list.go index 89c5f76ae..2de71c0df 100644 --- a/netbox/data_netbox_json_dcim_device_types_list.go +++ b/netbox/data_netbox_json_dcim_device_types_list.go @@ -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/dcim" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/dcim" ) func dataNetboxJSONDcimDeviceTypesList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONDcimDeviceTypesListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONDcimDeviceTypesListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONDcimDeviceTypesListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := dcim.NewDcimDeviceTypesListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := dcim.NewDcimDeviceTypesListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Dcim.DcimDeviceTypesList(params, nil) - if err != nil { - return err - } + list, err := client.Dcim.DcimDeviceTypesList(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("NetboxJSONDcimDeviceTypesList") + d.Set("json", string(j)) + d.SetId("NetboxJSONDcimDeviceTypesList") - return nil + return nil } diff --git a/netbox/data_netbox_json_dcim_devices_list.go b/netbox/data_netbox_json_dcim_devices_list.go index f3741a745..8cc8884d9 100644 --- a/netbox/data_netbox_json_dcim_devices_list.go +++ b/netbox/data_netbox_json_dcim_devices_list.go @@ -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/dcim" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/dcim" ) func dataNetboxJSONDcimDevicesList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONDcimDevicesListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONDcimDevicesListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONDcimDevicesListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := dcim.NewDcimDevicesListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := dcim.NewDcimDevicesListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Dcim.DcimDevicesList(params, nil) - if err != nil { - return err - } + list, err := client.Dcim.DcimDevicesList(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("NetboxJSONDcimDevicesList") + d.Set("json", string(j)) + d.SetId("NetboxJSONDcimDevicesList") - return nil + return nil } diff --git a/netbox/data_netbox_json_dcim_front_port_templates_list.go b/netbox/data_netbox_json_dcim_front_port_templates_list.go index 0b6ab6327..c65a4985c 100644 --- a/netbox/data_netbox_json_dcim_front_port_templates_list.go +++ b/netbox/data_netbox_json_dcim_front_port_templates_list.go @@ -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/dcim" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/dcim" ) func dataNetboxJSONDcimFrontPortTemplatesList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONDcimFrontPortTemplatesListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONDcimFrontPortTemplatesListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONDcimFrontPortTemplatesListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := dcim.NewDcimFrontPortTemplatesListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := dcim.NewDcimFrontPortTemplatesListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Dcim.DcimFrontPortTemplatesList(params, nil) - if err != nil { - return err - } + list, err := client.Dcim.DcimFrontPortTemplatesList(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("NetboxJSONDcimFrontPortTemplatesList") + d.Set("json", string(j)) + d.SetId("NetboxJSONDcimFrontPortTemplatesList") - return nil + return nil } diff --git a/netbox/data_netbox_json_dcim_front_ports_list.go b/netbox/data_netbox_json_dcim_front_ports_list.go index 9751de4e2..cefa2bbb2 100644 --- a/netbox/data_netbox_json_dcim_front_ports_list.go +++ b/netbox/data_netbox_json_dcim_front_ports_list.go @@ -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/dcim" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/dcim" ) func dataNetboxJSONDcimFrontPortsList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONDcimFrontPortsListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONDcimFrontPortsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONDcimFrontPortsListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := dcim.NewDcimFrontPortsListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := dcim.NewDcimFrontPortsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Dcim.DcimFrontPortsList(params, nil) - if err != nil { - return err - } + list, err := client.Dcim.DcimFrontPortsList(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("NetboxJSONDcimFrontPortsList") + d.Set("json", string(j)) + d.SetId("NetboxJSONDcimFrontPortsList") - return nil + return nil } diff --git a/netbox/data_netbox_json_dcim_interface_templates_list.go b/netbox/data_netbox_json_dcim_interface_templates_list.go index 51d6852b9..997233e21 100644 --- a/netbox/data_netbox_json_dcim_interface_templates_list.go +++ b/netbox/data_netbox_json_dcim_interface_templates_list.go @@ -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/dcim" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/dcim" ) func dataNetboxJSONDcimInterfaceTemplatesList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONDcimInterfaceTemplatesListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONDcimInterfaceTemplatesListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONDcimInterfaceTemplatesListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := dcim.NewDcimInterfaceTemplatesListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := dcim.NewDcimInterfaceTemplatesListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Dcim.DcimInterfaceTemplatesList(params, nil) - if err != nil { - return err - } + list, err := client.Dcim.DcimInterfaceTemplatesList(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("NetboxJSONDcimInterfaceTemplatesList") + d.Set("json", string(j)) + d.SetId("NetboxJSONDcimInterfaceTemplatesList") - return nil + return nil } diff --git a/netbox/data_netbox_json_dcim_interfaces_list.go b/netbox/data_netbox_json_dcim_interfaces_list.go index 7066770f3..14cb1f4b2 100644 --- a/netbox/data_netbox_json_dcim_interfaces_list.go +++ b/netbox/data_netbox_json_dcim_interfaces_list.go @@ -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/dcim" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/dcim" ) func dataNetboxJSONDcimInterfacesList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONDcimInterfacesListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONDcimInterfacesListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONDcimInterfacesListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := dcim.NewDcimInterfacesListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := dcim.NewDcimInterfacesListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Dcim.DcimInterfacesList(params, nil) - if err != nil { - return err - } + list, err := client.Dcim.DcimInterfacesList(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("NetboxJSONDcimInterfacesList") + d.Set("json", string(j)) + d.SetId("NetboxJSONDcimInterfacesList") - return nil + return nil } diff --git a/netbox/data_netbox_json_dcim_inventory_items_list.go b/netbox/data_netbox_json_dcim_inventory_items_list.go index a33e3b572..674ca0a58 100644 --- a/netbox/data_netbox_json_dcim_inventory_items_list.go +++ b/netbox/data_netbox_json_dcim_inventory_items_list.go @@ -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/dcim" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/dcim" ) func dataNetboxJSONDcimInventoryItemsList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONDcimInventoryItemsListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONDcimInventoryItemsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONDcimInventoryItemsListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := dcim.NewDcimInventoryItemsListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := dcim.NewDcimInventoryItemsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Dcim.DcimInventoryItemsList(params, nil) - if err != nil { - return err - } + list, err := client.Dcim.DcimInventoryItemsList(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("NetboxJSONDcimInventoryItemsList") + d.Set("json", string(j)) + d.SetId("NetboxJSONDcimInventoryItemsList") - return nil + return nil } diff --git a/netbox/data_netbox_json_dcim_locations_list.go b/netbox/data_netbox_json_dcim_locations_list.go index a56552502..93ae28b35 100644 --- a/netbox/data_netbox_json_dcim_locations_list.go +++ b/netbox/data_netbox_json_dcim_locations_list.go @@ -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/dcim" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/dcim" ) func dataNetboxJSONDcimLocationsList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONDcimLocationsListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONDcimLocationsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONDcimLocationsListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := dcim.NewDcimLocationsListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := dcim.NewDcimLocationsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Dcim.DcimLocationsList(params, nil) - if err != nil { - return err - } + list, err := client.Dcim.DcimLocationsList(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("NetboxJSONDcimLocationsList") + d.Set("json", string(j)) + d.SetId("NetboxJSONDcimLocationsList") - return nil + return nil } diff --git a/netbox/data_netbox_json_dcim_manufacturers_list.go b/netbox/data_netbox_json_dcim_manufacturers_list.go index eb218b777..bb41fd271 100644 --- a/netbox/data_netbox_json_dcim_manufacturers_list.go +++ b/netbox/data_netbox_json_dcim_manufacturers_list.go @@ -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/dcim" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/dcim" ) func dataNetboxJSONDcimManufacturersList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONDcimManufacturersListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONDcimManufacturersListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONDcimManufacturersListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := dcim.NewDcimManufacturersListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := dcim.NewDcimManufacturersListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Dcim.DcimManufacturersList(params, nil) - if err != nil { - return err - } + list, err := client.Dcim.DcimManufacturersList(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("NetboxJSONDcimManufacturersList") + d.Set("json", string(j)) + d.SetId("NetboxJSONDcimManufacturersList") - return nil + return nil } diff --git a/netbox/data_netbox_json_dcim_platforms_list.go b/netbox/data_netbox_json_dcim_platforms_list.go index efb2ad7bd..68dcb9315 100644 --- a/netbox/data_netbox_json_dcim_platforms_list.go +++ b/netbox/data_netbox_json_dcim_platforms_list.go @@ -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/dcim" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/dcim" ) func dataNetboxJSONDcimPlatformsList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONDcimPlatformsListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONDcimPlatformsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONDcimPlatformsListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := dcim.NewDcimPlatformsListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := dcim.NewDcimPlatformsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Dcim.DcimPlatformsList(params, nil) - if err != nil { - return err - } + list, err := client.Dcim.DcimPlatformsList(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("NetboxJSONDcimPlatformsList") + d.Set("json", string(j)) + d.SetId("NetboxJSONDcimPlatformsList") - return nil + return nil } diff --git a/netbox/data_netbox_json_dcim_power_feeds_list.go b/netbox/data_netbox_json_dcim_power_feeds_list.go index 68ac60861..97d789e28 100644 --- a/netbox/data_netbox_json_dcim_power_feeds_list.go +++ b/netbox/data_netbox_json_dcim_power_feeds_list.go @@ -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/dcim" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/dcim" ) func dataNetboxJSONDcimPowerFeedsList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONDcimPowerFeedsListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONDcimPowerFeedsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONDcimPowerFeedsListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := dcim.NewDcimPowerFeedsListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := dcim.NewDcimPowerFeedsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Dcim.DcimPowerFeedsList(params, nil) - if err != nil { - return err - } + list, err := client.Dcim.DcimPowerFeedsList(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("NetboxJSONDcimPowerFeedsList") + d.Set("json", string(j)) + d.SetId("NetboxJSONDcimPowerFeedsList") - return nil + return nil } diff --git a/netbox/data_netbox_json_dcim_power_outlet_templates_list.go b/netbox/data_netbox_json_dcim_power_outlet_templates_list.go index 64b05cc97..9e4288ed0 100644 --- a/netbox/data_netbox_json_dcim_power_outlet_templates_list.go +++ b/netbox/data_netbox_json_dcim_power_outlet_templates_list.go @@ -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/dcim" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/dcim" ) func dataNetboxJSONDcimPowerOutletTemplatesList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONDcimPowerOutletTemplatesListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONDcimPowerOutletTemplatesListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONDcimPowerOutletTemplatesListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := dcim.NewDcimPowerOutletTemplatesListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := dcim.NewDcimPowerOutletTemplatesListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Dcim.DcimPowerOutletTemplatesList(params, nil) - if err != nil { - return err - } + list, err := client.Dcim.DcimPowerOutletTemplatesList(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("NetboxJSONDcimPowerOutletTemplatesList") + d.Set("json", string(j)) + d.SetId("NetboxJSONDcimPowerOutletTemplatesList") - return nil + return nil } diff --git a/netbox/data_netbox_json_dcim_power_outlets_list.go b/netbox/data_netbox_json_dcim_power_outlets_list.go index 4dd6eff15..84b6ae523 100644 --- a/netbox/data_netbox_json_dcim_power_outlets_list.go +++ b/netbox/data_netbox_json_dcim_power_outlets_list.go @@ -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/dcim" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/dcim" ) func dataNetboxJSONDcimPowerOutletsList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONDcimPowerOutletsListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONDcimPowerOutletsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONDcimPowerOutletsListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := dcim.NewDcimPowerOutletsListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := dcim.NewDcimPowerOutletsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Dcim.DcimPowerOutletsList(params, nil) - if err != nil { - return err - } + list, err := client.Dcim.DcimPowerOutletsList(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("NetboxJSONDcimPowerOutletsList") + d.Set("json", string(j)) + d.SetId("NetboxJSONDcimPowerOutletsList") - return nil + return nil } diff --git a/netbox/data_netbox_json_dcim_power_panels_list.go b/netbox/data_netbox_json_dcim_power_panels_list.go index 31b2d3dc4..df82cf766 100644 --- a/netbox/data_netbox_json_dcim_power_panels_list.go +++ b/netbox/data_netbox_json_dcim_power_panels_list.go @@ -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/dcim" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/dcim" ) func dataNetboxJSONDcimPowerPanelsList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONDcimPowerPanelsListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONDcimPowerPanelsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONDcimPowerPanelsListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := dcim.NewDcimPowerPanelsListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := dcim.NewDcimPowerPanelsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Dcim.DcimPowerPanelsList(params, nil) - if err != nil { - return err - } + list, err := client.Dcim.DcimPowerPanelsList(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("NetboxJSONDcimPowerPanelsList") + d.Set("json", string(j)) + d.SetId("NetboxJSONDcimPowerPanelsList") - return nil + return nil } diff --git a/netbox/data_netbox_json_dcim_power_port_templates_list.go b/netbox/data_netbox_json_dcim_power_port_templates_list.go index 2f2dd66de..214f4d0af 100644 --- a/netbox/data_netbox_json_dcim_power_port_templates_list.go +++ b/netbox/data_netbox_json_dcim_power_port_templates_list.go @@ -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/dcim" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/dcim" ) func dataNetboxJSONDcimPowerPortTemplatesList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONDcimPowerPortTemplatesListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONDcimPowerPortTemplatesListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONDcimPowerPortTemplatesListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := dcim.NewDcimPowerPortTemplatesListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := dcim.NewDcimPowerPortTemplatesListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Dcim.DcimPowerPortTemplatesList(params, nil) - if err != nil { - return err - } + list, err := client.Dcim.DcimPowerPortTemplatesList(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("NetboxJSONDcimPowerPortTemplatesList") + d.Set("json", string(j)) + d.SetId("NetboxJSONDcimPowerPortTemplatesList") - return nil + return nil } diff --git a/netbox/data_netbox_json_dcim_power_ports_list.go b/netbox/data_netbox_json_dcim_power_ports_list.go index 42c871181..4d1cc9a02 100644 --- a/netbox/data_netbox_json_dcim_power_ports_list.go +++ b/netbox/data_netbox_json_dcim_power_ports_list.go @@ -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/dcim" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/dcim" ) func dataNetboxJSONDcimPowerPortsList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONDcimPowerPortsListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONDcimPowerPortsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONDcimPowerPortsListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := dcim.NewDcimPowerPortsListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := dcim.NewDcimPowerPortsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Dcim.DcimPowerPortsList(params, nil) - if err != nil { - return err - } + list, err := client.Dcim.DcimPowerPortsList(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("NetboxJSONDcimPowerPortsList") + d.Set("json", string(j)) + d.SetId("NetboxJSONDcimPowerPortsList") - return nil + return nil } diff --git a/netbox/data_netbox_json_dcim_rack_reservations_list.go b/netbox/data_netbox_json_dcim_rack_reservations_list.go index b247f20cc..101c7c725 100644 --- a/netbox/data_netbox_json_dcim_rack_reservations_list.go +++ b/netbox/data_netbox_json_dcim_rack_reservations_list.go @@ -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/dcim" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/dcim" ) func dataNetboxJSONDcimRackReservationsList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONDcimRackReservationsListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONDcimRackReservationsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONDcimRackReservationsListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := dcim.NewDcimRackReservationsListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := dcim.NewDcimRackReservationsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Dcim.DcimRackReservationsList(params, nil) - if err != nil { - return err - } + list, err := client.Dcim.DcimRackReservationsList(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("NetboxJSONDcimRackReservationsList") + d.Set("json", string(j)) + d.SetId("NetboxJSONDcimRackReservationsList") - return nil + return nil } diff --git a/netbox/data_netbox_json_dcim_rack_roles_list.go b/netbox/data_netbox_json_dcim_rack_roles_list.go index 3f65146ec..c1799d7c6 100644 --- a/netbox/data_netbox_json_dcim_rack_roles_list.go +++ b/netbox/data_netbox_json_dcim_rack_roles_list.go @@ -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/dcim" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/dcim" ) func dataNetboxJSONDcimRackRolesList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONDcimRackRolesListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONDcimRackRolesListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONDcimRackRolesListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := dcim.NewDcimRackRolesListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := dcim.NewDcimRackRolesListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Dcim.DcimRackRolesList(params, nil) - if err != nil { - return err - } + list, err := client.Dcim.DcimRackRolesList(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("NetboxJSONDcimRackRolesList") + d.Set("json", string(j)) + d.SetId("NetboxJSONDcimRackRolesList") - return nil + return nil } diff --git a/netbox/data_netbox_json_dcim_racks_list.go b/netbox/data_netbox_json_dcim_racks_list.go index eb3fd3896..acc8b928a 100644 --- a/netbox/data_netbox_json_dcim_racks_list.go +++ b/netbox/data_netbox_json_dcim_racks_list.go @@ -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/dcim" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/dcim" ) func dataNetboxJSONDcimRacksList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONDcimRacksListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONDcimRacksListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONDcimRacksListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := dcim.NewDcimRacksListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := dcim.NewDcimRacksListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Dcim.DcimRacksList(params, nil) - if err != nil { - return err - } + list, err := client.Dcim.DcimRacksList(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("NetboxJSONDcimRacksList") + d.Set("json", string(j)) + d.SetId("NetboxJSONDcimRacksList") - return nil + return nil } diff --git a/netbox/data_netbox_json_dcim_rear_port_templates_list.go b/netbox/data_netbox_json_dcim_rear_port_templates_list.go index 3d393b742..556be853e 100644 --- a/netbox/data_netbox_json_dcim_rear_port_templates_list.go +++ b/netbox/data_netbox_json_dcim_rear_port_templates_list.go @@ -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/dcim" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/dcim" ) func dataNetboxJSONDcimRearPortTemplatesList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONDcimRearPortTemplatesListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONDcimRearPortTemplatesListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONDcimRearPortTemplatesListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := dcim.NewDcimRearPortTemplatesListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := dcim.NewDcimRearPortTemplatesListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Dcim.DcimRearPortTemplatesList(params, nil) - if err != nil { - return err - } + list, err := client.Dcim.DcimRearPortTemplatesList(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("NetboxJSONDcimRearPortTemplatesList") + d.Set("json", string(j)) + d.SetId("NetboxJSONDcimRearPortTemplatesList") - return nil + return nil } diff --git a/netbox/data_netbox_json_dcim_rear_ports_list.go b/netbox/data_netbox_json_dcim_rear_ports_list.go index a28943b0e..f6f07172c 100644 --- a/netbox/data_netbox_json_dcim_rear_ports_list.go +++ b/netbox/data_netbox_json_dcim_rear_ports_list.go @@ -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/dcim" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/dcim" ) func dataNetboxJSONDcimRearPortsList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONDcimRearPortsListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONDcimRearPortsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONDcimRearPortsListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := dcim.NewDcimRearPortsListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := dcim.NewDcimRearPortsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Dcim.DcimRearPortsList(params, nil) - if err != nil { - return err - } + list, err := client.Dcim.DcimRearPortsList(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("NetboxJSONDcimRearPortsList") + d.Set("json", string(j)) + d.SetId("NetboxJSONDcimRearPortsList") - return nil + return nil } diff --git a/netbox/data_netbox_json_dcim_regions_list.go b/netbox/data_netbox_json_dcim_regions_list.go index 99082f898..9325f293b 100644 --- a/netbox/data_netbox_json_dcim_regions_list.go +++ b/netbox/data_netbox_json_dcim_regions_list.go @@ -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/dcim" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/dcim" ) func dataNetboxJSONDcimRegionsList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONDcimRegionsListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONDcimRegionsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONDcimRegionsListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := dcim.NewDcimRegionsListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := dcim.NewDcimRegionsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Dcim.DcimRegionsList(params, nil) - if err != nil { - return err - } + list, err := client.Dcim.DcimRegionsList(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("NetboxJSONDcimRegionsList") + d.Set("json", string(j)) + d.SetId("NetboxJSONDcimRegionsList") - return nil + return nil } diff --git a/netbox/data_netbox_json_dcim_site_groups_list.go b/netbox/data_netbox_json_dcim_site_groups_list.go index 795d1e12a..ef7243ded 100644 --- a/netbox/data_netbox_json_dcim_site_groups_list.go +++ b/netbox/data_netbox_json_dcim_site_groups_list.go @@ -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/dcim" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/dcim" ) func dataNetboxJSONDcimSiteGroupsList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONDcimSiteGroupsListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONDcimSiteGroupsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONDcimSiteGroupsListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := dcim.NewDcimSiteGroupsListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := dcim.NewDcimSiteGroupsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Dcim.DcimSiteGroupsList(params, nil) - if err != nil { - return err - } + list, err := client.Dcim.DcimSiteGroupsList(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("NetboxJSONDcimSiteGroupsList") + d.Set("json", string(j)) + d.SetId("NetboxJSONDcimSiteGroupsList") - return nil + return nil } diff --git a/netbox/data_netbox_json_dcim_sites_list.go b/netbox/data_netbox_json_dcim_sites_list.go index 7ca3d82d4..ea8ede985 100644 --- a/netbox/data_netbox_json_dcim_sites_list.go +++ b/netbox/data_netbox_json_dcim_sites_list.go @@ -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/dcim" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/dcim" ) func dataNetboxJSONDcimSitesList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONDcimSitesListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONDcimSitesListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONDcimSitesListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := dcim.NewDcimSitesListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := dcim.NewDcimSitesListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Dcim.DcimSitesList(params, nil) - if err != nil { - return err - } + list, err := client.Dcim.DcimSitesList(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("NetboxJSONDcimSitesList") + d.Set("json", string(j)) + d.SetId("NetboxJSONDcimSitesList") - return nil + return nil } diff --git a/netbox/data_netbox_json_dcim_virtual_chassis_list.go b/netbox/data_netbox_json_dcim_virtual_chassis_list.go index 62f9fd567..efbb43cfe 100644 --- a/netbox/data_netbox_json_dcim_virtual_chassis_list.go +++ b/netbox/data_netbox_json_dcim_virtual_chassis_list.go @@ -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/dcim" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/dcim" ) func dataNetboxJSONDcimVirtualChassisList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONDcimVirtualChassisListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONDcimVirtualChassisListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONDcimVirtualChassisListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := dcim.NewDcimVirtualChassisListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := dcim.NewDcimVirtualChassisListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Dcim.DcimVirtualChassisList(params, nil) - if err != nil { - return err - } + list, err := client.Dcim.DcimVirtualChassisList(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("NetboxJSONDcimVirtualChassisList") + d.Set("json", string(j)) + d.SetId("NetboxJSONDcimVirtualChassisList") - return nil + return nil } diff --git a/netbox/data_netbox_json_extras_config_contexts_list.go b/netbox/data_netbox_json_extras_config_contexts_list.go index 529b6a50e..f9ba9dea6 100644 --- a/netbox/data_netbox_json_extras_config_contexts_list.go +++ b/netbox/data_netbox_json_extras_config_contexts_list.go @@ -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/extras" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/extras" ) func dataNetboxJSONExtrasConfigContextsList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONExtrasConfigContextsListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONExtrasConfigContextsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONExtrasConfigContextsListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := extras.NewExtrasConfigContextsListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := extras.NewExtrasConfigContextsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Extras.ExtrasConfigContextsList(params, nil) - if err != nil { - return err - } + list, err := client.Extras.ExtrasConfigContextsList(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("NetboxJSONExtrasConfigContextsList") + d.Set("json", string(j)) + d.SetId("NetboxJSONExtrasConfigContextsList") - return nil + return nil } diff --git a/netbox/data_netbox_json_extras_content_types_list.go b/netbox/data_netbox_json_extras_content_types_list.go index 231fa2a84..15c239125 100644 --- a/netbox/data_netbox_json_extras_content_types_list.go +++ b/netbox/data_netbox_json_extras_content_types_list.go @@ -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/extras" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/extras" ) func dataNetboxJSONExtrasContentTypesList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONExtrasContentTypesListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONExtrasContentTypesListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONExtrasContentTypesListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := extras.NewExtrasContentTypesListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := extras.NewExtrasContentTypesListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Extras.ExtrasContentTypesList(params, nil) - if err != nil { - return err - } + list, err := client.Extras.ExtrasContentTypesList(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("NetboxJSONExtrasContentTypesList") + d.Set("json", string(j)) + d.SetId("NetboxJSONExtrasContentTypesList") - return nil + return nil } diff --git a/netbox/data_netbox_json_extras_custom_fields_list.go b/netbox/data_netbox_json_extras_custom_fields_list.go index d4ebdf054..0d63c50ef 100644 --- a/netbox/data_netbox_json_extras_custom_fields_list.go +++ b/netbox/data_netbox_json_extras_custom_fields_list.go @@ -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/extras" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/extras" ) func dataNetboxJSONExtrasCustomFieldsList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONExtrasCustomFieldsListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONExtrasCustomFieldsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONExtrasCustomFieldsListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := extras.NewExtrasCustomFieldsListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := extras.NewExtrasCustomFieldsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Extras.ExtrasCustomFieldsList(params, nil) - if err != nil { - return err - } + list, err := client.Extras.ExtrasCustomFieldsList(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("NetboxJSONExtrasCustomFieldsList") + d.Set("json", string(j)) + d.SetId("NetboxJSONExtrasCustomFieldsList") - return nil + return nil } diff --git a/netbox/data_netbox_json_extras_custom_links_list.go b/netbox/data_netbox_json_extras_custom_links_list.go index ba22bbfc0..e42df582d 100644 --- a/netbox/data_netbox_json_extras_custom_links_list.go +++ b/netbox/data_netbox_json_extras_custom_links_list.go @@ -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/extras" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/extras" ) func dataNetboxJSONExtrasCustomLinksList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONExtrasCustomLinksListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONExtrasCustomLinksListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONExtrasCustomLinksListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := extras.NewExtrasCustomLinksListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := extras.NewExtrasCustomLinksListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Extras.ExtrasCustomLinksList(params, nil) - if err != nil { - return err - } + list, err := client.Extras.ExtrasCustomLinksList(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("NetboxJSONExtrasCustomLinksList") + d.Set("json", string(j)) + d.SetId("NetboxJSONExtrasCustomLinksList") - return nil + return nil } diff --git a/netbox/data_netbox_json_extras_export_templates_list.go b/netbox/data_netbox_json_extras_export_templates_list.go index 059809137..ebc57f64c 100644 --- a/netbox/data_netbox_json_extras_export_templates_list.go +++ b/netbox/data_netbox_json_extras_export_templates_list.go @@ -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/extras" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/extras" ) func dataNetboxJSONExtrasExportTemplatesList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONExtrasExportTemplatesListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONExtrasExportTemplatesListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONExtrasExportTemplatesListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := extras.NewExtrasExportTemplatesListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := extras.NewExtrasExportTemplatesListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Extras.ExtrasExportTemplatesList(params, nil) - if err != nil { - return err - } + list, err := client.Extras.ExtrasExportTemplatesList(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("NetboxJSONExtrasExportTemplatesList") + d.Set("json", string(j)) + d.SetId("NetboxJSONExtrasExportTemplatesList") - return nil + return nil } diff --git a/netbox/data_netbox_json_extras_image_attachments_list.go b/netbox/data_netbox_json_extras_image_attachments_list.go index 2d495e771..c2ac68133 100644 --- a/netbox/data_netbox_json_extras_image_attachments_list.go +++ b/netbox/data_netbox_json_extras_image_attachments_list.go @@ -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/extras" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/extras" ) func dataNetboxJSONExtrasImageAttachmentsList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONExtrasImageAttachmentsListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONExtrasImageAttachmentsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONExtrasImageAttachmentsListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := extras.NewExtrasImageAttachmentsListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := extras.NewExtrasImageAttachmentsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Extras.ExtrasImageAttachmentsList(params, nil) - if err != nil { - return err - } + list, err := client.Extras.ExtrasImageAttachmentsList(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("NetboxJSONExtrasImageAttachmentsList") + d.Set("json", string(j)) + d.SetId("NetboxJSONExtrasImageAttachmentsList") - return nil + return nil } diff --git a/netbox/data_netbox_json_extras_job_results_list.go b/netbox/data_netbox_json_extras_job_results_list.go index 5b2df246a..3b506e5c1 100644 --- a/netbox/data_netbox_json_extras_job_results_list.go +++ b/netbox/data_netbox_json_extras_job_results_list.go @@ -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/extras" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/extras" ) func dataNetboxJSONExtrasJobResultsList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONExtrasJobResultsListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONExtrasJobResultsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONExtrasJobResultsListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := extras.NewExtrasJobResultsListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := extras.NewExtrasJobResultsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Extras.ExtrasJobResultsList(params, nil) - if err != nil { - return err - } + list, err := client.Extras.ExtrasJobResultsList(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("NetboxJSONExtrasJobResultsList") + d.Set("json", string(j)) + d.SetId("NetboxJSONExtrasJobResultsList") - return nil + return nil } diff --git a/netbox/data_netbox_json_extras_journal_entries_list.go b/netbox/data_netbox_json_extras_journal_entries_list.go index f60533857..b363d3df9 100644 --- a/netbox/data_netbox_json_extras_journal_entries_list.go +++ b/netbox/data_netbox_json_extras_journal_entries_list.go @@ -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/extras" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/extras" ) func dataNetboxJSONExtrasJournalEntriesList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONExtrasJournalEntriesListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONExtrasJournalEntriesListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONExtrasJournalEntriesListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := extras.NewExtrasJournalEntriesListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := extras.NewExtrasJournalEntriesListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Extras.ExtrasJournalEntriesList(params, nil) - if err != nil { - return err - } + list, err := client.Extras.ExtrasJournalEntriesList(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("NetboxJSONExtrasJournalEntriesList") + d.Set("json", string(j)) + d.SetId("NetboxJSONExtrasJournalEntriesList") - return nil + return nil } diff --git a/netbox/data_netbox_json_extras_object_changes_list.go b/netbox/data_netbox_json_extras_object_changes_list.go index bc2896e78..0c3b7b6a6 100644 --- a/netbox/data_netbox_json_extras_object_changes_list.go +++ b/netbox/data_netbox_json_extras_object_changes_list.go @@ -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/extras" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/extras" ) func dataNetboxJSONExtrasObjectChangesList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONExtrasObjectChangesListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONExtrasObjectChangesListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONExtrasObjectChangesListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := extras.NewExtrasObjectChangesListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := extras.NewExtrasObjectChangesListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Extras.ExtrasObjectChangesList(params, nil) - if err != nil { - return err - } + list, err := client.Extras.ExtrasObjectChangesList(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("NetboxJSONExtrasObjectChangesList") + d.Set("json", string(j)) + d.SetId("NetboxJSONExtrasObjectChangesList") - return nil + return nil } diff --git a/netbox/data_netbox_json_extras_tags_list.go b/netbox/data_netbox_json_extras_tags_list.go index b9622c86b..397a497f9 100644 --- a/netbox/data_netbox_json_extras_tags_list.go +++ b/netbox/data_netbox_json_extras_tags_list.go @@ -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/extras" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/extras" ) func dataNetboxJSONExtrasTagsList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONExtrasTagsListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONExtrasTagsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONExtrasTagsListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := extras.NewExtrasTagsListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := extras.NewExtrasTagsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Extras.ExtrasTagsList(params, nil) - if err != nil { - return err - } + list, err := client.Extras.ExtrasTagsList(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("NetboxJSONExtrasTagsList") + d.Set("json", string(j)) + d.SetId("NetboxJSONExtrasTagsList") - return nil + return nil } diff --git a/netbox/data_netbox_json_extras_webhooks_list.go b/netbox/data_netbox_json_extras_webhooks_list.go index 548f4db53..73655713f 100644 --- a/netbox/data_netbox_json_extras_webhooks_list.go +++ b/netbox/data_netbox_json_extras_webhooks_list.go @@ -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/extras" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/extras" ) func dataNetboxJSONExtrasWebhooksList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONExtrasWebhooksListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONExtrasWebhooksListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONExtrasWebhooksListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := extras.NewExtrasWebhooksListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := extras.NewExtrasWebhooksListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Extras.ExtrasWebhooksList(params, nil) - if err != nil { - return err - } + list, err := client.Extras.ExtrasWebhooksList(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("NetboxJSONExtrasWebhooksList") + d.Set("json", string(j)) + d.SetId("NetboxJSONExtrasWebhooksList") - return nil + return nil } diff --git a/netbox/data_netbox_json_ipam_aggregates_list.go b/netbox/data_netbox_json_ipam_aggregates_list.go index cd4eee8bc..88984cf84 100644 --- a/netbox/data_netbox_json_ipam_aggregates_list.go +++ b/netbox/data_netbox_json_ipam_aggregates_list.go @@ -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/ipam" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/ipam" ) func dataNetboxJSONIpamAggregatesList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONIpamAggregatesListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONIpamAggregatesListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONIpamAggregatesListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := ipam.NewIpamAggregatesListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := ipam.NewIpamAggregatesListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Ipam.IpamAggregatesList(params, nil) - if err != nil { - return err - } + list, err := client.Ipam.IpamAggregatesList(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("NetboxJSONIpamAggregatesList") + d.Set("json", string(j)) + d.SetId("NetboxJSONIpamAggregatesList") - return nil + return nil } diff --git a/netbox/data_netbox_json_ipam_asns_list.go b/netbox/data_netbox_json_ipam_asns_list.go new file mode 100644 index 000000000..efe567ee6 --- /dev/null +++ b/netbox/data_netbox_json_ipam_asns_list.go @@ -0,0 +1,47 @@ +package netbox + +import ( + "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/ipam" +) + +func dataNetboxJSONIpamAsnsList() *schema.Resource { + return &schema.Resource{ + Read: dataNetboxJSONIpamAsnsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func dataNetboxJSONIpamAsnsListRead(d *schema.ResourceData, m interface{}) error { + client := m.(*netboxclient.NetBoxAPI) + + params := ipam.NewIpamAsnsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit + + list, err := client.Ipam.IpamAsnsList(params, nil) + if err != nil { + return err + } + + j, _ := json.Marshal(list.Payload.Results) + + d.Set("json", string(j)) + d.SetId("NetboxJSONIpamAsnsList") + + return nil +} diff --git a/netbox/data_netbox_json_ipam_fhrp_group_assignments_list.go b/netbox/data_netbox_json_ipam_fhrp_group_assignments_list.go new file mode 100644 index 000000000..461075523 --- /dev/null +++ b/netbox/data_netbox_json_ipam_fhrp_group_assignments_list.go @@ -0,0 +1,47 @@ +package netbox + +import ( + "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/ipam" +) + +func dataNetboxJSONIpamFhrpGroupAssignmentsList() *schema.Resource { + return &schema.Resource{ + Read: dataNetboxJSONIpamFhrpGroupAssignmentsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func dataNetboxJSONIpamFhrpGroupAssignmentsListRead(d *schema.ResourceData, m interface{}) error { + client := m.(*netboxclient.NetBoxAPI) + + params := ipam.NewIpamFhrpGroupAssignmentsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit + + list, err := client.Ipam.IpamFhrpGroupAssignmentsList(params, nil) + if err != nil { + return err + } + + j, _ := json.Marshal(list.Payload.Results) + + d.Set("json", string(j)) + d.SetId("NetboxJSONIpamFhrpGroupAssignmentsList") + + return nil +} diff --git a/netbox/data_netbox_json_ipam_fhrp_groups_list.go b/netbox/data_netbox_json_ipam_fhrp_groups_list.go new file mode 100644 index 000000000..82f0c49a9 --- /dev/null +++ b/netbox/data_netbox_json_ipam_fhrp_groups_list.go @@ -0,0 +1,47 @@ +package netbox + +import ( + "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/ipam" +) + +func dataNetboxJSONIpamFhrpGroupsList() *schema.Resource { + return &schema.Resource{ + Read: dataNetboxJSONIpamFhrpGroupsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func dataNetboxJSONIpamFhrpGroupsListRead(d *schema.ResourceData, m interface{}) error { + client := m.(*netboxclient.NetBoxAPI) + + params := ipam.NewIpamFhrpGroupsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit + + list, err := client.Ipam.IpamFhrpGroupsList(params, nil) + if err != nil { + return err + } + + j, _ := json.Marshal(list.Payload.Results) + + d.Set("json", string(j)) + d.SetId("NetboxJSONIpamFhrpGroupsList") + + return nil +} diff --git a/netbox/data_netbox_json_ipam_ip_addresses_list.go b/netbox/data_netbox_json_ipam_ip_addresses_list.go index b5fd42cde..bdfe4f713 100644 --- a/netbox/data_netbox_json_ipam_ip_addresses_list.go +++ b/netbox/data_netbox_json_ipam_ip_addresses_list.go @@ -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/ipam" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/ipam" ) func dataNetboxJSONIpamIPAddressesList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONIpamIPAddressesListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONIpamIPAddressesListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONIpamIPAddressesListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := ipam.NewIpamIPAddressesListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := ipam.NewIpamIPAddressesListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Ipam.IpamIPAddressesList(params, nil) - if err != nil { - return err - } + list, err := client.Ipam.IpamIPAddressesList(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("NetboxJSONIpamIPAddressesList") + d.Set("json", string(j)) + d.SetId("NetboxJSONIpamIPAddressesList") - return nil + return nil } diff --git a/netbox/data_netbox_json_ipam_ip_ranges_list.go b/netbox/data_netbox_json_ipam_ip_ranges_list.go index feda16163..cda988dff 100644 --- a/netbox/data_netbox_json_ipam_ip_ranges_list.go +++ b/netbox/data_netbox_json_ipam_ip_ranges_list.go @@ -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/ipam" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/ipam" ) func dataNetboxJSONIpamIPRangesList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONIpamIPRangesListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONIpamIPRangesListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONIpamIPRangesListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := ipam.NewIpamIPRangesListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := ipam.NewIpamIPRangesListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Ipam.IpamIPRangesList(params, nil) - if err != nil { - return err - } + list, err := client.Ipam.IpamIPRangesList(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("NetboxJSONIpamIPRangesList") + d.Set("json", string(j)) + d.SetId("NetboxJSONIpamIPRangesList") - return nil + return nil } diff --git a/netbox/data_netbox_json_ipam_prefixes_list.go b/netbox/data_netbox_json_ipam_prefixes_list.go index ae1a32d37..bc67da67c 100644 --- a/netbox/data_netbox_json_ipam_prefixes_list.go +++ b/netbox/data_netbox_json_ipam_prefixes_list.go @@ -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/ipam" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/ipam" ) func dataNetboxJSONIpamPrefixesList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONIpamPrefixesListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONIpamPrefixesListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONIpamPrefixesListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := ipam.NewIpamPrefixesListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := ipam.NewIpamPrefixesListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Ipam.IpamPrefixesList(params, nil) - if err != nil { - return err - } + list, err := client.Ipam.IpamPrefixesList(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("NetboxJSONIpamPrefixesList") + d.Set("json", string(j)) + d.SetId("NetboxJSONIpamPrefixesList") - return nil + return nil } diff --git a/netbox/data_netbox_json_ipam_rirs_list.go b/netbox/data_netbox_json_ipam_rirs_list.go index 904c23256..265f5f51a 100644 --- a/netbox/data_netbox_json_ipam_rirs_list.go +++ b/netbox/data_netbox_json_ipam_rirs_list.go @@ -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/ipam" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/ipam" ) func dataNetboxJSONIpamRirsList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONIpamRirsListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONIpamRirsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONIpamRirsListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := ipam.NewIpamRirsListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := ipam.NewIpamRirsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Ipam.IpamRirsList(params, nil) - if err != nil { - return err - } + list, err := client.Ipam.IpamRirsList(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("NetboxJSONIpamRirsList") + d.Set("json", string(j)) + d.SetId("NetboxJSONIpamRirsList") - return nil + return nil } diff --git a/netbox/data_netbox_json_ipam_roles_list.go b/netbox/data_netbox_json_ipam_roles_list.go index 176f32e16..b9b569cd9 100644 --- a/netbox/data_netbox_json_ipam_roles_list.go +++ b/netbox/data_netbox_json_ipam_roles_list.go @@ -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/ipam" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/ipam" ) func dataNetboxJSONIpamRolesList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONIpamRolesListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONIpamRolesListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONIpamRolesListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := ipam.NewIpamRolesListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := ipam.NewIpamRolesListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Ipam.IpamRolesList(params, nil) - if err != nil { - return err - } + list, err := client.Ipam.IpamRolesList(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("NetboxJSONIpamRolesList") + d.Set("json", string(j)) + d.SetId("NetboxJSONIpamRolesList") - return nil + return nil } diff --git a/netbox/data_netbox_json_ipam_route_targets_list.go b/netbox/data_netbox_json_ipam_route_targets_list.go index ce3bf7627..01d221347 100644 --- a/netbox/data_netbox_json_ipam_route_targets_list.go +++ b/netbox/data_netbox_json_ipam_route_targets_list.go @@ -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/ipam" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/ipam" ) func dataNetboxJSONIpamRouteTargetsList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONIpamRouteTargetsListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONIpamRouteTargetsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONIpamRouteTargetsListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := ipam.NewIpamRouteTargetsListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := ipam.NewIpamRouteTargetsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Ipam.IpamRouteTargetsList(params, nil) - if err != nil { - return err - } + list, err := client.Ipam.IpamRouteTargetsList(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("NetboxJSONIpamRouteTargetsList") + d.Set("json", string(j)) + d.SetId("NetboxJSONIpamRouteTargetsList") - return nil + return nil } diff --git a/netbox/data_netbox_json_ipam_services_list.go b/netbox/data_netbox_json_ipam_services_list.go index a920b1741..6c2297faa 100644 --- a/netbox/data_netbox_json_ipam_services_list.go +++ b/netbox/data_netbox_json_ipam_services_list.go @@ -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/ipam" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/ipam" ) func dataNetboxJSONIpamServicesList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONIpamServicesListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONIpamServicesListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONIpamServicesListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := ipam.NewIpamServicesListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := ipam.NewIpamServicesListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Ipam.IpamServicesList(params, nil) - if err != nil { - return err - } + list, err := client.Ipam.IpamServicesList(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("NetboxJSONIpamServicesList") + d.Set("json", string(j)) + d.SetId("NetboxJSONIpamServicesList") - return nil + return nil } diff --git a/netbox/data_netbox_json_ipam_vlan_groups_list.go b/netbox/data_netbox_json_ipam_vlan_groups_list.go index 9ea2e7668..1df481ab6 100644 --- a/netbox/data_netbox_json_ipam_vlan_groups_list.go +++ b/netbox/data_netbox_json_ipam_vlan_groups_list.go @@ -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/ipam" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/ipam" ) func dataNetboxJSONIpamVlanGroupsList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONIpamVlanGroupsListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONIpamVlanGroupsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONIpamVlanGroupsListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := ipam.NewIpamVlanGroupsListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := ipam.NewIpamVlanGroupsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Ipam.IpamVlanGroupsList(params, nil) - if err != nil { - return err - } + list, err := client.Ipam.IpamVlanGroupsList(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("NetboxJSONIpamVlanGroupsList") + d.Set("json", string(j)) + d.SetId("NetboxJSONIpamVlanGroupsList") - return nil + return nil } diff --git a/netbox/data_netbox_json_ipam_vlans_list.go b/netbox/data_netbox_json_ipam_vlans_list.go index 390fb2691..97beb49e8 100644 --- a/netbox/data_netbox_json_ipam_vlans_list.go +++ b/netbox/data_netbox_json_ipam_vlans_list.go @@ -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/ipam" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/ipam" ) func dataNetboxJSONIpamVlansList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONIpamVlansListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONIpamVlansListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONIpamVlansListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := ipam.NewIpamVlansListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := ipam.NewIpamVlansListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Ipam.IpamVlansList(params, nil) - if err != nil { - return err - } + list, err := client.Ipam.IpamVlansList(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("NetboxJSONIpamVlansList") + d.Set("json", string(j)) + d.SetId("NetboxJSONIpamVlansList") - return nil + return nil } diff --git a/netbox/data_netbox_json_ipam_vrfs_list.go b/netbox/data_netbox_json_ipam_vrfs_list.go index 7d7b70d09..0f2615548 100644 --- a/netbox/data_netbox_json_ipam_vrfs_list.go +++ b/netbox/data_netbox_json_ipam_vrfs_list.go @@ -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/ipam" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/ipam" ) func dataNetboxJSONIpamVrfsList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONIpamVrfsListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONIpamVrfsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONIpamVrfsListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := ipam.NewIpamVrfsListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := ipam.NewIpamVrfsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Ipam.IpamVrfsList(params, nil) - if err != nil { - return err - } + list, err := client.Ipam.IpamVrfsList(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("NetboxJSONIpamVrfsList") + d.Set("json", string(j)) + d.SetId("NetboxJSONIpamVrfsList") - return nil + return nil } diff --git a/netbox/data_netbox_json_tenancy_contact_assignments_list.go b/netbox/data_netbox_json_tenancy_contact_assignments_list.go new file mode 100644 index 000000000..25262095b --- /dev/null +++ b/netbox/data_netbox_json_tenancy_contact_assignments_list.go @@ -0,0 +1,47 @@ +package netbox + +import ( + "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/tenancy" +) + +func dataNetboxJSONTenancyContactAssignmentsList() *schema.Resource { + return &schema.Resource{ + Read: dataNetboxJSONTenancyContactAssignmentsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func dataNetboxJSONTenancyContactAssignmentsListRead(d *schema.ResourceData, m interface{}) error { + client := m.(*netboxclient.NetBoxAPI) + + params := tenancy.NewTenancyContactAssignmentsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit + + list, err := client.Tenancy.TenancyContactAssignmentsList(params, nil) + if err != nil { + return err + } + + j, _ := json.Marshal(list.Payload.Results) + + d.Set("json", string(j)) + d.SetId("NetboxJSONTenancyContactAssignmentsList") + + return nil +} diff --git a/netbox/data_netbox_json_tenancy_contact_groups_list.go b/netbox/data_netbox_json_tenancy_contact_groups_list.go new file mode 100644 index 000000000..e510ef28c --- /dev/null +++ b/netbox/data_netbox_json_tenancy_contact_groups_list.go @@ -0,0 +1,47 @@ +package netbox + +import ( + "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/tenancy" +) + +func dataNetboxJSONTenancyContactGroupsList() *schema.Resource { + return &schema.Resource{ + Read: dataNetboxJSONTenancyContactGroupsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func dataNetboxJSONTenancyContactGroupsListRead(d *schema.ResourceData, m interface{}) error { + client := m.(*netboxclient.NetBoxAPI) + + params := tenancy.NewTenancyContactGroupsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit + + list, err := client.Tenancy.TenancyContactGroupsList(params, nil) + if err != nil { + return err + } + + j, _ := json.Marshal(list.Payload.Results) + + d.Set("json", string(j)) + d.SetId("NetboxJSONTenancyContactGroupsList") + + return nil +} diff --git a/netbox/data_netbox_json_tenancy_contact_roles_list.go b/netbox/data_netbox_json_tenancy_contact_roles_list.go new file mode 100644 index 000000000..3cf8d184d --- /dev/null +++ b/netbox/data_netbox_json_tenancy_contact_roles_list.go @@ -0,0 +1,47 @@ +package netbox + +import ( + "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/tenancy" +) + +func dataNetboxJSONTenancyContactRolesList() *schema.Resource { + return &schema.Resource{ + Read: dataNetboxJSONTenancyContactRolesListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func dataNetboxJSONTenancyContactRolesListRead(d *schema.ResourceData, m interface{}) error { + client := m.(*netboxclient.NetBoxAPI) + + params := tenancy.NewTenancyContactRolesListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit + + list, err := client.Tenancy.TenancyContactRolesList(params, nil) + if err != nil { + return err + } + + j, _ := json.Marshal(list.Payload.Results) + + d.Set("json", string(j)) + d.SetId("NetboxJSONTenancyContactRolesList") + + return nil +} diff --git a/netbox/data_netbox_json_tenancy_contacts_list.go b/netbox/data_netbox_json_tenancy_contacts_list.go new file mode 100644 index 000000000..2f2fb72b7 --- /dev/null +++ b/netbox/data_netbox_json_tenancy_contacts_list.go @@ -0,0 +1,47 @@ +package netbox + +import ( + "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/tenancy" +) + +func dataNetboxJSONTenancyContactsList() *schema.Resource { + return &schema.Resource{ + Read: dataNetboxJSONTenancyContactsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func dataNetboxJSONTenancyContactsListRead(d *schema.ResourceData, m interface{}) error { + client := m.(*netboxclient.NetBoxAPI) + + params := tenancy.NewTenancyContactsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit + + list, err := client.Tenancy.TenancyContactsList(params, nil) + if err != nil { + return err + } + + j, _ := json.Marshal(list.Payload.Results) + + d.Set("json", string(j)) + d.SetId("NetboxJSONTenancyContactsList") + + return nil +} diff --git a/netbox/data_netbox_json_tenancy_tenant_groups_list.go b/netbox/data_netbox_json_tenancy_tenant_groups_list.go index c5b7e8987..24365c2b1 100644 --- a/netbox/data_netbox_json_tenancy_tenant_groups_list.go +++ b/netbox/data_netbox_json_tenancy_tenant_groups_list.go @@ -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/tenancy" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/tenancy" ) func dataNetboxJSONTenancyTenantGroupsList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONTenancyTenantGroupsListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONTenancyTenantGroupsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONTenancyTenantGroupsListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := tenancy.NewTenancyTenantGroupsListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := tenancy.NewTenancyTenantGroupsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Tenancy.TenancyTenantGroupsList(params, nil) - if err != nil { - return err - } + list, err := client.Tenancy.TenancyTenantGroupsList(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("NetboxJSONTenancyTenantGroupsList") + d.Set("json", string(j)) + d.SetId("NetboxJSONTenancyTenantGroupsList") - return nil + return nil } diff --git a/netbox/data_netbox_json_tenancy_tenants_list.go b/netbox/data_netbox_json_tenancy_tenants_list.go index 1bd44c126..eb1efafeb 100644 --- a/netbox/data_netbox_json_tenancy_tenants_list.go +++ b/netbox/data_netbox_json_tenancy_tenants_list.go @@ -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/tenancy" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/tenancy" ) func dataNetboxJSONTenancyTenantsList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONTenancyTenantsListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONTenancyTenantsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONTenancyTenantsListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := tenancy.NewTenancyTenantsListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := tenancy.NewTenancyTenantsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Tenancy.TenancyTenantsList(params, nil) - if err != nil { - return err - } + list, err := client.Tenancy.TenancyTenantsList(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("NetboxJSONTenancyTenantsList") + d.Set("json", string(j)) + d.SetId("NetboxJSONTenancyTenantsList") - return nil + return nil } diff --git a/netbox/data_netbox_json_users_groups_list.go b/netbox/data_netbox_json_users_groups_list.go index 82be892c3..543a6baec 100644 --- a/netbox/data_netbox_json_users_groups_list.go +++ b/netbox/data_netbox_json_users_groups_list.go @@ -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/users" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/users" ) func dataNetboxJSONUsersGroupsList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONUsersGroupsListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONUsersGroupsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONUsersGroupsListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := users.NewUsersGroupsListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := users.NewUsersGroupsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Users.UsersGroupsList(params, nil) - if err != nil { - return err - } + list, err := client.Users.UsersGroupsList(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("NetboxJSONUsersGroupsList") + d.Set("json", string(j)) + d.SetId("NetboxJSONUsersGroupsList") - return nil + return nil } diff --git a/netbox/data_netbox_json_users_permissions_list.go b/netbox/data_netbox_json_users_permissions_list.go index 01f8dfa64..7e9909b9c 100644 --- a/netbox/data_netbox_json_users_permissions_list.go +++ b/netbox/data_netbox_json_users_permissions_list.go @@ -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/users" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/users" ) func dataNetboxJSONUsersPermissionsList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONUsersPermissionsListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONUsersPermissionsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONUsersPermissionsListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := users.NewUsersPermissionsListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := users.NewUsersPermissionsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Users.UsersPermissionsList(params, nil) - if err != nil { - return err - } + list, err := client.Users.UsersPermissionsList(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("NetboxJSONUsersPermissionsList") + d.Set("json", string(j)) + d.SetId("NetboxJSONUsersPermissionsList") - return nil + return nil } diff --git a/netbox/data_netbox_json_users_tokens_list.go b/netbox/data_netbox_json_users_tokens_list.go index c83b6aec6..abcc18b52 100644 --- a/netbox/data_netbox_json_users_tokens_list.go +++ b/netbox/data_netbox_json_users_tokens_list.go @@ -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/users" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/users" ) func dataNetboxJSONUsersTokensList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONUsersTokensListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONUsersTokensListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONUsersTokensListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := users.NewUsersTokensListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := users.NewUsersTokensListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Users.UsersTokensList(params, nil) - if err != nil { - return err - } + list, err := client.Users.UsersTokensList(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("NetboxJSONUsersTokensList") + d.Set("json", string(j)) + d.SetId("NetboxJSONUsersTokensList") - return nil + return nil } diff --git a/netbox/data_netbox_json_users_users_list.go b/netbox/data_netbox_json_users_users_list.go index 4ba4c1593..0a88362dc 100644 --- a/netbox/data_netbox_json_users_users_list.go +++ b/netbox/data_netbox_json_users_users_list.go @@ -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/users" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/users" ) func dataNetboxJSONUsersUsersList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONUsersUsersListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONUsersUsersListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONUsersUsersListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := users.NewUsersUsersListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := users.NewUsersUsersListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Users.UsersUsersList(params, nil) - if err != nil { - return err - } + list, err := client.Users.UsersUsersList(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("NetboxJSONUsersUsersList") + d.Set("json", string(j)) + d.SetId("NetboxJSONUsersUsersList") - return nil + return nil } diff --git a/netbox/data_netbox_json_virtualization_cluster_groups_list.go b/netbox/data_netbox_json_virtualization_cluster_groups_list.go index dd59336a9..8f75a4002 100644 --- a/netbox/data_netbox_json_virtualization_cluster_groups_list.go +++ b/netbox/data_netbox_json_virtualization_cluster_groups_list.go @@ -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/virtualization" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/virtualization" ) func dataNetboxJSONVirtualizationClusterGroupsList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONVirtualizationClusterGroupsListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONVirtualizationClusterGroupsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONVirtualizationClusterGroupsListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := virtualization.NewVirtualizationClusterGroupsListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := virtualization.NewVirtualizationClusterGroupsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Virtualization.VirtualizationClusterGroupsList(params, nil) - if err != nil { - return err - } + list, err := client.Virtualization.VirtualizationClusterGroupsList(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("NetboxJSONVirtualizationClusterGroupsList") + d.Set("json", string(j)) + d.SetId("NetboxJSONVirtualizationClusterGroupsList") - return nil + return nil } diff --git a/netbox/data_netbox_json_virtualization_cluster_types_list.go b/netbox/data_netbox_json_virtualization_cluster_types_list.go index 7304edcf6..3253c03dd 100644 --- a/netbox/data_netbox_json_virtualization_cluster_types_list.go +++ b/netbox/data_netbox_json_virtualization_cluster_types_list.go @@ -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/virtualization" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/virtualization" ) func dataNetboxJSONVirtualizationClusterTypesList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONVirtualizationClusterTypesListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONVirtualizationClusterTypesListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONVirtualizationClusterTypesListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := virtualization.NewVirtualizationClusterTypesListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := virtualization.NewVirtualizationClusterTypesListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Virtualization.VirtualizationClusterTypesList(params, nil) - if err != nil { - return err - } + list, err := client.Virtualization.VirtualizationClusterTypesList(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("NetboxJSONVirtualizationClusterTypesList") + d.Set("json", string(j)) + d.SetId("NetboxJSONVirtualizationClusterTypesList") - return nil + return nil } diff --git a/netbox/data_netbox_json_virtualization_clusters_list.go b/netbox/data_netbox_json_virtualization_clusters_list.go index ac044fe2b..2c4e1fac5 100644 --- a/netbox/data_netbox_json_virtualization_clusters_list.go +++ b/netbox/data_netbox_json_virtualization_clusters_list.go @@ -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/virtualization" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/virtualization" ) func dataNetboxJSONVirtualizationClustersList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONVirtualizationClustersListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONVirtualizationClustersListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONVirtualizationClustersListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := virtualization.NewVirtualizationClustersListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := virtualization.NewVirtualizationClustersListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Virtualization.VirtualizationClustersList(params, nil) - if err != nil { - return err - } + list, err := client.Virtualization.VirtualizationClustersList(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("NetboxJSONVirtualizationClustersList") + d.Set("json", string(j)) + d.SetId("NetboxJSONVirtualizationClustersList") - return nil + return nil } diff --git a/netbox/data_netbox_json_virtualization_interfaces_list.go b/netbox/data_netbox_json_virtualization_interfaces_list.go index 07aa5d61b..3672e9458 100644 --- a/netbox/data_netbox_json_virtualization_interfaces_list.go +++ b/netbox/data_netbox_json_virtualization_interfaces_list.go @@ -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/virtualization" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/virtualization" ) func dataNetboxJSONVirtualizationInterfacesList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONVirtualizationInterfacesListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONVirtualizationInterfacesListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONVirtualizationInterfacesListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := virtualization.NewVirtualizationInterfacesListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := virtualization.NewVirtualizationInterfacesListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Virtualization.VirtualizationInterfacesList(params, nil) - if err != nil { - return err - } + list, err := client.Virtualization.VirtualizationInterfacesList(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("NetboxJSONVirtualizationInterfacesList") + d.Set("json", string(j)) + d.SetId("NetboxJSONVirtualizationInterfacesList") - return nil + return nil } diff --git a/netbox/data_netbox_json_virtualization_virtual_machines_list.go b/netbox/data_netbox_json_virtualization_virtual_machines_list.go index 6c9626e60..6d8ac936e 100644 --- a/netbox/data_netbox_json_virtualization_virtual_machines_list.go +++ b/netbox/data_netbox_json_virtualization_virtual_machines_list.go @@ -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/virtualization" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + netboxclient "github.com/smutel/go-netbox/netbox/client" + "github.com/smutel/go-netbox/netbox/client/virtualization" ) func dataNetboxJSONVirtualizationVirtualMachinesList() *schema.Resource { - return &schema.Resource{ - Read: dataNetboxJSONVirtualizationVirtualMachinesListRead, - - Schema: map[string]*schema.Schema{ - "limit": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, - "json": { - Type: schema.TypeString, - Computed: true, - }, - }, - } + return &schema.Resource{ + Read: dataNetboxJSONVirtualizationVirtualMachinesListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } } func dataNetboxJSONVirtualizationVirtualMachinesListRead(d *schema.ResourceData, m interface{}) error { - client := m.(*netboxclient.NetBoxAPI) + client := m.(*netboxclient.NetBoxAPI) - params := virtualization.NewVirtualizationVirtualMachinesListParams() - limit := int64(d.Get("limit").(int)) - params.Limit = &limit + params := virtualization.NewVirtualizationVirtualMachinesListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit - list, err := client.Virtualization.VirtualizationVirtualMachinesList(params, nil) - if err != nil { - return err - } + list, err := client.Virtualization.VirtualizationVirtualMachinesList(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("NetboxJSONVirtualizationVirtualMachinesList") + d.Set("json", string(j)) + d.SetId("NetboxJSONVirtualizationVirtualMachinesList") - return nil + return nil } diff --git a/netbox/data_netbox_json_wireless_wireless_lan_groups_list.go b/netbox/data_netbox_json_wireless_wireless_lan_groups_list.go new file mode 100644 index 000000000..fda010f59 --- /dev/null +++ b/netbox/data_netbox_json_wireless_wireless_lan_groups_list.go @@ -0,0 +1,47 @@ +package netbox + +import ( + "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/wireless" +) + +func dataNetboxJSONWirelessWirelessLanGroupsList() *schema.Resource { + return &schema.Resource{ + Read: dataNetboxJSONWirelessWirelessLanGroupsListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func dataNetboxJSONWirelessWirelessLanGroupsListRead(d *schema.ResourceData, m interface{}) error { + client := m.(*netboxclient.NetBoxAPI) + + params := wireless.NewWirelessWirelessLanGroupsListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit + + list, err := client.Wireless.WirelessWirelessLanGroupsList(params, nil) + if err != nil { + return err + } + + j, _ := json.Marshal(list.Payload.Results) + + d.Set("json", string(j)) + d.SetId("NetboxJSONWirelessWirelessLanGroupsList") + + return nil +} diff --git a/netbox/data_netbox_json_wireless_wireless_lans_list.go b/netbox/data_netbox_json_wireless_wireless_lans_list.go new file mode 100644 index 000000000..6c8e4a721 --- /dev/null +++ b/netbox/data_netbox_json_wireless_wireless_lans_list.go @@ -0,0 +1,47 @@ +package netbox + +import ( + "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/wireless" +) + +func dataNetboxJSONWirelessWirelessLansList() *schema.Resource { + return &schema.Resource{ + Read: dataNetboxJSONWirelessWirelessLansListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func dataNetboxJSONWirelessWirelessLansListRead(d *schema.ResourceData, m interface{}) error { + client := m.(*netboxclient.NetBoxAPI) + + params := wireless.NewWirelessWirelessLansListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit + + list, err := client.Wireless.WirelessWirelessLansList(params, nil) + if err != nil { + return err + } + + j, _ := json.Marshal(list.Payload.Results) + + d.Set("json", string(j)) + d.SetId("NetboxJSONWirelessWirelessLansList") + + return nil +} diff --git a/netbox/data_netbox_json_wireless_wireless_links_list.go b/netbox/data_netbox_json_wireless_wireless_links_list.go new file mode 100644 index 000000000..ac0d3956d --- /dev/null +++ b/netbox/data_netbox_json_wireless_wireless_links_list.go @@ -0,0 +1,47 @@ +package netbox + +import ( + "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/wireless" +) + +func dataNetboxJSONWirelessWirelessLinksList() *schema.Resource { + return &schema.Resource{ + Read: dataNetboxJSONWirelessWirelessLinksListRead, + + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, + "json": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func dataNetboxJSONWirelessWirelessLinksListRead(d *schema.ResourceData, m interface{}) error { + client := m.(*netboxclient.NetBoxAPI) + + params := wireless.NewWirelessWirelessLinksListParams() + limit := int64(d.Get("limit").(int)) + params.Limit = &limit + + list, err := client.Wireless.WirelessWirelessLinksList(params, nil) + if err != nil { + return err + } + + j, _ := json.Marshal(list.Payload.Results) + + d.Set("json", string(j)) + d.SetId("NetboxJSONWirelessWirelessLinksList") + + return nil +} diff --git a/netbox/provider.go b/netbox/provider.go index 772771cf8..32aecb782 100644 --- a/netbox/provider.go +++ b/netbox/provider.go @@ -100,6 +100,9 @@ func Provider() *schema.Provider { "netbox_json_extras_tags_list": dataNetboxJSONExtrasTagsList(), "netbox_json_extras_webhooks_list": dataNetboxJSONExtrasWebhooksList(), "netbox_json_ipam_aggregates_list": dataNetboxJSONIpamAggregatesList(), + "netbox_json_ipam_asns_list": dataNetboxJSONIpamAsnsList(), + "netbox_json_ipam_fhrp_group_assignments_list": dataNetboxJSONIpamFhrpGroupAssignmentsList(), + "netbox_json_ipam_fhrp_groups_list": dataNetboxJSONIpamFhrpGroupsList(), "netbox_json_ipam_ip_addresses_list": dataNetboxJSONIpamIPAddressesList(), "netbox_json_ipam_ip_ranges_list": dataNetboxJSONIpamIPRangesList(), "netbox_json_ipam_prefixes_list": dataNetboxJSONIpamPrefixesList(), @@ -110,6 +113,10 @@ func Provider() *schema.Provider { "netbox_json_ipam_vlan_groups_list": dataNetboxJSONIpamVlanGroupsList(), "netbox_json_ipam_vlans_list": dataNetboxJSONIpamVlansList(), "netbox_json_ipam_vrfs_list": dataNetboxJSONIpamVrfsList(), + "netbox_json_tenancy_contact_assignments_list": dataNetboxJSONTenancyContactAssignmentsList(), + "netbox_json_tenancy_contact_groups_list": dataNetboxJSONTenancyContactGroupsList(), + "netbox_json_tenancy_contact_roles_list": dataNetboxJSONTenancyContactRolesList(), + "netbox_json_tenancy_contacts_list": dataNetboxJSONTenancyContactsList(), "netbox_json_tenancy_tenant_groups_list": dataNetboxJSONTenancyTenantGroupsList(), "netbox_json_tenancy_tenants_list": dataNetboxJSONTenancyTenantsList(), "netbox_json_users_groups_list": dataNetboxJSONUsersGroupsList(), @@ -121,6 +128,9 @@ func Provider() *schema.Provider { "netbox_json_virtualization_cluster_types_list": dataNetboxJSONVirtualizationClusterTypesList(), "netbox_json_virtualization_interfaces_list": dataNetboxJSONVirtualizationInterfacesList(), "netbox_json_virtualization_virtual_machines_list": dataNetboxJSONVirtualizationVirtualMachinesList(), + "netbox_json_wireless_wireless_lan_groups_list": dataNetboxJSONWirelessWirelessLanGroupsList(), + "netbox_json_wireless_wireless_lans_list": dataNetboxJSONWirelessWirelessLansList(), + "netbox_json_wireless_wireless_links_list": dataNetboxJSONWirelessWirelessLinksList(), "netbox_dcim_platform": dataNetboxDcimPlatform(), "netbox_dcim_site": dataNetboxDcimSite(), "netbox_ipam_aggregate": dataNetboxIpamAggregate(), diff --git a/utils/generateJsonDatasources b/utils/generateJsonDatasources index 18d94e90b..66b7d96f3 100755 --- a/utils/generateJsonDatasources +++ b/utils/generateJsonDatasources @@ -86,7 +86,7 @@ package netbox import ( "encoding/json" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" netboxclient "github.com/smutel/go-netbox/netbox/client" "github.com/smutel/go-netbox/netbox/client/${SECTION,}" )