@@ -53,16 +53,39 @@ type grpcClient struct {
5353// and returns a copy of the downloaded state data.
5454//
5555// Implementation of remote.Client
56- func (g * grpcClient ) Get () (* Payload , tfdiags.Diagnostics ) {
57- panic ("not implemented yet" )
56+ func (g * grpcClient ) Get () (* Payload , error ) {
57+ // TODO - replace with method implementation added to main branch
58+ req := providers.ReadStateBytesRequest {
59+ TypeName : g .typeName ,
60+ StateId : g .stateId ,
61+ }
62+ resp := g .provider .ReadStateBytes (req )
63+
64+ if len (resp .Bytes ) == 0 {
65+ // No state to return
66+ return nil , resp .Diagnostics .Err ()
67+ }
68+
69+ payload := & Payload {
70+ Data : resp .Bytes ,
71+ MD5 : []byte ("foobar" ),
72+ }
73+ return payload , resp .Diagnostics .Err ()
5874}
5975
6076// Put invokes the WriteStateBytes gRPC method in the plugin protocol
6177// and to transfer state data to the remote location.
6278//
6379// Implementation of remote.Client
64- func (g * grpcClient ) Put (state []byte ) tfdiags.Diagnostics {
65- panic ("not implemented yet" )
80+ func (g * grpcClient ) Put (state []byte ) error {
81+ // TODO - replace with method implementation added to main branch
82+ req := providers.WriteStateBytesRequest {
83+ TypeName : g .typeName ,
84+ StateId : g .stateId ,
85+ }
86+ resp := g .provider .WriteStateBytes (req )
87+
88+ return resp .Diagnostics .Err ()
6689}
6790
6891// Delete invokes the DeleteState gRPC method in the plugin protocol
0 commit comments