Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions cmd/rbac/rbac_describe_subjects.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@ func RunDescribeSubjectsCommand(args *DescribeSubjectsArgs) di.CmdWithApiFn {
if cli.IsJson() {
cli.Printer.PrintJson(map[string]interface{}{
"handle": subject.Handle,
"source": subject.Source,
})
} else {
cli.Printer.Table(printer.TableData{
Header: []string{"Subject"},
Header: []string{"Subject", "Source"},
Data: [][]interface{}{
{
subject.Handle,
subject.Source,
},
},
MissingTableDataMsg: printer.NotFoundMsg{Types: "matching subjects"},
Expand All @@ -70,11 +72,11 @@ func RunDescribeSubjectsCommand(args *DescribeSubjectsArgs) di.CmdWithApiFn {
data := make([][]interface{}, 0)

for _, subject := range subjects {
data = append(data, []interface{}{subject.Handle})
data = append(data, []interface{}{subject.Handle, subject.Source})
}

cli.Printer.Table(printer.TableData{
Header: []string{"Subject"},
Header: []string{"Subject", "Source"},
Data: data,
MissingTableDataMsg: printer.NotFoundMsg{Types: "subjects"},
})
Expand Down
17 changes: 11 additions & 6 deletions cmd/rbac/rbac_describe_subjects_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,19 @@ var (
SomeScopeVar = SomeScope
SubjectConfig1 = stackstate_api.SubjectConfig{
Handle: SomeSubject,
Source: stackstate_api.SUBJECTSOURCE_OBSERVABILITY,
}

SomeOtherSubject = "handle"

SubjectConfig2 = stackstate_api.SubjectConfig{
Handle: SomeOtherSubject,
Source: stackstate_api.SUBJECTSOURCE_OBSERVABILITY,
}

SubjectConfig3 = stackstate_api.SubjectConfig{
Handle: SubjectHandle,
Source: stackstate_api.SUBJECTSOURCE_OBSERVABILITY,
}
)

Expand All @@ -43,11 +46,11 @@ func TestDescribeSubjectsTable(t *testing.T) {

expected := []printer.TableData{
{
Header: []string{"Subject"},
Header: []string{"Subject", "Source"},
Data: [][]interface{}{
{SubjectConfig1.Handle},
{SubjectConfig2.Handle},
{SubjectConfig3.Handle},
{SubjectConfig1.Handle, SubjectConfig1.Source},
{SubjectConfig2.Handle, SubjectConfig1.Source},
{SubjectConfig3.Handle, SubjectConfig1.Source},
},
MissingTableDataMsg: printer.NotFoundMsg{Types: "subjects"},
},
Expand Down Expand Up @@ -96,9 +99,9 @@ func TestDescribeSubjectsTableWithFilter(t *testing.T) {

expected := []printer.TableData{
{
Header: []string{"Subject"},
Header: []string{"Subject", "Source"},
Data: [][]interface{}{
{SubjectConfig1.Handle},
{SubjectConfig1.Handle, SubjectConfig1.Source},
},
MissingTableDataMsg: printer.NotFoundMsg{Types: "matching subjects"},
},
Expand Down Expand Up @@ -127,9 +130,11 @@ func TestDescribeSubjectsJsonWithFilter(t *testing.T) {
expectedJson := []map[string]interface{}{
{
"handle": SubjectConfig1.Handle,
"source": SubjectConfig3.Source,
},
{
"handle": SubjectConfig3.Handle,
"source": SubjectConfig3.Source,
},
}

Expand Down
2 changes: 2 additions & 0 deletions generated/stackstate_api/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ docs/SubStreamList.md
docs/SubStreamListItem.md
docs/SubjectApi.md
docs/SubjectConfig.md
docs/SubjectSource.md
docs/Subscription.md
docs/SubscriptionApi.md
docs/SubscriptionState.md
Expand Down Expand Up @@ -791,6 +792,7 @@ model_string_items_with_total.go
model_sub_stream_list.go
model_sub_stream_list_item.go
model_subject_config.go
model_subject_source.go
model_subscription.go
model_subscription_state.go
model_suggestions.go
Expand Down
1 change: 1 addition & 0 deletions generated/stackstate_api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,7 @@ Class | Method | HTTP request | Description
- [SubStreamList](docs/SubStreamList.md)
- [SubStreamListItem](docs/SubStreamListItem.md)
- [SubjectConfig](docs/SubjectConfig.md)
- [SubjectSource](docs/SubjectSource.md)
- [Subscription](docs/Subscription.md)
- [SubscriptionState](docs/SubscriptionState.md)
- [Suggestions](docs/Suggestions.md)
Expand Down
12 changes: 11 additions & 1 deletion generated/stackstate_api/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3815,7 +3815,7 @@ paths:
tags:
- subject
get:
description: Describe a subject and its scope
description: Describe a subject
operationId: getSubject
parameters:
- in: path
Expand Down Expand Up @@ -10690,12 +10690,22 @@ components:
SubjectConfig:
example:
handle: handle
source: null
properties:
handle:
type: string
source:
$ref: '#/components/schemas/SubjectSource'
required:
- handle
- source
type: object
SubjectSource:
enum:
- Static
- Observability
- Kubernetes
type: string
CreateSubject:
example:
query: query
Expand Down
4 changes: 2 additions & 2 deletions generated/stackstate_api/api_subject.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 22 additions & 1 deletion generated/stackstate_api/docs/SubjectConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Handle** | **string** | |
**Source** | [**SubjectSource**](SubjectSource.md) | |

## Methods

### NewSubjectConfig

`func NewSubjectConfig(handle string, ) *SubjectConfig`
`func NewSubjectConfig(handle string, source SubjectSource, ) *SubjectConfig`

NewSubjectConfig instantiates a new SubjectConfig object
This constructor will assign default values to properties that have it defined,
Expand Down Expand Up @@ -45,6 +46,26 @@ and a boolean to check if the value has been set.
SetHandle sets Handle field to given value.


### GetSource

`func (o *SubjectConfig) GetSource() SubjectSource`

GetSource returns the Source field if non-nil, zero value otherwise.

### GetSourceOk

`func (o *SubjectConfig) GetSourceOk() (*SubjectSource, bool)`

GetSourceOk returns a tuple with the Source field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetSource

`func (o *SubjectConfig) SetSource(v SubjectSource)`

SetSource sets Source field to given value.



[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Expand Down
15 changes: 15 additions & 0 deletions generated/stackstate_api/docs/SubjectSource.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# SubjectSource

## Enum


* `STATIC` (value: `"Static"`)

* `OBSERVABILITY` (value: `"Observability"`)

* `KUBERNETES` (value: `"Kubernetes"`)


[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


33 changes: 31 additions & 2 deletions generated/stackstate_api/model_subject_config.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

113 changes: 113 additions & 0 deletions generated/stackstate_api/model_subject_source.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion stackstate_openapi/openapi_version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2b2b1e8d257a43a927e8f84591f5631bbb5b4a8f
3e7ca840dfb06920cbffa0b7f70130d6b17e0721
Loading