diff --git a/cmd/rbac/rbac_describe_subjects.go b/cmd/rbac/rbac_describe_subjects.go index 7a9b6586..8b99d4af 100644 --- a/cmd/rbac/rbac_describe_subjects.go +++ b/cmd/rbac/rbac_describe_subjects.go @@ -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"}, @@ -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"}, }) diff --git a/cmd/rbac/rbac_describe_subjects_test.go b/cmd/rbac/rbac_describe_subjects_test.go index b57402ba..3e059fe1 100644 --- a/cmd/rbac/rbac_describe_subjects_test.go +++ b/cmd/rbac/rbac_describe_subjects_test.go @@ -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, } ) @@ -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"}, }, @@ -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"}, }, @@ -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, }, } diff --git a/generated/stackstate_api/.openapi-generator/FILES b/generated/stackstate_api/.openapi-generator/FILES index 69d42fac..345d1aac 100644 --- a/generated/stackstate_api/.openapi-generator/FILES +++ b/generated/stackstate_api/.openapi-generator/FILES @@ -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 @@ -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 diff --git a/generated/stackstate_api/README.md b/generated/stackstate_api/README.md index 711d5db3..fe185961 100644 --- a/generated/stackstate_api/README.md +++ b/generated/stackstate_api/README.md @@ -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) diff --git a/generated/stackstate_api/api/openapi.yaml b/generated/stackstate_api/api/openapi.yaml index 7e8b8372..132d34fb 100644 --- a/generated/stackstate_api/api/openapi.yaml +++ b/generated/stackstate_api/api/openapi.yaml @@ -3815,7 +3815,7 @@ paths: tags: - subject get: - description: Describe a subject and its scope + description: Describe a subject operationId: getSubject parameters: - in: path @@ -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 diff --git a/generated/stackstate_api/api_subject.go b/generated/stackstate_api/api_subject.go index bcb350bc..ee34ea9e 100644 --- a/generated/stackstate_api/api_subject.go +++ b/generated/stackstate_api/api_subject.go @@ -53,7 +53,7 @@ type SubjectApi interface { /* GetSubject Get subject - Describe a subject and its scope + Describe a subject @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param subject @@ -413,7 +413,7 @@ func (r ApiGetSubjectRequest) Execute() (*SubjectConfig, *http.Response, error) /* GetSubject Get subject -Describe a subject and its scope +Describe a subject @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param subject diff --git a/generated/stackstate_api/docs/SubjectConfig.md b/generated/stackstate_api/docs/SubjectConfig.md index f3212c8d..08fbf199 100644 --- a/generated/stackstate_api/docs/SubjectConfig.md +++ b/generated/stackstate_api/docs/SubjectConfig.md @@ -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, @@ -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) diff --git a/generated/stackstate_api/docs/SubjectSource.md b/generated/stackstate_api/docs/SubjectSource.md new file mode 100644 index 00000000..443c4549 --- /dev/null +++ b/generated/stackstate_api/docs/SubjectSource.md @@ -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) + + diff --git a/generated/stackstate_api/model_subject_config.go b/generated/stackstate_api/model_subject_config.go index 1dab807e..7db7453c 100644 --- a/generated/stackstate_api/model_subject_config.go +++ b/generated/stackstate_api/model_subject_config.go @@ -17,16 +17,18 @@ import ( // SubjectConfig struct for SubjectConfig type SubjectConfig struct { - Handle string `json:"handle"` + Handle string `json:"handle"` + Source SubjectSource `json:"source"` } // NewSubjectConfig instantiates a new SubjectConfig object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewSubjectConfig(handle string) *SubjectConfig { +func NewSubjectConfig(handle string, source SubjectSource) *SubjectConfig { this := SubjectConfig{} this.Handle = handle + this.Source = source return &this } @@ -62,11 +64,38 @@ func (o *SubjectConfig) SetHandle(v string) { o.Handle = v } +// GetSource returns the Source field value +func (o *SubjectConfig) GetSource() SubjectSource { + if o == nil { + var ret SubjectSource + return ret + } + + return o.Source +} + +// GetSourceOk returns a tuple with the Source field value +// and a boolean to check if the value has been set. +func (o *SubjectConfig) GetSourceOk() (*SubjectSource, bool) { + if o == nil { + return nil, false + } + return &o.Source, true +} + +// SetSource sets field value +func (o *SubjectConfig) SetSource(v SubjectSource) { + o.Source = v +} + func (o SubjectConfig) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if true { toSerialize["handle"] = o.Handle } + if true { + toSerialize["source"] = o.Source + } return json.Marshal(toSerialize) } diff --git a/generated/stackstate_api/model_subject_source.go b/generated/stackstate_api/model_subject_source.go new file mode 100644 index 00000000..7c20b9fc --- /dev/null +++ b/generated/stackstate_api/model_subject_source.go @@ -0,0 +1,113 @@ +/* +StackState API + +This API documentation page describes the StackState server API. The StackState UI and CLI use the StackState server API to configure and query StackState. You can use the API for similar purposes. Each request sent to the StackState server API must be authenticated using one of the available authentication methods. *Note that the StackState receiver API, used to send topology, telemetry and traces to StackState, is not described on this page and requires a different authentication method.* For more information on StackState, refer to the [StackState documentation](https://docs.stackstate.com). + +API version: 5.2.0 +Contact: info@stackstate.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package stackstate_api + +import ( + "encoding/json" + "fmt" +) + +// SubjectSource the model 'SubjectSource' +type SubjectSource string + +// List of SubjectSource +const ( + SUBJECTSOURCE_STATIC SubjectSource = "Static" + SUBJECTSOURCE_OBSERVABILITY SubjectSource = "Observability" + SUBJECTSOURCE_KUBERNETES SubjectSource = "Kubernetes" +) + +// All allowed values of SubjectSource enum +var AllowedSubjectSourceEnumValues = []SubjectSource{ + "Static", + "Observability", + "Kubernetes", +} + +func (v *SubjectSource) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := SubjectSource(value) + for _, existing := range AllowedSubjectSourceEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid SubjectSource", value) +} + +// NewSubjectSourceFromValue returns a pointer to a valid SubjectSource +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewSubjectSourceFromValue(v string) (*SubjectSource, error) { + ev := SubjectSource(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for SubjectSource: valid values are %v", v, AllowedSubjectSourceEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v SubjectSource) IsValid() bool { + for _, existing := range AllowedSubjectSourceEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SubjectSource value +func (v SubjectSource) Ptr() *SubjectSource { + return &v +} + +type NullableSubjectSource struct { + value *SubjectSource + isSet bool +} + +func (v NullableSubjectSource) Get() *SubjectSource { + return v.value +} + +func (v *NullableSubjectSource) Set(val *SubjectSource) { + v.value = val + v.isSet = true +} + +func (v NullableSubjectSource) IsSet() bool { + return v.isSet +} + +func (v *NullableSubjectSource) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSubjectSource(val *SubjectSource) *NullableSubjectSource { + return &NullableSubjectSource{value: val, isSet: true} +} + +func (v NullableSubjectSource) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSubjectSource) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/stackstate_openapi/openapi_version b/stackstate_openapi/openapi_version index afc78e84..4f66fe79 100644 --- a/stackstate_openapi/openapi_version +++ b/stackstate_openapi/openapi_version @@ -1 +1 @@ -2b2b1e8d257a43a927e8f84591f5631bbb5b4a8f +3e7ca840dfb06920cbffa0b7f70130d6b17e0721