forked from nutanix/terraform-provider-nutanix
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a4e76cc
commit 25562e0
Showing
11 changed files
with
2,378 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
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/terraform-providers/terraform-provider-nutanix/nutanix/client" | ||
) | ||
|
||
type NetworkingClient struct { | ||
SubnetApiInstance *api.SubnetApi | ||
VpcApiInstance *api.VpcApi | ||
FloatingIpApiInstance *api.FloatingIpApi | ||
} | ||
|
||
func NewNetworkingClient(credentials client.Credentials) (*NetworkingClient, error) { | ||
var baseClient *network.ApiClient | ||
|
||
// check if all required fields are present. Else create an empty client | ||
if credentials.Username != "" && credentials.Password != "" && credentials.Endpoint != "" { | ||
pcClient := network.NewApiClient() | ||
|
||
pcClient.Host = credentials.Endpoint | ||
pcClient.Password = credentials.Password | ||
pcClient.Username = credentials.Username | ||
pcClient.Port = 9440 | ||
pcClient.VerifySSL = false | ||
|
||
baseClient = pcClient | ||
} | ||
|
||
f := &NetworkingClient{ | ||
SubnetApiInstance: api.NewSubnetApi(baseClient), | ||
VpcApiInstance: api.NewVpcApi(baseClient), | ||
FloatingIpApiInstance: api.NewFloatingIpApi(baseClient), | ||
} | ||
|
||
return f, nil | ||
} |
Oops, something went wrong.