-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
127 lines (101 loc) · 3.56 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package main
import (
"context"
"flag"
"log"
"os"
"terraform-provider-theta/internal/provider"
"github.com/hashicorp/terraform-plugin-framework/providerserver"
)
// Run "go generate" to format example terraform files and generate the docs for the registry/website
// If you do not have terraform installed, you can remove the formatting command, but its suggested to
// ensure the documentation is formatted properly.
//go:generate terraform fmt -recursive ./examples/
// Run the docs generation tool, check its repository for more information on how it works and how docs
// can be customized.
//go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs generate -provider-name scaffolding
var (
// these will be set by the goreleaser configuration
// to appropriate values for the compiled binary.
version string = "dev"
// goreleaser can pass other information to the main package, such as the specific commit
// https://goreleaser.com/cookbooks/using-main.version/
)
func main() {
// var client = provider.NewClient("igorperic+theta2@live.com", "theta1231")
// organisations, err := client.GetOrganizations()
// if err != nil {
// println(err.Error())
// return
// }
// project := organisations[0]
// println(project.Name)
// newProject := provider.Project{
// Name: "my_cool_new_project",
// }
// projectResponse, err := client.CreateProject(&newProject)
// if err != nil {
// println(err.Error())
// }
// println(projectResponse.Name)
// project := provider.Project{ID: "prj_2tcq81a5wyk3637caigcn9ytrz2s"}
// templateReq := provider.DeploymentTemplateRequest{
// Name: "asdf2123",
// ProjectID: project.ID,
// Description: "",
// ContainerImage: "vllm/vllm-openai",
// Tags: []string{"LLM", "API"}, // TODO: convert this into enums of allowed tags
// ContainerPort: "8000",
// ContainerArgs: "",
// EnvVars: nil,
// }
// template, err := client.CreateDeploymentTemplate(templateReq)
// if err != nil {
// println(err.Error())
// return
// } else {
// println("Created template")
// println(template.ID)
// }
// templates, _ := client.GetDeploymentTemplates("prj_2tcq81a5wyk3637caigcn9ytrz2s", 0, 8)
// println(templates[0].Name)
// template, err := client.DeleteDeploymentTemplate("img_6xtzvg40d7cmbnpu1u13u58m6fn11", project.ID)
// if err != nil {
// println(err.Error())
// return
// } else {
// println("Deleted template")
// println(template)
// }
// newTemplate, err := client.GetDeployment(template.ID)
// if err != nil {
// println(err.Error())
// return
// } else {
// println("Created template")
// println(newTemplate)
// }
// Set log output to standard error for better visibility
log.SetOutput(os.Stderr)
// Set log level to debug for detailed logging
log.SetFlags(log.LstdFlags | log.Lshortfile)
log.SetPrefix("DEBUG: ")
var debug bool
flag.BoolVar(&debug, "debug", false, "set to true to run the provider with support for debuggers like delve")
flag.Parse()
opts := providerserver.ServeOpts{
// NOTE: This is not a typical Terraform Registry provider address,
// such as registry.terraform.io/hashicorp/theta. This specific
// provider address is used in these tutorials in conjunction with a
// specific Terraform CLI configuration for manual development testing
// of this provider.
Address: "hashicorp.com/edu/theta",
Debug: debug,
}
err := providerserver.Serve(context.Background(), provider.New, opts)
if err != nil {
log.Fatal(err.Error())
}
}