@@ -4,19 +4,20 @@ import (
4
4
"context"
5
5
"errors"
6
6
7
+ "github.com/threefoldtech/tfgrid-sdk-go/messenger"
7
8
"github.com/threefoldtech/zosbase/pkg/gridtypes"
8
9
)
9
10
10
11
func (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 )
12
13
if ! ok {
13
14
return errors .New ("could not get twin_id from context" )
14
15
}
15
16
return a .provisionStub .CreateOrUpdate (ctx , twinID , deployment , false )
16
17
}
17
18
18
19
func (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 )
20
21
if ! ok {
21
22
return errors .New ("could not get twin_id from context" )
22
23
}
@@ -28,23 +29,23 @@ func (a *API) DeploymentDeleteHandler(ctx context.Context, contractID uint64) er
28
29
}
29
30
30
31
func (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 )
32
33
if ! ok {
33
34
return gridtypes.Deployment {}, errors .New ("could not get twin_id from context" )
34
35
}
35
36
return a .provisionStub .Get (ctx , twinID , contractID )
36
37
}
37
38
38
39
func (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 )
40
41
if ! ok {
41
42
return nil , errors .New ("could not get twin_id from context" )
42
43
}
43
44
return a .provisionStub .List (ctx , twinID )
44
45
}
45
46
46
47
func (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 )
48
49
if ! ok {
49
50
return nil , errors .New ("could not get twin_id from context" )
50
51
}
0 commit comments