(deps commandDeps)
| 130 | } |
| 131 | |
| 132 | func newBridgeCreateCommand(deps commandDeps) *cobra.Command { |
| 133 | var ( |
| 134 | scopeRaw string |
| 135 | workspaceID string |
| 136 | platform string |
| 137 | extensionName string |
| 138 | displayName string |
| 139 | enabled bool |
| 140 | includePeer bool |
| 141 | includeThread bool |
| 142 | includeGroup bool |
| 143 | notificationMute bool |
| 144 | providerConfig string |
| 145 | deliveryDefaults string |
| 146 | ) |
| 147 | |
| 148 | cmd := &cobra.Command{ |
| 149 | Use: bridgeCreateKey, |
| 150 | Short: "Create a bridge instance", |
| 151 | RunE: func(cmd *cobra.Command, _ []string) error { |
| 152 | client, err := clientFromDeps(deps) |
| 153 | if err != nil { |
| 154 | return err |
| 155 | } |
| 156 | |
| 157 | payload, err := buildBridgeCreatePayload( |
| 158 | scopeRaw, |
| 159 | workspaceID, |
| 160 | platform, |
| 161 | extensionName, |
| 162 | displayName, |
| 163 | enabled, |
| 164 | includePeer, |
| 165 | includeThread, |
| 166 | includeGroup, |
| 167 | notificationMute, |
| 168 | providerConfig, |
| 169 | deliveryDefaults, |
| 170 | ) |
| 171 | if err != nil { |
| 172 | return err |
| 173 | } |
| 174 | |
| 175 | item, err := client.CreateBridge(cmd.Context(), payload) |
| 176 | if err != nil { |
| 177 | return err |
| 178 | } |
| 179 | return writeCommandOutput(cmd, bridgeBundle(item)) |
| 180 | }, |
| 181 | } |
| 182 | cmd.Flags(). |
| 183 | StringVar(&scopeRaw, bridgeScopeKey, string(bridgepkg.ScopeGlobal), "Bridge scope: global or workspace") |
| 184 | cmd.Flags(). |
| 185 | StringVar(&workspaceID, "workspace-id", "", "Owning workspace ID for workspace-scoped bridges") |
| 186 | cmd.Flags().StringVar(&platform, "platform", "", "Messaging platform name") |
| 187 | cmd.Flags().StringVar(&extensionName, "extension", "", "Owning extension name") |
| 188 | cmd.Flags().StringVar(&displayName, "display-name", "", "Operator-facing bridge display name") |
| 189 | cmd.Flags().BoolVar(&enabled, bridgeEnabledKey, true, "Whether the instance starts enabled") |
no test coverage detected