Skip to content

Commit

Permalink
datasource for pbrs
Browse files Browse the repository at this point in the history
  • Loading branch information
abhimutant committed Dec 13, 2023
1 parent 25562e0 commit 4730df3
Show file tree
Hide file tree
Showing 12 changed files with 650 additions and 14 deletions.
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ require (
github.com/hashicorp/go-uuid v1.0.2
github.com/hashicorp/terraform-plugin-sdk/v2 v2.10.1
github.com/mitchellh/gox v1.0.1
github.com/nutanix-core/ntnx-api-golang-sdk-internal/networking-go-client/v16 v16.8.0-3635 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/nutanix/ntnx-api-golang-clients/networking-go-client/v4 v4.0.1-beta.1
github.com/spf13/cast v1.3.1
github.com/stretchr/testify v1.7.0
gopkg.in/yaml.v2 v2.4.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,8 @@ github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d/go.mod h1:o96d
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/nsf/jsondiff v0.0.0-20200515183724-f29ed568f4ce h1:RPclfga2SEJmgMmz2k+Mg7cowZ8yv4Trqw9UsJby758=
github.com/nsf/jsondiff v0.0.0-20200515183724-f29ed568f4ce/go.mod h1:uFMI8w+ref4v2r9jz+c9i1IfIttS/OkmLfrk1jne5hs=
github.com/nutanix-core/ntnx-api-golang-sdk-internal/networking-go-client/v16 v16.8.0-3635 h1:eVNonw1w8i0lVNNK4Ep/P8fAb2j6EEe+VNXAQXPLThc=
github.com/nutanix-core/ntnx-api-golang-sdk-internal/networking-go-client/v16 v16.8.0-3635/go.mod h1:vHyQVF3IKxmip+xGxXDQznKk1ffrVa4HSiEEueiekaE=
github.com/nutanix/ntnx-api-golang-clients/networking-go-client/v4 v4.0.1-beta.1 h1:EBTbuV4zFgv+MY7a5MYIELStXPMMds1aULHllA5xdFM=
github.com/nutanix/ntnx-api-golang-clients/networking-go-client/v4 v4.0.1-beta.1/go.mod h1:+eZgV1+xL/r84qmuFSVt5R8OFRO70rEz92jOnVgJNco=
github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw=
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
Expand Down
2 changes: 2 additions & 0 deletions nutanix/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ func Provider() *schema.Provider {
"nutanix_vpcs_v4": networking.DataSourceNutanixVPCsv4(),
"nutanix_floating_ip_v4": networking.DatasourceNutanixFloatingIPV4(),
"nutanix_floating_ips_v4": networking.DatasourceNutanixFloatingIPsV4(),
"nutanix_pbr_v4": networking.DatasourceNutanixPbrV4(),
"nutanix_pbrs_v4": networking.DatasourceNutanixPbrsV4(),
},
ResourcesMap: map[string]*schema.Resource{
"nutanix_virtual_machine": prism.ResourceNutanixVirtualMachine(),
Expand Down
6 changes: 4 additions & 2 deletions nutanix/sdks/v4/networking/networking.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package networking

import (
"github.com/nutanix-core/ntnx-api-golang-sdk-internal/networking-go-client/v16/api"
network "github.com/nutanix-core/ntnx-api-golang-sdk-internal/networking-go-client/v16/client"
"github.com/nutanix/ntnx-api-golang-clients/networking-go-client/v4/api"
network "github.com/nutanix/ntnx-api-golang-clients/networking-go-client/v4/client"
"github.com/terraform-providers/terraform-provider-nutanix/nutanix/client"
)

type NetworkingClient struct {

Check failure on line 9 in nutanix/sdks/v4/networking/networking.go

View workflow job for this annotation

GitHub Actions / tests

type name will be used as networking.NetworkingClient by other packages, and that stutters; consider calling this Client (golint)
SubnetApiInstance *api.SubnetApi

Check failure on line 10 in nutanix/sdks/v4/networking/networking.go

View workflow job for this annotation

GitHub Actions / tests

struct field `SubnetApiInstance` should be `SubnetAPIInstance` (golint)
VpcApiInstance *api.VpcApi

Check failure on line 11 in nutanix/sdks/v4/networking/networking.go

View workflow job for this annotation

GitHub Actions / tests

struct field `VpcApiInstance` should be `VpcAPIInstance` (golint)
FloatingIpApiInstance *api.FloatingIpApi

Check failure on line 12 in nutanix/sdks/v4/networking/networking.go

View workflow job for this annotation

GitHub Actions / tests

struct field `FloatingIpApiInstance` should be `FloatingIPAPIInstance` (golint)
RoutingPolicy *api.RoutingPolicyApi
}

func NewNetworkingClient(credentials client.Credentials) (*NetworkingClient, error) {
Expand All @@ -32,6 +33,7 @@ func NewNetworkingClient(credentials client.Credentials) (*NetworkingClient, err
SubnetApiInstance: api.NewSubnetApi(baseClient),
VpcApiInstance: api.NewVpcApi(baseClient),
FloatingIpApiInstance: api.NewFloatingIpApi(baseClient),
RoutingPolicy: api.NewRoutingPolicyApi(baseClient),
}

return f, nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
import1 "github.com/nutanix-core/ntnx-api-golang-sdk-internal/networking-go-client/v16/models/networking/v4/config"
import1 "github.com/nutanix/ntnx-api-golang-clients/networking-go-client/v4/models/networking/v4/config"

conns "github.com/terraform-providers/terraform-provider-nutanix/nutanix"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
import1 "github.com/nutanix-core/ntnx-api-golang-sdk-internal/networking-go-client/v16/models/networking/v4/config"
import1 "github.com/nutanix/ntnx-api-golang-clients/networking-go-client/v4/models/networking/v4/config"
conns "github.com/terraform-providers/terraform-provider-nutanix/nutanix"
"github.com/terraform-providers/terraform-provider-nutanix/utils"
)
Expand Down
Loading

0 comments on commit 4730df3

Please sign in to comment.