@@ -49,6 +49,7 @@ type Client interface {
4949 getHierarchy (nnm string ) * api.HierarchyConfiguration
5050 updateHierarchy (hier * api.HierarchyConfiguration , reason string )
5151 createAnchor (nnm string , hnnm string )
52+ deleteAnchor (nnm string , hnnm string )
5253 getAnchorStatus (nnm string ) anchorStatus
5354 getHNCConfig () * api.HNCConfiguration
5455 updateHNCConfig (* api.HNCConfiguration )
@@ -102,6 +103,7 @@ func init() {
102103 rootCmd .AddCommand (newDescribeCmd ())
103104 rootCmd .AddCommand (newTreeCmd ())
104105 rootCmd .AddCommand (newCreateCmd ())
106+ rootCmd .AddCommand (newDeleteCmd ())
105107 rootCmd .AddCommand (newConfigCmd ())
106108 rootCmd .AddCommand (newVersionCmd ())
107109 rootCmd .AddCommand (newHrqCmd ())
@@ -186,6 +188,18 @@ func (cl *realClient) createAnchor(nnm string, hnnm string) {
186188 fmt .Printf ("Successfully created %q subnamespace anchor in %q namespace\n " , hnnm , nnm )
187189}
188190
191+ func (cl * realClient ) deleteAnchor (nnm string , hnnm string ) {
192+ ctx , cancel := context .WithTimeout (context .Background (), 5 * time .Second )
193+ defer cancel ()
194+
195+ err := hncClient .Delete ().Resource (api .Anchors ).Namespace (nnm ).Name (hnnm ).Do (ctx ).Error ()
196+ if err != nil {
197+ fmt .Printf ("\n Could not delete subnamespace anchor.\n Reason: %s\n " , err )
198+ os .Exit (1 )
199+ }
200+ fmt .Printf ("Successfully deleted %q subnamespace anchor in %q namespace\n " , hnnm , nnm )
201+ }
202+
189203func (cl * realClient ) getHNCConfig () * api.HNCConfiguration {
190204 ctx , cancel := context .WithTimeout (context .Background (), 5 * time .Second )
191205 defer cancel ()
0 commit comments