Skip to content

Commit bfba634

Browse files
committed
fix: Scope examples out of main package
1 parent c7fc3db commit bfba634

File tree

4 files changed

+76
-75
lines changed

4 files changed

+76
-75
lines changed

examples/createStore/main.go

Lines changed: 73 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,74 @@
1-
package main
1+
package examples
22

3-
import (
4-
"fmt"
5-
"github.com/Keyfactor/keyfactor-go-client/api"
6-
"log"
7-
"os"
8-
)
9-
10-
func main() {
11-
// Create a new Keyfactor client
12-
clientConfig := &api.AuthConfig{
13-
Hostname: os.Getenv("KEYFACTOR_HOSTNAME"),
14-
Username: os.Getenv("KEYFACTOR_USERNAME"),
15-
Password: os.Getenv("KEYFACTOR_PASSWORD"),
16-
}
17-
client, err := api.NewKeyfactorClient(clientConfig)
18-
if err != nil {
19-
log.Fatal(err)
20-
}
21-
22-
// ---------------------------------------------------------------------------------------------------------------//
23-
// Get Certificate Store Types
24-
//
25-
// To retrieve data on a specific certificate store type supported by the Keyfactor instance referenced by the
26-
// Keyfactor Go client, use the GetCertificateStoreType method.
27-
storeType, err := client.GetCertificateStoreType(106)
28-
if err != nil {
29-
return
30-
}
31-
log.Printf("Short Name: %s", storeType.ShortName)
32-
33-
// ---------------------------------------------------------------------------------------------------------------//
34-
// Create New AKV Certificate Store
35-
//
36-
// To create a new certificate store using the Keyfactor Go Client,
37-
// first create a pointer to an CreateStoreFctArgs struct,
38-
// and populate the required fields. The below fields are the bare minimum. Note that the properties required vary
39-
// between different store types. Use the GetCertificateStoreType method to determine the required fields.
40-
properties := make(map[string]string)
41-
properties["TenantID"] = "tenant"
42-
properties["ResourceGroupName"] = "resource group name"
43-
properties["ApplicationId"] = "app ID"
44-
properties["ClientSecret"] = "client secret"
45-
properties["SubscriptionId"] = "subscription ID"
46-
properties["APIObjectId"] = "object ID"
47-
properties["VaultName"] = "coolvault"
48-
49-
createStore := &api.CreateStoreFctArgs{
50-
AgentId: "keyfactor orchestrator agent ID",
51-
ClientMachine: "aks_demo",
52-
StorePath: "https://coolvault.vault.azure.net/",
53-
CertStoreType: 106,
54-
Properties: properties,
55-
}
56-
// Then, use the CreateStore method to create the new certificate store.
57-
store, err := client.CreateStore(createStore)
58-
if err != nil {
59-
return
60-
}
61-
fmt.Printf("%#v", store)
62-
63-
// ---------------------------------------------------------------------------------------------------------------//
64-
// Get Certificate Store Context
65-
//
66-
// To retrieve the context of a certificate store in Keyfactor, make a call to the GetCertificateStoreByID method.
67-
// Pass a string as the certificate store ID.
68-
storeContext, err := client.GetCertificateStoreByID(store.Id)
69-
if err != nil {
70-
return
71-
}
72-
fmt.Printf("%#v", storeContext)
73-
}
3+
//
4+
//import (
5+
// "fmt"
6+
// "github.com/Keyfactor/keyfactor-go-client/api"
7+
// "log"
8+
// "os"
9+
//)
10+
//
11+
//func main() {
12+
// // Create a new Keyfactor client
13+
// clientConfig := &api.AuthConfig{
14+
// Hostname: os.Getenv("KEYFACTOR_HOSTNAME"),
15+
// Username: os.Getenv("KEYFACTOR_USERNAME"),
16+
// Password: os.Getenv("KEYFACTOR_PASSWORD"),
17+
// }
18+
// client, err := api.NewKeyfactorClient(clientConfig)
19+
// if err != nil {
20+
// log.Fatal(err)
21+
// }
22+
//
23+
// // ---------------------------------------------------------------------------------------------------------------//
24+
// // Get Certificate Store Types
25+
// //
26+
// // To retrieve data on a specific certificate store type supported by the Keyfactor instance referenced by the
27+
// // Keyfactor Go client, use the GetCertificateStoreType method.
28+
// storeType, err := client.GetCertificateStoreType(106)
29+
// if err != nil {
30+
// return
31+
// }
32+
// log.Printf("Short Name: %s", storeType.ShortName)
33+
//
34+
// // ---------------------------------------------------------------------------------------------------------------//
35+
// // Create New AKV Certificate Store
36+
// //
37+
// // To create a new certificate store using the Keyfactor Go Client,
38+
// // first create a pointer to an CreateStoreFctArgs struct,
39+
// // and populate the required fields. The below fields are the bare minimum. Note that the properties required vary
40+
// // between different store types. Use the GetCertificateStoreType method to determine the required fields.
41+
// properties := make(map[string]string)
42+
// properties["TenantID"] = "tenant"
43+
// properties["ResourceGroupName"] = "resource group name"
44+
// properties["ApplicationId"] = "app ID"
45+
// properties["ClientSecret"] = "client secret"
46+
// properties["SubscriptionId"] = "subscription ID"
47+
// properties["APIObjectId"] = "object ID"
48+
// properties["VaultName"] = "coolvault"
49+
//
50+
// createStore := &api.CreateStoreFctArgs{
51+
// AgentId: "keyfactor orchestrator agent ID",
52+
// ClientMachine: "aks_demo",
53+
// StorePath: "https://coolvault.vault.azure.net/",
54+
// CertStoreType: 106,
55+
// Properties: properties,
56+
// }
57+
// // Then, use the CreateStore method to create the new certificate store.
58+
// store, err := client.CreateStore(createStore)
59+
// if err != nil {
60+
// return
61+
// }
62+
// fmt.Printf("%#v", store)
63+
//
64+
// // ---------------------------------------------------------------------------------------------------------------//
65+
// // Get Certificate Store Context
66+
// //
67+
// // To retrieve the context of a certificate store in Keyfactor, make a call to the GetCertificateStoreByID method.
68+
// // Pass a string as the certificate store ID.
69+
// storeContext, err := client.GetCertificateStoreByID(store.Id)
70+
// if err != nil {
71+
// return
72+
// }
73+
// fmt.Printf("%#v", storeContext)
74+
//}

examples/enrollPFX/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package main
1+
package examples
22

33
import (
44
"fmt"

examples/security/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package keyfactor
1+
package examples
22

33
import (
44
"fmt"

examples/test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package keyfactor
1+
package examples
22

33
import (
44
"fmt"

0 commit comments

Comments
 (0)