-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat/v4 network security rules on v4 networks (#15)
* datasource for pbrs * lint fixes. go error (gomnd, gosimple, golint) * go checks, magic numbers(gomnd) * fix config testcase as base client will differ in sdks * datasourc for route tables * resource for static route * address groups v4 * service groups * resource for service groups * crud for service groups * CRUD for address groups * data source for network security * CRUD for network security * tests and docs for pbrs * docs for route table * docs for static route * lint fixes * testcases for address groups * fixing lint issues * lint fix * docs for address groups * test and docs for service groups * docs and tcs for NSP * resource tests for NSP * tcs for NSP * remove other services * change module name from v4 to v2 * change package name to networkingv2 --------- Co-authored-by: Abhishek <[email protected]>
- Loading branch information
1 parent
1a966d9
commit 18a3a68
Showing
17 changed files
with
2,822 additions
and
1 deletion.
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 microseg | ||
|
||
import ( | ||
"github.com/nutanix/ntnx-api-golang-clients/microseg-go-client/v4/api" | ||
microseg "github.com/nutanix/ntnx-api-golang-clients/microseg-go-client/v4/client" | ||
"github.com/terraform-providers/terraform-provider-nutanix/nutanix/client" | ||
) | ||
|
||
type Client struct { | ||
AddressGroupAPIInstance *api.AddressGroupsApi | ||
ServiceGroupAPIInstance *api.ServiceGroupsApi | ||
NetworkingSecurityInstance *api.NetworkSecurityPoliciesApi | ||
} | ||
|
||
func NewMicrosegClient(credentials client.Credentials) (*Client, error) { | ||
var baseClient *microseg.ApiClient | ||
|
||
// check if all required fields are present. Else create an empty client | ||
if credentials.Username != "" && credentials.Password != "" && credentials.Endpoint != "" { | ||
pcClient := microseg.NewApiClient() | ||
|
||
pcClient.Host = credentials.Endpoint | ||
pcClient.Password = credentials.Password | ||
pcClient.Username = credentials.Username | ||
pcClient.Port = 9440 | ||
pcClient.VerifySSL = false | ||
|
||
baseClient = pcClient | ||
} | ||
|
||
f := &Client{ | ||
AddressGroupAPIInstance: api.NewAddressGroupsApi(baseClient), | ||
ServiceGroupAPIInstance: api.NewServiceGroupsApi(baseClient), | ||
NetworkingSecurityInstance: api.NewNetworkSecurityPoliciesApi(baseClient), | ||
} | ||
|
||
return f, nil | ||
} |
Oops, something went wrong.