github.com/sri09kanth/helm@v3.0.0-beta.3+incompatible/pkg/action/chart_remove.go (about)

     1  /*
     2  Copyright The Helm Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package action
    18  
    19  import (
    20  	"io"
    21  
    22  	"helm.sh/helm/internal/experimental/registry"
    23  )
    24  
    25  // ChartRemove performs a chart remove operation.
    26  type ChartRemove struct {
    27  	cfg *Configuration
    28  }
    29  
    30  // NewChartRemove creates a new ChartRemove object with the given configuration.
    31  func NewChartRemove(cfg *Configuration) *ChartRemove {
    32  	return &ChartRemove{
    33  		cfg: cfg,
    34  	}
    35  }
    36  
    37  // Run executes the chart remove operation
    38  func (a *ChartRemove) Run(out io.Writer, ref string) error {
    39  	r, err := registry.ParseReference(ref)
    40  	if err != nil {
    41  		return err
    42  	}
    43  	return a.cfg.RegistryClient.RemoveChart(r)
    44  }