Skip to content

Commit

Permalink
Merge branch 'master'
Browse files Browse the repository at this point in the history
  • Loading branch information
brianstrauch committed Jul 28, 2021
2 parents 445c554 + 8db1613 commit 7622de9
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 40 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ require (
github.com/spf13/viper v1.7.1
github.com/stretchr/testify v1.7.0
github.com/stripe/stripe-go v70.15.0+incompatible
github.com/tidwall/gjson v1.6.0
github.com/tidwall/pretty v1.0.0
github.com/tidwall/gjson v1.6.5
github.com/tidwall/pretty v1.0.2
github.com/tidwall/sjson v1.0.4
github.com/travisjeffery/mocker v1.1.0
github.com/xeipuuv/gojsonschema v1.2.0
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1235,12 +1235,12 @@ github.com/tdakkota/asciicheck v0.0.0-20200416190851-d7f85be797a2/go.mod h1:yHp0
github.com/testcontainers/testcontainers-go v0.0.9/go.mod h1:0Qe9qqjNZgxHzzdHPWwmQ2D49FFO7920hLdJ4yUJXJI=
github.com/tetafro/godot v0.4.8 h1:h61+hQraWhdI6WYqMwAwZYCE5yxL6a9/Orw4REbabSU=
github.com/tetafro/godot v0.4.8/go.mod h1:/7NLHhv08H1+8DNj0MElpAACw1ajsCuf3TKNQxA5S+0=
github.com/tidwall/gjson v1.6.0 h1:9VEQWz6LLMUsUl6PueE49ir4Ka6CzLymOAZDxpFsTDc=
github.com/tidwall/gjson v1.6.0/go.mod h1:P256ACg0Mn+j1RXIDXoss50DeIABTYK1PULOJHhxOls=
github.com/tidwall/match v1.0.1 h1:PnKP62LPNxHKTwvHHZZzdOAOCtsJTjo6dZLCwpKm5xc=
github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E=
github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4=
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
github.com/tidwall/gjson v1.6.5 h1:P/K9r+1pt9AK54uap7HcoIp6T3a7AoMg3v18tUis+Cg=
github.com/tidwall/gjson v1.6.5/go.mod h1:zeFuBCIqD4sN/gmqBzZ4j7Jd6UcA2Fc56x7QFsv+8fI=
github.com/tidwall/match v1.0.3 h1:FQUVvBImDutD8wJLN6c5eMzWtjgONK9MwIBCOrUJKeE=
github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.0.2 h1:Z7S3cePv9Jwm1KwS0513MRaoUe3S01WPbLNV40pwWZU=
github.com/tidwall/pretty v1.0.2/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
github.com/tidwall/sjson v1.0.4 h1:UcdIRXff12Lpnu3OLtZvnc03g4vH2suXDXhBwBqmzYg=
github.com/tidwall/sjson v1.0.4/go.mod h1:bURseu1nuBkFpIES5cz6zBtjmYeOQmEESshn7VpF15Y=
github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e h1:RumXZ56IrCj4CL+g1b9OL/oH0QnsF976bC8xQFYUD5Q=
Expand Down
14 changes: 5 additions & 9 deletions internal/cmd/kafka/command_acl.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,6 @@ func (c *aclCommand) create(cmd *cobra.Command, _ []string) error {
if err != nil {
return err
}
IdMap, err := getUserIdMap(c.Client)
if err != nil {
return err
}

var bindings []*schedv1.ACLBinding
for _, acl := range acls {
Expand Down Expand Up @@ -197,21 +193,21 @@ func (c *aclCommand) create(cmd *cobra.Command, _ []string) error {
break
}
// i > 0: unlikely
_ = aclutil.PrintACLsWithMap(cmd, bindings[:i], os.Stdout, IdMap)
_ = aclutil.PrintACLs(cmd, bindings[:i], os.Stdout)
return kafkaRestError(kafkaREST.Client.GetConfig().BasePath, err, httpResp)
}

if err != nil {
if i > 0 {
// unlikely
_ = aclutil.PrintACLsWithMap(cmd, bindings[:i], os.Stdout, IdMap)
_ = aclutil.PrintACLs(cmd, bindings[:i], os.Stdout)
}
return kafkaRestError(kafkaREST.Client.GetConfig().BasePath, err, httpResp)
}

if httpResp != nil && httpResp.StatusCode != http.StatusCreated {
if i > 0 {
_ = aclutil.PrintACLsWithMap(cmd, bindings[:i], os.Stdout, IdMap)
_ = aclutil.PrintACLs(cmd, bindings[:i], os.Stdout)
}
return errors.NewErrorWithSuggestions(
fmt.Sprintf(errors.KafkaRestUnexpectedStatusMsg, httpResp.Request.URL, httpResp.StatusCode),
Expand All @@ -220,7 +216,7 @@ func (c *aclCommand) create(cmd *cobra.Command, _ []string) error {
}

if kafkaRestExists {
return aclutil.PrintACLsWithMap(cmd, bindings, os.Stdout, IdMap)
return aclutil.PrintACLs(cmd, bindings, os.Stdout)
}
}

Expand All @@ -236,7 +232,7 @@ func (c *aclCommand) create(cmd *cobra.Command, _ []string) error {
return err
}

return aclutil.PrintACLsWithMap(cmd, bindings, os.Stdout, IdMap)
return aclutil.PrintACLs(cmd, bindings, os.Stdout)
}

func (c *aclCommand) delete(cmd *cobra.Command, _ []string) error {
Expand Down
34 changes: 17 additions & 17 deletions internal/pkg/acl/acl.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ func PrintACLs(cmd *cobra.Command, bindingsObj []*schedv1.ACLBinding, writer io.
cmd.Flags().StringP(output.FlagName, output.ShortHandFlag, output.DefaultValue, output.Usage)
}

aclListFields := []string{"ServiceAccountId", "Permission", "Operation", "ResourceType", "ResourceName", "PatternType"}
aclListStructuredRenames := []string{"service_account_id", "permission", "operation", "resource_type", "resource_name", "pattern_type"}
aclListFields := []string{"ServiceAccountId", "Permission", "Operation", "Resource", "Name", "Type"}
aclListStructuredRenames := []string{"service_account_id", "permission", "operation", "resource", "name", "type"}
outputWriter, err := output.NewListOutputCustomizableWriter(cmd, aclListFields, aclListFields, aclListStructuredRenames, writer)
if err != nil {
return err
Expand All @@ -92,9 +92,9 @@ func PrintACLs(cmd *cobra.Command, bindingsObj []*schedv1.ACLBinding, writer io.
ServiceAccountId string
Permission string
Operation string
ResourceType string
ResourceName string
PatternType string
Resource string
Name string
Type string
}{
binding.Entry.Principal,
binding.Entry.PermissionType.String(),
Expand Down Expand Up @@ -345,8 +345,8 @@ func PrintACLsFromKafkaRestResponseWithMap(cmd *cobra.Command, aclGetResp kafkar
cmd.Flags().StringP(output.FlagName, output.ShortHandFlag, output.DefaultValue, output.Usage)
}

aclListFields := []string{"Principal", "ServiceAccountId", "Permission", "Operation", "ResourceType", "ResourceName", "PatternType"}
aclListStructuredRenames := []string{"principal", "service_account_id", "permission", "operation", "resource_type", "resource_name", "pattern_type"}
aclListFields := []string{"UserId", "ServiceAccountId", "Permission", "Operation", "Resource", "Name", "Type"}
aclListStructuredRenames := []string{"user_id", "service_account_id", "permission", "operation", "resource", "name", "type"}
outputWriter, err := output.NewListOutputCustomizableWriter(cmd, aclListFields, aclListFields, aclListStructuredRenames, writer)
if err != nil {
return err
Expand All @@ -363,13 +363,13 @@ func PrintACLsFromKafkaRestResponseWithMap(cmd *cobra.Command, aclGetResp kafkar
}
}
record := &struct {
Principal string
UserId string
ServiceAccountId string
Permission string
Operation string
ResourceType string
ResourceName string
PatternType string
Resource string
Name string
Type string
}{
aclData.Principal,
resourceId,
Expand All @@ -392,8 +392,8 @@ func PrintACLsWithMap(cmd *cobra.Command, bindingsObj []*schedv1.ACLBinding, wri
cmd.Flags().StringP(output.FlagName, output.ShortHandFlag, output.DefaultValue, output.Usage)
}

aclListFields := []string{"Principal", "ServiceAccountId", "Permission", "Operation", "ResourceType", "ResourceName", "PatternType"}
aclListStructuredRenames := []string{"principal", "service_account_id", "permission", "operation", "resource_type", "resource_name", "pattern_type"}
aclListFields := []string{"UserId", "ServiceAccountId", "Permission", "Operation", "Resource", "Name", "Type"}
aclListStructuredRenames := []string{"user_id", "service_account_id", "permission", "operation", "resource", "name", "type"}
outputWriter, err := output.NewListOutputCustomizableWriter(cmd, aclListFields, aclListFields, aclListStructuredRenames, writer)
if err != nil {
return err
Expand All @@ -410,13 +410,13 @@ func PrintACLsWithMap(cmd *cobra.Command, bindingsObj []*schedv1.ACLBinding, wri
}
}
record := &struct {
Principal string
UserId string
ServiceAccountId string
Permission string
Operation string
ResourceType string
ResourceName string
PatternType string
Resource string
Name string
Type string
}{
binding.Entry.Principal,
resourceId,
Expand Down
12 changes: 9 additions & 3 deletions mk-files/Dockerfile_ccloud
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
FROM alpine:latest

RUN apk update --no-cache && \
apk add --no-cache curl
apk add --no-cache curl && \
apk add --no-cache bash && \
apk add --no-cache bash-completion

RUN curl -L --http1.1 https://cnfl.io/ccloud-cli | sh -s -- -b .
RUN curl -L --http1.1 https://cnfl.io/ccloud-cli | sh -s -- -b /bin

RUN chmod +x ccloud
RUN chmod +x /bin/ccloud

# This symbolic link exists for backwards compatibility reasons
RUN ln -s /bin/ccloud /ccloud

RUN mkdir /etc/bash_completion.d && ccloud completion bash > /etc/bash_completion.d/ccloud
12 changes: 9 additions & 3 deletions mk-files/Dockerfile_confluent
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
FROM alpine:latest

RUN apk update --no-cache && \
apk add --no-cache curl
apk add --no-cache curl && \
apk add --no-cache bash && \
apk add --no-cache bash-completion

RUN curl -L --http1.1 https://cnfl.io/cli | sh -s -- -b .
RUN curl -L --http1.1 https://cnfl.io/cli | sh -s -- -b /bin

RUN chmod +x confluent
RUN chmod +x /bin/confluent

# This symbolic link exists for backwards compatibility reasons
RUN ln -s /bin/confluent /confluent

RUN mkdir /etc/bash_completion.d && confluent completion bash > /etc/bash_completion.d/confluent

0 comments on commit 7622de9

Please sign in to comment.