forked from Azure/azure-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinfra_delete.go
64 lines (53 loc) · 1.46 KB
/
infra_delete.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package cmd
import (
"context"
"fmt"
"github.com/azure/azure-dev/cli/azd/cmd/actions"
"github.com/azure/azure-dev/cli/azd/internal"
"github.com/azure/azure-dev/cli/azd/pkg/input"
"github.com/azure/azure-dev/cli/azd/pkg/output"
"github.com/spf13/cobra"
)
type infraDeleteFlags struct {
downFlags
}
func newInfraDeleteFlags(cmd *cobra.Command, global *internal.GlobalCommandOptions) *infraDeleteFlags {
flags := &infraDeleteFlags{}
flags.Bind(cmd.Flags(), global)
return flags
}
func newInfraDeleteCmd() *cobra.Command {
return &cobra.Command{
Use: "delete",
Short: "Delete Azure resources for an application.",
Hidden: true,
}
}
type infraDeleteAction struct {
down *downAction
console input.Console
}
func newInfraDeleteAction(
deleteFlags *infraDeleteFlags,
down *downAction,
console input.Console,
) actions.Action {
// Required to ensure the sub action flags are bound correctly to the actions
down.flags = &deleteFlags.downFlags
return &infraDeleteAction{
down: down,
console: console,
}
}
func (a *infraDeleteAction) Run(ctx context.Context) (*actions.ActionResult, error) {
fmt.Fprintln(
a.console.Handles().Stderr,
output.WithWarningFormat(
"WARNING: `azd infra delete` is deprecated and will be removed in a future release."))
fmt.Fprintln(
a.console.Handles().Stderr,
"Next time use `azd down`")
return a.down.Run(ctx)
}