@@ -386,6 +386,45 @@ func (s *session) ReloadArtifactVersionManifest(ctx context.Context) (string, er
386386 return jobOutput .ID , nil
387387}
388388
389+ // GetAppServicesManifests returns app services manifests of tenant related to session's access key
390+ func (s * session ) GetAppServicesManifests (
391+ getAppServicesManifestsInput * v3ioc.GetAppServicesManifestsInput ) (* v3ioc.GetAppServicesManifestsOutput , error ) {
392+
393+ // prepare app services manifests response resource
394+ getAppServicesManifestsOutput := v3ioc.GetAppServicesManifestsOutput {}
395+
396+ if err := s .listResource (getAppServicesManifestsInput .Ctx ,
397+ "app_services_manifests" ,
398+ & getAppServicesManifestsInput .ControlPlaneInput ,
399+ & getAppServicesManifestsOutput .ControlPlaneOutput ,
400+ & getAppServicesManifestsOutput .AppServicesManifests ); err != nil {
401+ return nil , errors .Wrap (err , "Failed to list app services manifests resource" )
402+ }
403+
404+ return & getAppServicesManifestsOutput , nil
405+ }
406+
407+ // UpdateAppServicesManifest updates app services manifests of tenant related to session's access key
408+ func (s * session ) UpdateAppServicesManifest (
409+ updateAppServicesManifestInput * v3ioc.UpdateAppServicesManifestInput ) (* v3ioc.GetJobOutput , error ) {
410+
411+ // prepare job response resource
412+ getJobOutput := v3ioc.GetJobOutput {}
413+
414+ // try to update the resource
415+ if err := s .updateResource (updateAppServicesManifestInput .Ctx ,
416+ "app_services_manifests" ,
417+ "app_services_manifest" ,
418+ & updateAppServicesManifestInput .ControlPlaneInput ,
419+ & updateAppServicesManifestInput .AppServicesManifestAttributes ,
420+ & getJobOutput .ControlPlaneOutput ,
421+ & getJobOutput .JobAttributes ); err != nil {
422+ return nil , errors .Wrap (err , "Failed to update app services manifests resource" )
423+ }
424+
425+ return & getJobOutput , nil
426+ }
427+
389428// WaitForJobCompletion waits for completion of job with given id (blocking)
390429func (s * session ) WaitForJobCompletion (ctx context.Context , jobID string , retryInterval , timeout time.Duration ) error {
391430 getJobInput := v3ioc.GetJobInput {
@@ -667,6 +706,48 @@ func (s *session) getResource(ctx context.Context,
667706 return nil
668707}
669708
709+ func (s * session ) listResource (ctx context.Context ,
710+ path string ,
711+ controlPlaneInput * v3ioc.ControlPlaneInput ,
712+ controlPlaneOutput * v3ioc.ControlPlaneOutput ,
713+ responseData interface {}) error {
714+
715+ // allocate request
716+ httpRequest := fasthttp .AcquireRequest ()
717+ defer fasthttp .ReleaseRequest (httpRequest )
718+
719+ responseInstance , err := s .sendRequest (ctx ,
720+ & request {
721+ method : http .MethodGet ,
722+ path : "api/" + path ,
723+ httpRequest : httpRequest ,
724+ }, controlPlaneInput .Timeout )
725+
726+ if err != nil {
727+ return errors .Wrapf (err , "Failed to list resource (%s)" , path )
728+ }
729+
730+ // if we got cookies, set them
731+ if len (responseInstance .cookies ) > 0 {
732+ s .cookies = responseInstance .cookies
733+ }
734+
735+ // unmarshal
736+ if responseInstance .body != nil && controlPlaneOutput != nil {
737+ responseBuffer := bytes .NewBuffer (responseInstance .body )
738+
739+ jsonAPIResponse := jsonapiResources {
740+ Data : responseData ,
741+ }
742+
743+ if err := json .NewDecoder (responseBuffer ).Decode (& jsonAPIResponse ); err != nil {
744+ return errors .Wrap (err , "Failed to decode json api response" )
745+ }
746+ }
747+
748+ return nil
749+ }
750+
670751func (s * session ) deleteResource (ctx context.Context ,
671752 path string ,
672753 kind string ,
0 commit comments