-
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/1.8.0-beta.1 Release with Nutanix Database Service based resourc…
…es and datasources (#501) Co-authored-by: Abhishekism9450 <[email protected]> Co-authored-by: Abhishek Chaudhary <[email protected]>
- Loading branch information
1 parent
a8f9268
commit abdd924
Showing
46 changed files
with
8,059 additions
and
11 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,49 @@ | ||
package era | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
|
||
"github.com/terraform-providers/terraform-provider-nutanix/client" | ||
) | ||
|
||
const ( | ||
libraryVersion = "v0.9" | ||
absolutePath = "era/" + libraryVersion | ||
clientName = "ndb" | ||
) | ||
|
||
type Client struct { | ||
client *client.Client | ||
Service Service | ||
} | ||
|
||
func NewEraClient(credentials client.Credentials) (*Client, error) { | ||
var baseClient *client.Client | ||
|
||
// check if all required fields are present. Else create an empty client | ||
if credentials.NdbUsername != "" && credentials.NdbPassword != "" && credentials.NdbEndpoint != "" { | ||
credentials.URL = fmt.Sprintf(credentials.NdbEndpoint) | ||
credentials.Password = credentials.NdbPassword | ||
credentials.Username = credentials.NdbUsername | ||
|
||
c, err := client.NewBaseClient(&credentials, absolutePath, false) | ||
if err != nil { | ||
return nil, err | ||
} | ||
baseClient = c | ||
} else { | ||
errorMsg := fmt.Sprintf("NDB Client is missing. "+ | ||
"Please provide required details - %s in provider configuration.", strings.Join(credentials.RequiredFields[clientName], ", ")) | ||
|
||
baseClient = &client.Client{ErrorMsg: errorMsg} | ||
} | ||
|
||
era := &Client{ | ||
client: baseClient, | ||
Service: ServiceClient{ | ||
c: baseClient, | ||
}, | ||
} | ||
return era, nil | ||
} |
Oops, something went wrong.