@@ -56,7 +56,7 @@ func projectCreate() *cobra.Command {
56
56
Default : filepath .Base (directory ),
57
57
Label : "What's your project's name?" ,
58
58
Validate : func (s string ) error {
59
- project , _ := client .Project (cmd .Context (), organization .Name , s )
59
+ project , _ := client .ProjectByName (cmd .Context (), organization .ID , s )
60
60
if project .ID .String () != uuid .Nil .String () {
61
61
return xerrors .New ("A project already exists with that name!" )
62
62
}
@@ -71,9 +71,9 @@ func projectCreate() *cobra.Command {
71
71
if err != nil {
72
72
return err
73
73
}
74
- project , err := client .CreateProject (cmd .Context (), organization .Name , coderd.CreateProjectRequest {
75
- Name : name ,
76
- VersionImportJobID : job .ID ,
74
+ project , err := client .CreateProject (cmd .Context (), organization .ID , coderd.CreateProjectRequest {
75
+ Name : name ,
76
+ VersionID : job .ID ,
77
77
})
78
78
if err != nil {
79
79
return err
@@ -118,7 +118,7 @@ func projectCreate() *cobra.Command {
118
118
return cmd
119
119
}
120
120
121
- func validateProjectVersionSource (cmd * cobra.Command , client * codersdk.Client , organization coderd.Organization , provisioner database.ProvisionerType , directory string , parameters ... coderd.CreateParameterValueRequest ) (* coderd.ProvisionerJob , error ) {
121
+ func validateProjectVersionSource (cmd * cobra.Command , client * codersdk.Client , organization coderd.Organization , provisioner database.ProvisionerType , directory string , parameters ... coderd.CreateParameterValueRequest ) (* coderd.ProjectVersion , error ) {
122
122
spin := spinner .New (spinner .CharSets [5 ], 100 * time .Millisecond )
123
123
spin .Writer = cmd .OutOrStdout ()
124
124
spin .Suffix = " Uploading current directory..."
@@ -139,7 +139,7 @@ func validateProjectVersionSource(cmd *cobra.Command, client *codersdk.Client, o
139
139
}
140
140
141
141
before := time .Now ()
142
- job , err := client .CreateProjectImportJob (cmd .Context (), organization .Name , coderd.CreateProjectImportJobRequest {
142
+ version , err := client .CreateProjectVersion (cmd .Context (), organization .ID , coderd.CreateProjectVersionRequest {
143
143
StorageMethod : database .ProvisionerStorageMethodFile ,
144
144
StorageSource : resp .Hash ,
145
145
Provisioner : provisioner ,
@@ -149,7 +149,7 @@ func validateProjectVersionSource(cmd *cobra.Command, client *codersdk.Client, o
149
149
return nil , err
150
150
}
151
151
spin .Suffix = " Waiting for the import to complete..."
152
- logs , err := client .ProjectImportJobLogsAfter (cmd .Context (), organization . Name , job .ID , before )
152
+ logs , err := client .ProjectVersionLogsAfter (cmd .Context (), version .ID , before )
153
153
if err != nil {
154
154
return nil , err
155
155
}
@@ -162,22 +162,22 @@ func validateProjectVersionSource(cmd *cobra.Command, client *codersdk.Client, o
162
162
logBuffer = append (logBuffer , log )
163
163
}
164
164
165
- job , err = client .ProjectImportJob (cmd .Context (), organization . Name , job .ID )
165
+ version , err = client .ProjectVersion (cmd .Context (), version .ID )
166
166
if err != nil {
167
167
return nil , err
168
168
}
169
- parameterSchemas , err := client .ProjectImportJobSchemas (cmd .Context (), organization . Name , job .ID )
169
+ parameterSchemas , err := client .ProjectVersionSchema (cmd .Context (), version .ID )
170
170
if err != nil {
171
171
return nil , err
172
172
}
173
- parameterValues , err := client .ProjectImportJobParameters (cmd .Context (), organization . Name , job .ID )
173
+ parameterValues , err := client .ProjectVersionParameters (cmd .Context (), version .ID )
174
174
if err != nil {
175
175
return nil , err
176
176
}
177
177
spin .Stop ()
178
178
179
- if provisionerd .IsMissingParameterError (job .Error ) {
180
- valuesBySchemaID := map [string ]coderd.ComputedParameterValue {}
179
+ if provisionerd .IsMissingParameterError (version . Job .Error ) {
180
+ valuesBySchemaID := map [string ]coderd.ProjectVersionParameter {}
181
181
for _ , parameterValue := range parameterValues {
182
182
valuesBySchemaID [parameterValue .SchemaID .String ()] = parameterValue
183
183
}
@@ -202,21 +202,20 @@ func validateProjectVersionSource(cmd *cobra.Command, client *codersdk.Client, o
202
202
return validateProjectVersionSource (cmd , client , organization , provisioner , directory , parameters ... )
203
203
}
204
204
205
- if job . Status != coderd .ProvisionerJobStatusSucceeded {
205
+ if version . Job . Status != coderd .ProvisionerJobSucceeded {
206
206
for _ , log := range logBuffer {
207
207
_ , _ = fmt .Fprintf (cmd .OutOrStdout (), "%s %s\n " , color .HiGreenString ("[tf]" ), log .Output )
208
208
}
209
-
210
- return nil , xerrors .New (job .Error )
209
+ return nil , xerrors .New (version .Job .Error )
211
210
}
212
211
213
212
_ , _ = fmt .Fprintf (cmd .OutOrStdout (), "%s Successfully imported project source!\n " , color .HiGreenString ("✓" ))
214
213
215
- resources , err := client .ProjectImportJobResources (cmd .Context (), organization . Name , job .ID )
214
+ resources , err := client .ProjectVersionResources (cmd .Context (), version .ID )
216
215
if err != nil {
217
216
return nil , err
218
217
}
219
- return & job , displayProjectImportInfo (cmd , parameterSchemas , parameterValues , resources )
218
+ return & version , displayProjectImportInfo (cmd , parameterSchemas , parameterValues , resources )
220
219
}
221
220
222
221
func tarDirectory (directory string ) ([]byte , error ) {
0 commit comments