@@ -817,6 +817,7 @@ type ServiceResources struct {
817817 objectStores * setup.KVStores
818818 kvStores * setup.KVStores
819819 secretStores * setup.SecretStores
820+ products * setup.Products
820821}
821822
822823// ConstructNewServiceResources instantiates multiple [setup] config resources for a
@@ -887,6 +888,17 @@ func (c *DeployCommand) ConstructNewServiceResources(
887888 Stdin : in ,
888889 Stdout : out ,
889890 }
891+
892+ sr .products = & setup.Products {
893+ APIClient : c .Globals .APIClient ,
894+ AcceptDefaults : c .Globals .Flags .AcceptDefaults ,
895+ NonInteractive : c .Globals .Flags .NonInteractive ,
896+ ServiceID : serviceID ,
897+ ServiceVersion : serviceVersion ,
898+ Setup : c .Globals .Manifest .File .Setup .Products ,
899+ Stdin : in ,
900+ Stdout : out ,
901+ }
890902}
891903
892904// ConfigureServiceResources calls the .Predefined() and .Configure() methods
@@ -941,6 +953,13 @@ func (c *DeployCommand) ConfigureServiceResources(sr ServiceResources, serviceID
941953 }
942954 }
943955
956+ if sr .products .Predefined () {
957+ if err := sr .products .Configure (); err != nil {
958+ errLogService (c .Globals .ErrLog , err , serviceID , serviceVersion )
959+ return fmt .Errorf ("error configuring service products: %w" , err )
960+ }
961+ }
962+
944963 return nil
945964}
946965
@@ -957,6 +976,7 @@ func (c *DeployCommand) CreateServiceResources(
957976 sr .objectStores .Spinner = spinner
958977 sr .kvStores .Spinner = spinner
959978 sr .secretStores .Spinner = spinner
979+ sr .products .Spinner = spinner
960980
961981 if err := sr .backends .Create (); err != nil {
962982 c .Globals .ErrLog .AddWithContext (err , map [string ]any {
@@ -1013,6 +1033,17 @@ func (c *DeployCommand) CreateServiceResources(
10131033 return err
10141034 }
10151035
1036+ if err := sr .products .Create (); err != nil {
1037+ c .Globals .ErrLog .AddWithContext (err , map [string ]any {
1038+ "Accept defaults" : c .Globals .Flags .AcceptDefaults ,
1039+ "Auto-yes" : c .Globals .Flags .AutoYes ,
1040+ "Non-interactive" : c .Globals .Flags .NonInteractive ,
1041+ "Service ID" : serviceID ,
1042+ "Service Version" : serviceVersion ,
1043+ })
1044+ return err
1045+ }
1046+
10161047 return nil
10171048}
10181049
0 commit comments