@@ -4,19 +4,20 @@ import (
44 "context"
55 "errors"
66
7+ "github.com/threefoldtech/tfgrid-sdk-go/messenger"
78 "github.com/threefoldtech/zosbase/pkg/gridtypes"
89)
910
1011func (a * API ) DeploymentDeployHandler (ctx context.Context , deployment gridtypes.Deployment ) error {
11- twinID , ok := ctx .Value ("twin_id" ).(uint32 )
12+ twinID , ok := ctx .Value (messenger . TwinIdContextKey ).(uint32 )
1213 if ! ok {
1314 return errors .New ("could not get twin_id from context" )
1415 }
1516 return a .provisionStub .CreateOrUpdate (ctx , twinID , deployment , false )
1617}
1718
1819func (a * API ) DeploymentUpdateHandler (ctx context.Context , deployment gridtypes.Deployment ) error {
19- twinID , ok := ctx .Value ("twin_id" ).(uint32 )
20+ twinID , ok := ctx .Value (messenger . TwinIdContextKey ).(uint32 )
2021 if ! ok {
2122 return errors .New ("could not get twin_id from context" )
2223 }
@@ -28,23 +29,23 @@ func (a *API) DeploymentDeleteHandler(ctx context.Context, contractID uint64) er
2829}
2930
3031func (a * API ) DeploymentGetHandler (ctx context.Context , contractID uint64 ) (gridtypes.Deployment , error ) {
31- twinID , ok := ctx .Value ("twin_id" ).(uint32 )
32+ twinID , ok := ctx .Value (messenger . TwinIdContextKey ).(uint32 )
3233 if ! ok {
3334 return gridtypes.Deployment {}, errors .New ("could not get twin_id from context" )
3435 }
3536 return a .provisionStub .Get (ctx , twinID , contractID )
3637}
3738
3839func (a * API ) DeploymentListHandler (ctx context.Context ) ([]gridtypes.Deployment , error ) {
39- twinID , ok := ctx .Value ("twin_id" ).(uint32 )
40+ twinID , ok := ctx .Value (messenger . TwinIdContextKey ).(uint32 )
4041 if ! ok {
4142 return nil , errors .New ("could not get twin_id from context" )
4243 }
4344 return a .provisionStub .List (ctx , twinID )
4445}
4546
4647func (a * API ) DeploymentChangesHandler (ctx context.Context , contractID uint64 ) ([]gridtypes.Workload , error ) {
47- twinID , ok := ctx .Value ("twin_id" ).(uint32 )
48+ twinID , ok := ctx .Value (messenger . TwinIdContextKey ).(uint32 )
4849 if ! ok {
4950 return nil , errors .New ("could not get twin_id from context" )
5051 }
0 commit comments