@@ -56,7 +56,7 @@ func projectCreate() *cobra.Command {
5656 Default : filepath .Base (directory ),
5757 Label : "What's your project's name?" ,
5858 Validate : func (s string ) error {
59- project , _ := client .Project (cmd .Context (), organization .Name , s )
59+ project , _ := client .ProjectByName (cmd .Context (), organization .ID , s )
6060 if project .ID .String () != uuid .Nil .String () {
6161 return xerrors .New ("A project already exists with that name!" )
6262 }
@@ -71,9 +71,9 @@ func projectCreate() *cobra.Command {
7171 if err != nil {
7272 return err
7373 }
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 ,
7777 })
7878 if err != nil {
7979 return err
@@ -118,7 +118,7 @@ func projectCreate() *cobra.Command {
118118 return cmd
119119}
120120
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 ) {
122122 spin := spinner .New (spinner .CharSets [5 ], 100 * time .Millisecond )
123123 spin .Writer = cmd .OutOrStdout ()
124124 spin .Suffix = " Uploading current directory..."
@@ -139,7 +139,7 @@ func validateProjectVersionSource(cmd *cobra.Command, client *codersdk.Client, o
139139 }
140140
141141 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 {
143143 StorageMethod : database .ProvisionerStorageMethodFile ,
144144 StorageSource : resp .Hash ,
145145 Provisioner : provisioner ,
@@ -149,7 +149,7 @@ func validateProjectVersionSource(cmd *cobra.Command, client *codersdk.Client, o
149149 return nil , err
150150 }
151151 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 )
153153 if err != nil {
154154 return nil , err
155155 }
@@ -162,22 +162,22 @@ func validateProjectVersionSource(cmd *cobra.Command, client *codersdk.Client, o
162162 logBuffer = append (logBuffer , log )
163163 }
164164
165- job , err = client .ProjectImportJob (cmd .Context (), organization . Name , job .ID )
165+ version , err = client .ProjectVersion (cmd .Context (), version .ID )
166166 if err != nil {
167167 return nil , err
168168 }
169- parameterSchemas , err := client .ProjectImportJobSchemas (cmd .Context (), organization . Name , job .ID )
169+ parameterSchemas , err := client .ProjectVersionSchema (cmd .Context (), version .ID )
170170 if err != nil {
171171 return nil , err
172172 }
173- parameterValues , err := client .ProjectImportJobParameters (cmd .Context (), organization . Name , job .ID )
173+ parameterValues , err := client .ProjectVersionParameters (cmd .Context (), version .ID )
174174 if err != nil {
175175 return nil , err
176176 }
177177 spin .Stop ()
178178
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 {}
181181 for _ , parameterValue := range parameterValues {
182182 valuesBySchemaID [parameterValue .SchemaID .String ()] = parameterValue
183183 }
@@ -202,21 +202,20 @@ func validateProjectVersionSource(cmd *cobra.Command, client *codersdk.Client, o
202202 return validateProjectVersionSource (cmd , client , organization , provisioner , directory , parameters ... )
203203 }
204204
205- if job . Status != coderd .ProvisionerJobStatusSucceeded {
205+ if version . Job . Status != coderd .ProvisionerJobSucceeded {
206206 for _ , log := range logBuffer {
207207 _ , _ = fmt .Fprintf (cmd .OutOrStdout (), "%s %s\n " , color .HiGreenString ("[tf]" ), log .Output )
208208 }
209-
210- return nil , xerrors .New (job .Error )
209+ return nil , xerrors .New (version .Job .Error )
211210 }
212211
213212 _ , _ = fmt .Fprintf (cmd .OutOrStdout (), "%s Successfully imported project source!\n " , color .HiGreenString ("✓" ))
214213
215- resources , err := client .ProjectImportJobResources (cmd .Context (), organization . Name , job .ID )
214+ resources , err := client .ProjectVersionResources (cmd .Context (), version .ID )
216215 if err != nil {
217216 return nil , err
218217 }
219- return & job , displayProjectImportInfo (cmd , parameterSchemas , parameterValues , resources )
218+ return & version , displayProjectImportInfo (cmd , parameterSchemas , parameterValues , resources )
220219}
221220
222221func tarDirectory (directory string ) ([]byte , error ) {
0 commit comments