Skip to content

Commit

Permalink
Delete unused models, error and util functions
Browse files Browse the repository at this point in the history
[#152081799] Delete unused cli code

Signed-off-by: Iryna Shustava <[email protected]>
  • Loading branch information
Edie Beer authored and Pivotal committed Oct 18, 2017
1 parent 3da6ddc commit 83db856
Show file tree
Hide file tree
Showing 18 changed files with 7 additions and 199 deletions.
2 changes: 1 addition & 1 deletion commands/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
func initializeCredhubClient(cfg config.Config) (*credhub.CredHub, error) {
var credhubClient *credhub.CredHub

err = config.ValidateConfig(cfg)
err := config.ValidateConfig(cfg)
if err != nil {
if !clientCredentialsInEnvironment() || config.ValidateConfigApi(cfg) != nil {
return nil, err
Expand Down
10 changes: 3 additions & 7 deletions commands/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,15 @@ type ImportCommand struct {
File string `short:"f" long:"file" description:"File containing credentials to import" required:"true"`
}

var (
err error
bulkImport models.CredentialBulkImport
)

func (cmd ImportCommand) Execute([]string) error {
err = bulkImport.ReadFile(cmd.File)
var bulkImport models.CredentialBulkImport
err := bulkImport.ReadFile(cmd.File)

if err != nil {
return err
}

err := setCredentials(bulkImport)
err = setCredentials(bulkImport)

return err
}
Expand Down
2 changes: 1 addition & 1 deletion commands/logout.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func RevokeTokenIfNecessary(cfg config.Config) {
Client: client.NewHttpClient(cfg),
}

err = uaaClient.RevokeToken(cfg.AccessToken)
uaaClient.RevokeToken(cfg.AccessToken)
}

func MarkTokensAsRevokedInConfig(cfg *config.Config) {
Expand Down
2 changes: 1 addition & 1 deletion commands/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func init() {

authObject := credhubClient.Auth
oauth := authObject.(*auth.OAuthStrategy)
err = oauth.Refresh()
err := oauth.Refresh()

if err != nil {
fmt.Println("Bearer " + cfg.AccessToken)
Expand Down
12 changes: 0 additions & 12 deletions errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ func NewNetworkError(e error) error {
return errors.New(fmt.Sprintf("Error connecting to the targeted API: %#v. Please validate your target and retry your request.", e.Error()))
}

func NewResponseError() error {
return errors.New("An error occurred when processing the response. Please validate your input and retry your request.")
}

func NewCatchAllError() error {
return errors.New("The targeted API was unable to perform the request. Please validate and retry your request.")
}
Expand Down Expand Up @@ -50,18 +46,10 @@ func NewRefreshError() error {
return errors.New("You are not currently authenticated. Please log in to continue.")
}

func NewForbiddenError() error {
return errors.New("You are not authorized to perform this action. You must log in with an elevated user or contact your administrator to continue.")
}

func NewNoMatchingCredentialsFoundError() error {
return errors.New("No credentials exist which match the provided parameters.")
}

func NewAccessTokenExpiredError() error {
return errors.New("JWT access token expired")
}

func NewSetEmptyTypeError() error {
return errors.New("A type must be specified when setting a credential. Valid types include 'value', 'json', 'password', 'user', 'certificate', 'ssh' and 'rsa'.")
}
Expand Down
8 changes: 0 additions & 8 deletions models/certificate.go

This file was deleted.

21 changes: 0 additions & 21 deletions models/credential_response.go

This file was deleted.

40 changes: 0 additions & 40 deletions models/credential_response_test.go

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
package models

type GenerateRequest struct {
Name string `json:"name"`
CredentialType string `json:"type"`
Overwrite *bool `json:"overwrite"`
Parameters *GenerationParameters `json:"parameters"`
}

type GenerationParameters struct {
IncludeSpecial bool `json:"include_special,omitempty"`
ExcludeNumber bool `json:"exclude_number,omitempty"`
Expand All @@ -29,4 +22,4 @@ type GenerationParameters struct {
IsCA bool `json:"is_ca,omitempty"`
SshComment string `json:"ssh_comment,omitempty"`
Username string `json:"username,omitempty"`
}
}
16 changes: 0 additions & 16 deletions models/info.go

This file was deleted.

18 changes: 0 additions & 18 deletions models/printable.go

This file was deleted.

6 changes: 0 additions & 6 deletions models/regenerate_request.go

This file was deleted.

10 changes: 0 additions & 10 deletions models/request_body.go

This file was deleted.

6 changes: 0 additions & 6 deletions models/rsa-ssh.go

This file was deleted.

6 changes: 0 additions & 6 deletions models/server_error.go

This file was deleted.

16 changes: 0 additions & 16 deletions models/token.go

This file was deleted.

6 changes: 0 additions & 6 deletions models/user.go

This file was deleted.

16 changes: 0 additions & 16 deletions util/string_util.go

This file was deleted.

0 comments on commit 83db856

Please sign in to comment.