From 2860eb52d0e94754c686941e55fa45ddb7c10653 Mon Sep 17 00:00:00 2001 From: Andreas Christou Date: Thu, 9 Jan 2025 11:33:47 +0000 Subject: [PATCH 1/7] Azure: Improve Azure Prometheus exemplars UI/UX (#97198) * Add better error messaging - Ensure it's clear to users what action needs to be taken if an operation ID cannot be found - Add test * Display resource picker for trace exemplar queries * Remove unneeded test * Update tests --- .../azure-log-analytics-datasource.go | 3 + .../azuremonitor/loganalytics/traces_test.go | 57 +++++++++++++----- .../QueryEditor/QueryEditor.test.tsx | 33 +++++++++- .../components/QueryEditor/QueryEditor.tsx | 12 +++- .../QueryEditor/usePreparedQuery.ts | 15 +++-- .../TracesQueryEditor.test.tsx | 55 ----------------- .../TracesQueryEditor/TracesQueryEditor.tsx | 60 +++++++++---------- 7 files changed, 126 insertions(+), 109 deletions(-) diff --git a/pkg/tsdb/azuremonitor/loganalytics/azure-log-analytics-datasource.go b/pkg/tsdb/azuremonitor/loganalytics/azure-log-analytics-datasource.go index 93db9a8ebbd..c8c9592804f 100644 --- a/pkg/tsdb/azuremonitor/loganalytics/azure-log-analytics-datasource.go +++ b/pkg/tsdb/azuremonitor/loganalytics/azure-log-analytics-datasource.go @@ -625,6 +625,9 @@ func getCorrelationWorkspaces(ctx context.Context, baseResource string, resource }() if res.StatusCode/100 != 2 { + if res.StatusCode == 404 { + return AzureCorrelationAPIResponse{}, backend.DownstreamError(fmt.Errorf("requested trace not found by Application Insights indexing. Select the relevant Application Insights resource to search for the Operation ID directly")) + } return AzureCorrelationAPIResponse{}, utils.CreateResponseErrorFromStatusCode(res.StatusCode, res.Status, body) } var data AzureCorrelationAPIResponse diff --git a/pkg/tsdb/azuremonitor/loganalytics/traces_test.go b/pkg/tsdb/azuremonitor/loganalytics/traces_test.go index c93bcc26703..7854bd880f3 100644 --- a/pkg/tsdb/azuremonitor/loganalytics/traces_test.go +++ b/pkg/tsdb/azuremonitor/loganalytics/traces_test.go @@ -26,6 +26,10 @@ func TestBuildAppInsightsQuery(t *testing.T) { ctx := context.Background() svr := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") + if strings.Contains(r.URL.Path, "missing-op-id") { + w.WriteHeader(http.StatusNotFound) + return + } w.WriteHeader(http.StatusOK) var correlationRes AzureCorrelationAPIResponse if strings.Contains(r.URL.Path, "test-op-id") { @@ -95,7 +99,7 @@ func TestBuildAppInsightsQuery(t *testing.T) { tests := []struct { name string queryModel backend.DataQuery - azureLogAnalyticsQuery AzureLogAnalyticsQuery + azureLogAnalyticsQuery *AzureLogAnalyticsQuery Err require.ErrorAssertionFunc }{ { @@ -114,7 +118,7 @@ func TestBuildAppInsightsQuery(t *testing.T) { TimeRange: timeRange, QueryType: string(dataquery.AzureQueryTypeAzureTraces), }, - azureLogAnalyticsQuery: AzureLogAnalyticsQuery{ + azureLogAnalyticsQuery: &AzureLogAnalyticsQuery{ RefID: "A", ResultFormat: dataquery.ResultFormatTable, URL: "v1/apps/r1/query", @@ -190,7 +194,7 @@ func TestBuildAppInsightsQuery(t *testing.T) { TimeRange: timeRange, QueryType: string(dataquery.AzureQueryTypeAzureTraces), }, - azureLogAnalyticsQuery: AzureLogAnalyticsQuery{ + azureLogAnalyticsQuery: &AzureLogAnalyticsQuery{ RefID: "A", ResultFormat: dataquery.ResultFormatTable, URL: "v1/apps/r1/query", @@ -264,7 +268,7 @@ func TestBuildAppInsightsQuery(t *testing.T) { TimeRange: timeRange, QueryType: string(dataquery.AzureQueryTypeAzureTraces), }, - azureLogAnalyticsQuery: AzureLogAnalyticsQuery{ + azureLogAnalyticsQuery: &AzureLogAnalyticsQuery{ RefID: "A", ResultFormat: dataquery.ResultFormatTable, URL: "v1/apps/r1/query", @@ -337,7 +341,7 @@ func TestBuildAppInsightsQuery(t *testing.T) { TimeRange: timeRange, QueryType: string(dataquery.AzureQueryTypeAzureTraces), }, - azureLogAnalyticsQuery: AzureLogAnalyticsQuery{ + azureLogAnalyticsQuery: &AzureLogAnalyticsQuery{ RefID: "A", ResultFormat: dataquery.ResultFormatTable, URL: "v1/apps/r1/query", @@ -413,7 +417,7 @@ func TestBuildAppInsightsQuery(t *testing.T) { TimeRange: timeRange, QueryType: string(dataquery.AzureQueryTypeAzureTraces), }, - azureLogAnalyticsQuery: AzureLogAnalyticsQuery{ + azureLogAnalyticsQuery: &AzureLogAnalyticsQuery{ RefID: "A", ResultFormat: dataquery.ResultFormatTable, URL: "v1/apps/r1/query", @@ -493,7 +497,7 @@ func TestBuildAppInsightsQuery(t *testing.T) { TimeRange: timeRange, QueryType: string(dataquery.AzureQueryTypeAzureTraces), }, - azureLogAnalyticsQuery: AzureLogAnalyticsQuery{ + azureLogAnalyticsQuery: &AzureLogAnalyticsQuery{ RefID: "A", ResultFormat: dataquery.ResultFormatTable, URL: "v1/apps/r1/query", @@ -573,7 +577,7 @@ func TestBuildAppInsightsQuery(t *testing.T) { TimeRange: timeRange, QueryType: string(dataquery.AzureQueryTypeAzureTraces), }, - azureLogAnalyticsQuery: AzureLogAnalyticsQuery{ + azureLogAnalyticsQuery: &AzureLogAnalyticsQuery{ RefID: "A", ResultFormat: dataquery.ResultFormatTable, URL: "v1/apps/r1/query", @@ -651,7 +655,7 @@ func TestBuildAppInsightsQuery(t *testing.T) { TimeRange: timeRange, QueryType: string(dataquery.AzureQueryTypeAzureTraces), }, - azureLogAnalyticsQuery: AzureLogAnalyticsQuery{ + azureLogAnalyticsQuery: &AzureLogAnalyticsQuery{ RefID: "A", ResultFormat: dataquery.ResultFormatTrace, URL: "v1/apps/r1/query", @@ -724,7 +728,7 @@ func TestBuildAppInsightsQuery(t *testing.T) { TimeRange: timeRange, QueryType: string(dataquery.AzureQueryTypeAzureTraces), }, - azureLogAnalyticsQuery: AzureLogAnalyticsQuery{ + azureLogAnalyticsQuery: &AzureLogAnalyticsQuery{ RefID: "A", ResultFormat: dataquery.ResultFormatTrace, URL: "v1/apps/r1/query", @@ -800,7 +804,7 @@ func TestBuildAppInsightsQuery(t *testing.T) { TimeRange: timeRange, QueryType: string(dataquery.AzureQueryTypeAzureTraces), }, - azureLogAnalyticsQuery: AzureLogAnalyticsQuery{ + azureLogAnalyticsQuery: &AzureLogAnalyticsQuery{ RefID: "A", ResultFormat: dataquery.ResultFormatTrace, URL: "v1/apps/r1/query", @@ -842,7 +846,7 @@ func TestBuildAppInsightsQuery(t *testing.T) { TimeRange: timeRange, QueryType: string(dataquery.AzureQueryTypeAzureTraces), }, - azureLogAnalyticsQuery: AzureLogAnalyticsQuery{ + azureLogAnalyticsQuery: &AzureLogAnalyticsQuery{ RefID: "A", ResultFormat: dataquery.ResultFormatTrace, URL: "v1/apps/r1/query", @@ -920,7 +924,7 @@ func TestBuildAppInsightsQuery(t *testing.T) { TimeRange: timeRange, QueryType: string(dataquery.AzureQueryTypeAzureTraces), }, - azureLogAnalyticsQuery: AzureLogAnalyticsQuery{ + azureLogAnalyticsQuery: &AzureLogAnalyticsQuery{ RefID: "A", ResultFormat: dataquery.ResultFormatTrace, URL: "v1/apps/r1/query", @@ -997,7 +1001,7 @@ func TestBuildAppInsightsQuery(t *testing.T) { TimeRange: timeRange, QueryType: string(dataquery.AzureQueryTypeAzureTraces), }, - azureLogAnalyticsQuery: AzureLogAnalyticsQuery{ + azureLogAnalyticsQuery: &AzureLogAnalyticsQuery{ RefID: "A", ResultFormat: dataquery.ResultFormatTrace, URL: "v1/apps/r1/query", @@ -1076,7 +1080,7 @@ func TestBuildAppInsightsQuery(t *testing.T) { TimeRange: timeRange, QueryType: string(dataquery.AzureQueryTypeAzureTraces), }, - azureLogAnalyticsQuery: AzureLogAnalyticsQuery{ + azureLogAnalyticsQuery: &AzureLogAnalyticsQuery{ RefID: "A", ResultFormat: dataquery.ResultFormatTrace, URL: "v1/apps/r1/query", @@ -1147,13 +1151,34 @@ func TestBuildAppInsightsQuery(t *testing.T) { }, Err: require.NoError, }, + { + name: "trace query with missing operation ID", + queryModel: backend.DataQuery{ + JSON: []byte(fmt.Sprintf(`{ + "queryType": "Azure Traces", + "azureTraces": { + "resources": ["/subscriptions/test-sub/resourceGroups/test-rg/providers/Microsoft.Insights/components/r1"], + "resultFormat": "%s", + "traceTypes": ["trace"], + "operationId": "missing-op-id" + } + }`, dataquery.ResultFormatTable)), + RefID: "A", + TimeRange: timeRange, + QueryType: string(dataquery.AzureQueryTypeAzureTraces), + }, + azureLogAnalyticsQuery: nil, + Err: func(tt require.TestingT, err error, i ...interface{}) { + require.ErrorContains(tt, err, "requested trace not found by Application Insights indexing. Select the relevant Application Insights resource to search for the Operation ID directly") + }, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { query, err := buildAppInsightsQuery(ctx, tt.queryModel, dsInfo, appInsightsRegExp, log.NewNullLogger()) tt.Err(t, err) - if diff := cmp.Diff(&tt.azureLogAnalyticsQuery, query); diff != "" { + if diff := cmp.Diff(tt.azureLogAnalyticsQuery, query); diff != "" { t.Errorf("Result mismatch (-want +got): \n%s", diff) } }) diff --git a/public/app/plugins/datasource/azuremonitor/components/QueryEditor/QueryEditor.test.tsx b/public/app/plugins/datasource/azuremonitor/components/QueryEditor/QueryEditor.test.tsx index 18cd93f66da..8099a03cb02 100644 --- a/public/app/plugins/datasource/azuremonitor/components/QueryEditor/QueryEditor.test.tsx +++ b/public/app/plugins/datasource/azuremonitor/components/QueryEditor/QueryEditor.test.tsx @@ -8,8 +8,9 @@ import createMockDatasource from '../../__mocks__/datasource'; import { invalidNamespaceError } from '../../__mocks__/errors'; import createMockQuery from '../../__mocks__/query'; import { selectors } from '../../e2e/selectors'; -import { AzureQueryType } from '../../types'; +import { AzureQueryType, ResultFormat } from '../../types'; import { selectOptionInTest } from '../../utils/testUtils'; +import { createMockResourcePickerData } from '../MetricsQueryEditor/MetricsQueryEditor.test'; import QueryEditor from './QueryEditor'; @@ -204,4 +205,34 @@ describe('Azure Monitor QueryEditor', () => { expect(screen.getByTestId(selectors.components.queryEditor.userAuthFallbackAlert)).toBeInTheDocument() ); }); + + it('should display the default subscription for exemplar type queries', async () => { + const mockDatasource = createMockDatasource({ resourcePickerData: createMockResourcePickerData() }); + const defaultSubscriptionId = 'default-subscription-id'; + mockDatasource.azureLogAnalyticsDatasource.getDefaultOrFirstSubscription = jest + .fn() + .mockResolvedValue(defaultSubscriptionId); + const query = createMockQuery(); + delete query?.subscription; + delete query?.azureTraces; + query.queryType = AzureQueryType.TraceExemplar; + query.query = 'test-operation-id'; + const onChange = jest.fn(); + + render( {}} />); + + await waitFor(() => + expect(onChange).toHaveBeenCalledWith( + expect.objectContaining({ + azureTraces: { + operationId: query.query, + resultFormat: ResultFormat.Trace, + resources: [`/subscriptions/${defaultSubscriptionId}`], + }, + }) + ) + ); + await waitFor(() => expect(screen.getByText(defaultSubscriptionId)).toBeInTheDocument()); + expect(await screen.getByDisplayValue('test-operation-id')).toBeInTheDocument(); + }); }); diff --git a/public/app/plugins/datasource/azuremonitor/components/QueryEditor/QueryEditor.tsx b/public/app/plugins/datasource/azuremonitor/components/QueryEditor/QueryEditor.tsx index eaecfe57345..3061a5183fc 100644 --- a/public/app/plugins/datasource/azuremonitor/components/QueryEditor/QueryEditor.tsx +++ b/public/app/plugins/datasource/azuremonitor/components/QueryEditor/QueryEditor.tsx @@ -1,6 +1,7 @@ import { css } from '@emotion/css'; import { debounce } from 'lodash'; import { useCallback, useMemo, useState } from 'react'; +import { useEffectOnce } from 'react-use'; import { CoreApp, QueryEditorProps } from '@grafana/data'; import { config, reportInteraction } from '@grafana/runtime'; @@ -43,6 +44,7 @@ const QueryEditor = ({ const [errorMessage, setError] = useLastError(); const onRunQuery = useMemo(() => debounce(baseOnRunQuery, 500), [baseOnRunQuery]); const [azureLogsCheatSheetModalOpen, setAzureLogsCheatSheetModalOpen] = useState(false); + const [defaultSubscriptionId, setDefaultSubscriptionId] = useState(''); const onQueryChange = useCallback( (newQuery: AzureMonitorQuery) => { @@ -52,7 +54,15 @@ const QueryEditor = ({ [onChange, onRunQuery] ); - const query = usePreparedQuery(baseQuery, onQueryChange); + useEffectOnce(() => { + if (baseQuery.queryType === AzureQueryType.TraceExemplar) { + datasource.azureLogAnalyticsDatasource.getDefaultOrFirstSubscription().then((subscription) => { + setDefaultSubscriptionId(subscription || ''); + }); + } + }); + + const query = usePreparedQuery(baseQuery, onQueryChange, defaultSubscriptionId); const subscriptionId = query.subscription || datasource.azureMonitorDatasource.defaultSubscriptionId; const basicLogsEnabled = diff --git a/public/app/plugins/datasource/azuremonitor/components/QueryEditor/usePreparedQuery.ts b/public/app/plugins/datasource/azuremonitor/components/QueryEditor/usePreparedQuery.ts index 3361a7e77dc..8b12487cd39 100644 --- a/public/app/plugins/datasource/azuremonitor/components/QueryEditor/usePreparedQuery.ts +++ b/public/app/plugins/datasource/azuremonitor/components/QueryEditor/usePreparedQuery.ts @@ -9,21 +9,22 @@ const DEFAULT_QUERY = { queryType: AzureQueryType.AzureMonitor, }; -const transformExemplarQuery = (query: AzureMonitorQuery) => { +const transformExemplarQuery = (query: AzureMonitorQuery, defaultSubscriptionId: string) => { if (query.queryType === AzureQueryType.TraceExemplar && query.query !== '' && !query.azureTraces) { query.azureTraces = { operationId: query.query, resultFormat: ResultFormat.Trace, + resources: [`/subscriptions/${defaultSubscriptionId}`], }; } return query; }; -const prepareQuery = (query: AzureMonitorQuery) => { +const prepareQuery = (query: AzureMonitorQuery, defaultSubscriptionId: string) => { // Note: _.defaults does not apply default values deeply. const withDefaults = defaults({}, query, DEFAULT_QUERY); - const transformedQuery = transformExemplarQuery(withDefaults); + const transformedQuery = transformExemplarQuery(withDefaults, defaultSubscriptionId); const migratedQuery = migrateQuery(transformedQuery); // If we didn't make any changes to the object, then return the original object to keep the @@ -34,8 +35,12 @@ const prepareQuery = (query: AzureMonitorQuery) => { /** * Returns queries with some defaults + migrations, and calls onChange function to notify if it changes */ -const usePreparedQuery = (query: AzureMonitorQuery, onChangeQuery: (newQuery: AzureMonitorQuery) => void) => { - const preparedQuery = useMemo(() => prepareQuery(query), [query]); +const usePreparedQuery = ( + query: AzureMonitorQuery, + onChangeQuery: (newQuery: AzureMonitorQuery) => void, + defaultSubscriptionId: string +) => { + const preparedQuery = useMemo(() => prepareQuery(query, defaultSubscriptionId), [query, defaultSubscriptionId]); useEffect(() => { if (preparedQuery !== query) { diff --git a/public/app/plugins/datasource/azuremonitor/components/TracesQueryEditor/TracesQueryEditor.test.tsx b/public/app/plugins/datasource/azuremonitor/components/TracesQueryEditor/TracesQueryEditor.test.tsx index 8a0b647b19a..ce84d546d58 100644 --- a/public/app/plugins/datasource/azuremonitor/components/TracesQueryEditor/TracesQueryEditor.test.tsx +++ b/public/app/plugins/datasource/azuremonitor/components/TracesQueryEditor/TracesQueryEditor.test.tsx @@ -3,7 +3,6 @@ import userEvent from '@testing-library/user-event'; import createMockDatasource from '../../__mocks__/datasource'; import createMockQuery from '../../__mocks__/query'; -import { AzureQueryType } from '../../dataquery.gen'; import { createMockResourcePickerData } from '../MetricsQueryEditor/MetricsQueryEditor.test'; import TracesQueryEditor from './TracesQueryEditor'; @@ -184,58 +183,4 @@ describe('TracesQueryEditor', () => { }) ); }); - - it('should not display the resource selector for exemplar type queries', async () => { - const mockDatasource = createMockDatasource({ resourcePickerData: createMockResourcePickerData() }); - const query = createMockQuery(); - delete query?.subscription; - delete query?.azureTraces?.resources; - query.queryType = AzureQueryType.TraceExemplar; - query.azureTraces = { operationId: 'test-operation-id' }; - const onChange = jest.fn(); - - render( - {}} - /> - ); - - expect(await screen.queryByRole('button', { name: 'Select a resource' })).not.toBeInTheDocument(); - expect(await screen.getByDisplayValue('test-operation-id')).toBeInTheDocument(); - }); - - it('should not display the resource selector for exemplar type queries', async () => { - const mockDatasource = createMockDatasource({ resourcePickerData: createMockResourcePickerData() }); - const query = createMockQuery(); - delete query?.subscription; - delete query?.azureTraces?.resources; - query.queryType = AzureQueryType.TraceExemplar; - query.azureTraces = { operationId: 'test-operation-id' }; - const onChange = jest.fn(); - - render( - {}} - /> - ); - - const operationIDInput = await screen.getByDisplayValue('test-operation-id'); - await userEvent.clear(operationIDInput); - - expect(onChange).toHaveBeenCalledWith( - expect.objectContaining({ - azureTraces: undefined, - queryType: AzureQueryType.AzureTraces, - query: undefined, - }) - ); - }); }); diff --git a/public/app/plugins/datasource/azuremonitor/components/TracesQueryEditor/TracesQueryEditor.tsx b/public/app/plugins/datasource/azuremonitor/components/TracesQueryEditor/TracesQueryEditor.tsx index 09deeab32e8..7ed37f8fa21 100644 --- a/public/app/plugins/datasource/azuremonitor/components/TracesQueryEditor/TracesQueryEditor.tsx +++ b/public/app/plugins/datasource/azuremonitor/components/TracesQueryEditor/TracesQueryEditor.tsx @@ -88,37 +88,35 @@ const TracesQueryEditor = ({ return ( - {query.queryType !== AzureQueryType.TraceExemplar && ( - - - ( - // It's required to cast resources because the resource picker - // specifies the type to string | AzureMonitorResource. - // eslint-disable-next-line - - )} - selectionNotice={() => 'You may only choose items of the same resource type.'} - range={range} - /> - - - )} + + + ( + // It's required to cast resources because the resource picker + // specifies the type to string | AzureMonitorResource. + // eslint-disable-next-line + + )} + selectionNotice={() => 'You may only choose items of the same resource type.'} + range={range} + /> + + Date: Thu, 9 Jan 2025 11:35:04 +0000 Subject: [PATCH 2/7] Update dependency @rsdoctor/webpack-plugin to v0.4.13 (#98688) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 96 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 51 insertions(+), 45 deletions(-) diff --git a/yarn.lock b/yarn.lock index 13a52a12037..eed4d723ac7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6830,21 +6830,21 @@ __metadata: languageName: node linkType: hard -"@rsdoctor/client@npm:0.4.12": - version: 0.4.12 - resolution: "@rsdoctor/client@npm:0.4.12" - checksum: 10/04ae4f8de34fdf5cec5b9db2072e646f3327a7ba7ca4a96942961fa26129e715db92c28ca68bf0f6c5149ccbfb9b73aa2d2984242bf8d35bc54f827e2ccae84e +"@rsdoctor/client@npm:0.4.13": + version: 0.4.13 + resolution: "@rsdoctor/client@npm:0.4.13" + checksum: 10/6eaa768eceedf76aa940fcb5980eb39f5960f4f341c13c96ecddac8abb456c8248497dfbc0d7de933d02ad837f761af93bc54d76e84dca45591a6d99f000556b languageName: node linkType: hard -"@rsdoctor/core@npm:0.4.12": - version: 0.4.12 - resolution: "@rsdoctor/core@npm:0.4.12" +"@rsdoctor/core@npm:0.4.13": + version: 0.4.13 + resolution: "@rsdoctor/core@npm:0.4.13" dependencies: - "@rsdoctor/graph": "npm:0.4.12" - "@rsdoctor/sdk": "npm:0.4.12" - "@rsdoctor/types": "npm:0.4.12" - "@rsdoctor/utils": "npm:0.4.12" + "@rsdoctor/graph": "npm:0.4.13" + "@rsdoctor/sdk": "npm:0.4.13" + "@rsdoctor/types": "npm:0.4.13" + "@rsdoctor/utils": "npm:0.4.13" axios: "npm:^1.7.9" enhanced-resolve: "npm:5.12.0" filesize: "npm:^10.1.6" @@ -6854,31 +6854,31 @@ __metadata: semver: "npm:^7.6.3" source-map: "npm:^0.7.4" webpack-bundle-analyzer: "npm:^4.10.2" - checksum: 10/d77252288cec3ad9cd6389fb772125fcbdca669c0186a540a9270f2c3ac01b0620d188595e952a3683b0af4e4eef2c8816b0af71a2d87667eef7f2e47484a4b3 + checksum: 10/c105de8a0933ec7abf2104762a7db1046f0bd2c418fc67fad8315c44f22cdb5a6ec34dbcf5da24c8a698959d475f120cc598ec012870fe757fc968fbe603ced3 languageName: node linkType: hard -"@rsdoctor/graph@npm:0.4.12": - version: 0.4.12 - resolution: "@rsdoctor/graph@npm:0.4.12" +"@rsdoctor/graph@npm:0.4.13": + version: 0.4.13 + resolution: "@rsdoctor/graph@npm:0.4.13" dependencies: - "@rsdoctor/types": "npm:0.4.12" - "@rsdoctor/utils": "npm:0.4.12" - lodash: "npm:^4.17.21" + "@rsdoctor/types": "npm:0.4.13" + "@rsdoctor/utils": "npm:0.4.13" + lodash.unionby: "npm:^4.8.0" socket.io: "npm:4.8.1" source-map: "npm:^0.7.4" - checksum: 10/53cb9dd4c8507cf22ee6088e4fc1b5d26fb2090dee1570fd1964659d854bab33ed7ca73862a84a256280a85aa076c5e18953830af2127fb583d5eaa5274a934d + checksum: 10/40080b9726661d51bbec931ec85376039eec9f02c6a5523eb78365dbe0c7d2f86798fa2ff7ca29c13e844c5ab686bd8b6947d064aa0caaa97b06754f8a167ea1 languageName: node linkType: hard -"@rsdoctor/sdk@npm:0.4.12": - version: 0.4.12 - resolution: "@rsdoctor/sdk@npm:0.4.12" +"@rsdoctor/sdk@npm:0.4.13": + version: 0.4.13 + resolution: "@rsdoctor/sdk@npm:0.4.13" dependencies: - "@rsdoctor/client": "npm:0.4.12" - "@rsdoctor/graph": "npm:0.4.12" - "@rsdoctor/types": "npm:0.4.12" - "@rsdoctor/utils": "npm:0.4.12" + "@rsdoctor/client": "npm:0.4.13" + "@rsdoctor/graph": "npm:0.4.13" + "@rsdoctor/types": "npm:0.4.13" + "@rsdoctor/utils": "npm:0.4.13" "@types/fs-extra": "npm:^11.0.4" body-parser: "npm:1.20.3" cors: "npm:2.8.5" @@ -6891,13 +6891,13 @@ __metadata: socket.io: "npm:4.8.1" source-map: "npm:^0.7.4" tapable: "npm:2.2.1" - checksum: 10/a0f20c0410e44fd9f7428fee39c45abf493144e73aa910d9c8f34760461d36d1144856c9ea3078afee2282817acb8bffb82bad9ec8443279dde5bf14875df495 + checksum: 10/017cfe877952038a573d6e498dc4c5da1b0754bd5e50ccaf02e5263581a3ca901600b77b59cd9556cc9baefef8c37b0ccf5e7364342fb080c14e4b72d6005e97 languageName: node linkType: hard -"@rsdoctor/types@npm:0.4.12": - version: 0.4.12 - resolution: "@rsdoctor/types@npm:0.4.12" +"@rsdoctor/types@npm:0.4.13": + version: 0.4.13 + resolution: "@rsdoctor/types@npm:0.4.13" dependencies: "@types/connect": "npm:3.4.38" "@types/estree": "npm:1.0.5" @@ -6909,16 +6909,16 @@ __metadata: peerDependenciesMeta: "@rspack/core": optional: true - checksum: 10/41cbfd7eb36999e79eed49ebc49e5665c5c8c68070f2981558cdf110fdcc60d97b2e653ead5c12cf9ebcef8b7de98b42bc20cf15258a42a3f2ae5a7b75aa8379 + checksum: 10/a6e51bfc9e88779e9043d6f75420604f2839bbd7f7608a58556374ae74e7191b9a47872f9a426cf76e2e7756c8724550237398e093a415f6b8fbab84fae2dde5 languageName: node linkType: hard -"@rsdoctor/utils@npm:0.4.12": - version: 0.4.12 - resolution: "@rsdoctor/utils@npm:0.4.12" +"@rsdoctor/utils@npm:0.4.13": + version: 0.4.13 + resolution: "@rsdoctor/utils@npm:0.4.13" dependencies: "@babel/code-frame": "npm:7.25.7" - "@rsdoctor/types": "npm:0.4.12" + "@rsdoctor/types": "npm:0.4.13" "@types/estree": "npm:1.0.5" acorn: "npm:^8.10.0" acorn-import-assertions: "npm:1.9.0" @@ -6932,27 +6932,26 @@ __metadata: get-port: "npm:5.1.1" json-stream-stringify: "npm:3.0.1" lines-and-columns: "npm:2.0.4" - lodash: "npm:^4.17.21" rslog: "npm:^1.2.3" strip-ansi: "npm:^6.0.1" - checksum: 10/f0640c4cabacbf0c65cb2c2bc36791c9f07c9e4ea7917636f5480c193043a7f16cf276734a91bcd9309ec3389987e586e3a557e99266d758affdb76a2efb6a5a + checksum: 10/e102670b4432ee0ed47cda15eef8fc90e703451f3d8c7efe8d7e4817fe92b2702b33a303b156fd5409d6abcc0c5712be3a81817dd21f09dd9a6bec5ecf1c72ef languageName: node linkType: hard "@rsdoctor/webpack-plugin@npm:^0.4.6": - version: 0.4.12 - resolution: "@rsdoctor/webpack-plugin@npm:0.4.12" + version: 0.4.13 + resolution: "@rsdoctor/webpack-plugin@npm:0.4.13" dependencies: - "@rsdoctor/core": "npm:0.4.12" - "@rsdoctor/graph": "npm:0.4.12" - "@rsdoctor/sdk": "npm:0.4.12" - "@rsdoctor/types": "npm:0.4.12" - "@rsdoctor/utils": "npm:0.4.12" + "@rsdoctor/core": "npm:0.4.13" + "@rsdoctor/graph": "npm:0.4.13" + "@rsdoctor/sdk": "npm:0.4.13" + "@rsdoctor/types": "npm:0.4.13" + "@rsdoctor/utils": "npm:0.4.13" fs-extra: "npm:^11.1.1" lodash: "npm:^4.17.21" peerDependencies: webpack: 5.x - checksum: 10/e2bfc961f39bfa27e60ada29cccf2734db59062d78007cedaec3c794f8c39864c6f0e487879f565fcad100ec970d3e320c5927315fc2ed00d55a00924891b6f3 + checksum: 10/f244ef8f1b28192cb766d66099e6999ba5a042d19bd1ab29f023f4844807a6a444e26a73b31a077e03c600979d5f10ec70fd1a42e9af9766b6f22241f124b990 languageName: node linkType: hard @@ -21353,6 +21352,13 @@ __metadata: languageName: node linkType: hard +"lodash.unionby@npm:^4.8.0": + version: 4.8.0 + resolution: "lodash.unionby@npm:4.8.0" + checksum: 10/246eaf5b24cb63387abfbaab3a23883c500c56eb0d4b364c48739873b55a3c3131688f35926de64046b74377937ddb344a84282ebc0528b9dc3be5866216a91e + languageName: node + linkType: hard + "lodash.uniq@npm:^4.5.0": version: 4.5.0 resolution: "lodash.uniq@npm:4.5.0" From 9aacc1a04b2af029b81f84f45416531e721a158e Mon Sep 17 00:00:00 2001 From: Ivan Ortega Alba Date: Thu, 9 Jan 2025 13:56:16 +0100 Subject: [PATCH 3/7] Scenes: Upgrade to 5.36.3 (#98661) --- package.json | 4 ++-- yarn.lock | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index 8d8edeb9c59..54b7c6873f8 100644 --- a/package.json +++ b/package.json @@ -272,8 +272,8 @@ "@grafana/prometheus": "workspace:*", "@grafana/runtime": "workspace:*", "@grafana/saga-icons": "workspace:*", - "@grafana/scenes": "^5.35.0", - "@grafana/scenes-react": "^5.35.0", + "@grafana/scenes": "5.36.3", + "@grafana/scenes-react": "5.36.3", "@grafana/schema": "workspace:*", "@grafana/sql": "workspace:*", "@grafana/ui": "workspace:*", diff --git a/yarn.lock b/yarn.lock index eed4d723ac7..68281bba0b3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3849,11 +3849,11 @@ __metadata: languageName: unknown linkType: soft -"@grafana/scenes-react@npm:^5.35.0": - version: 5.35.0 - resolution: "@grafana/scenes-react@npm:5.35.0" +"@grafana/scenes-react@npm:5.36.3": + version: 5.36.3 + resolution: "@grafana/scenes-react@npm:5.36.3" dependencies: - "@grafana/scenes": "npm:5.35.0" + "@grafana/scenes": "npm:5.36.3" lru-cache: "npm:^10.2.2" react-use: "npm:^17.4.0" peerDependencies: @@ -3864,13 +3864,13 @@ __metadata: "@grafana/ui": ^11.0.0 react: ^18.0.0 react-dom: ^18.0.0 - checksum: 10/f70799e627ed12464266224bc42d7dbc1ce38753dd3e8ff48cef0e14639578e03d82d178657c7a30e8b4e5062b140e0d4faa94e7a4a73d7e0263338a43edf7d7 + checksum: 10/70cdc9cdb8b5237e3e03c35e4ab1dce923be46b9bcf26901df55c6aed48a35c008c5b976e22782ddfd5a45cf4165a222648e77adcc75346b090ec49297751091 languageName: node linkType: hard -"@grafana/scenes@npm:5.35.0, @grafana/scenes@npm:^5.35.0": - version: 5.35.0 - resolution: "@grafana/scenes@npm:5.35.0" +"@grafana/scenes@npm:5.36.3": + version: 5.36.3 + resolution: "@grafana/scenes@npm:5.36.3" dependencies: "@floating-ui/react": "npm:^0.26.16" "@leeoniya/ufuzzy": "npm:^1.0.16" @@ -3887,7 +3887,7 @@ __metadata: "@grafana/ui": ">=10.4" react: ^18.0.0 react-dom: ^18.0.0 - checksum: 10/deab041b4a3b3f99ed595e58f795aa06519020f85289a9544145e0b8969be6f826e470d98dc4981da9809bf9129f0fa11e26e3f8395fbe50923d51c85554b5ed + checksum: 10/8bc404091311b55f5316d567fc41789659fd221d38b4472ad5fa65afa224c9127e11a51daec2c07eccf941ec2eae58c0690dc312726139fdef3cf44ceb1460c9 languageName: node linkType: hard @@ -17633,8 +17633,8 @@ __metadata: "@grafana/prometheus": "workspace:*" "@grafana/runtime": "workspace:*" "@grafana/saga-icons": "workspace:*" - "@grafana/scenes": "npm:^5.35.0" - "@grafana/scenes-react": "npm:^5.35.0" + "@grafana/scenes": "npm:5.36.3" + "@grafana/scenes-react": "npm:5.36.3" "@grafana/schema": "workspace:*" "@grafana/sql": "workspace:*" "@grafana/tsconfig": "npm:^2.0.0" From 9e8c1acd005b8ad0a8cc025cd633ef697047e1dd Mon Sep 17 00:00:00 2001 From: Esteban Beltran Date: Thu, 9 Jan 2025 13:58:26 +0100 Subject: [PATCH 4/7] Docs: Add documentation for auto-triage github action (#97672) * Add documentation about auto-triager bot * Add diagram * Update links to prompts and labels files --- .github/bot.md | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/.github/bot.md b/.github/bot.md index 6eae334f4fa..e4e61b13e4b 100644 --- a/.github/bot.md +++ b/.github/bot.md @@ -28,3 +28,83 @@ try to cherry-pick the PR merge commit into that branch and open a PR. You must If there are merge conflicts the bot will write a comment on the source PR saying the cherry-pick failed. In this case you have to do the cherry pick and backport PR manually. The backport logic is written [here](https://github.com/grafana/grafana-github-actions/blob/main/backport/backport.ts) + +## Auto triager bot + +The auto triager bot is a github action that **assigns** labels to issues based on the issue contents. The logic to assign +labels is its own program and lives [here](https://github.com/grafana/auto-triager). It uses an LLM to do this. + +The bot runs **every time** a new issue is opened in the grafana/grafana repository. You can find the bot definition [here](https://github.com/grafana/grafana/blob/main/.github/workflows/issue-opened.yml#L61) + +The job only assign labels when the issue author is not a member of the Grafana organization in **GitHub**. The bot concurrency is 1. + +This bot is not responsible for assigning teams, the [commands](https://github.com/grafana/grafana/blob/main/.github/workflows/commands.yml) workflow is responsible for doing that + +### General diagram + +```mermaid +sequenceDiagram + actor User + participant GH as GitHub + participant AT as Auto Triager Job + participant ATP as Auto Triager Program + participant LLM as LLM Service + participant CJ as Commands Job + + User->>GH: Opens Issue + GH->>GH: Check if user in Grafana org + alt User not in Grafana org + GH->>AT: Trigger Auto Triager Job + AT->>ATP: Execute program + ATP->>LLM: Send issue content & categories + LLM-->>ATP: Return matching categories + ATP-->>GH: Assign labels to issue + GH->>CJ: Trigger Commands Job + CJ->>CJ: Read commands.json + CJ-->>GH: Assign teams based on labels + end +``` + +### Team definitions + +The team associated with labels are defined [here](https://github.com/grafana/grafana/blob/main/.github/commands.json). +This bot is not responsible for assigning teams, the [commands](https://github.com/grafana/grafana/blob/main/.github/workflows/commands.yml) workflow is responsible for doing that. + +The commands workflow code can be found [here](https://github.com/grafana/grafana-github-actions/tree/main/commands) + +### Categories/Labels definitions + +The categories (or labels) and the types used to categorize issues are defined in this same repository [here](https://github.com/grafana/grafana/tree/main/.github/workflows/auto-triager) the [prompt](https://github.com/grafana/grafana/blob/main/.github/workflows/auto-triager/prompt.txt) that is passed to the LLM is also defined there. + +If you are adding a new category in the auto-triager repository you must define a team that owns the label in the +[commands.json](https://github.com/grafana/grafana/blob/main/.github/commands.json). + +If you remove a label from the [commands.json](https://github.com/grafana/grafana/blob/main/.github/commands.json) and it doesn't have any other +team associated with it you must remove it from the [labels file](https://github.com/grafana/grafana/blob/main/.github/workflows/auto-triager/labels.txt) + +### Secrets + +The bot secrets live in the vault. It uses a [shared workflow](https://github.com/grafana/shared-workflows/tree/main/actions/get-vault-secrets) to get the vault secrets, the +workflow requires a token with `contents:read` and `id-token:write` scopes for it to work. + +### How to detect the bot is working? + +The list of [unlabeled issues](https://github.com/grafana/grafana/issues?q=is%3Aopen+is%3Aissue+no%3Alabel) should remain empty as long as the bot is running. +There might be issues in the list if some team member removed all labels, but if the list grows to more +than 5 it is likely the bot is not working correctly. + +### What to do if this bot is not working? + +You can contact the plugins platform team in slack `#grafana-plugins-platform` and inform about the issue. + +### Troubleshooting + +Possible reasons why the bot is not working: + +* The OpenAI API key is not valid anymore. The action output will show this in its error log. A new key needs to be +generated via the OpenAI UI and its value updated in vault. See [the action](https://github.com/grafana/grafana/blob/main/.github/workflows/issue-opened.yml#L72) to find the correct path to +update the key. +* The Slack webhook URL is not valid anymore. The action output will show this in its error log or the +#triage-automation-ci channel will stop showing messages about issue triaging. A new slack webhook url needs to be +generated for the auto triager app and its value updated in vault. +* This bot is not responsible for assigning teams, the [commands](https://github.com/grafana/grafana/blob/main/.github/workflows/commands.yml) workflow is responsible for doing that From 56be39ed4f4023372a84a1c1d421bf28e8f57698 Mon Sep 17 00:00:00 2001 From: Oscar Kilhed Date: Thu, 9 Jan 2025 14:51:00 +0100 Subject: [PATCH 5/7] Dashboards: Fix issue where filtered panels would not react to variable changes (#98718) * Make sure we activate the parent and tree even if current panel is active * force activate full scene object tree --------- Co-authored-by: Sergej-Vlasov --- .../scene/PanelSearchLayout.tsx | 10 +++++-- .../features/dashboard-scene/utils/utils.ts | 28 +++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/public/app/features/dashboard-scene/scene/PanelSearchLayout.tsx b/public/app/features/dashboard-scene/scene/PanelSearchLayout.tsx index 56ab7f8211c..780fab43b99 100644 --- a/public/app/features/dashboard-scene/scene/PanelSearchLayout.tsx +++ b/public/app/features/dashboard-scene/scene/PanelSearchLayout.tsx @@ -7,7 +7,7 @@ import { SceneGridRow, VizPanel, sceneGraph } from '@grafana/scenes'; import { useStyles2 } from '@grafana/ui'; import { Trans } from 'app/core/internationalization'; -import { activateSceneObjectAndParentTree } from '../utils/utils'; +import { forceActivateFullSceneObjectTree } from '../utils/utils'; import { DashboardScene } from './DashboardScene'; import { DashboardGridItem } from './layout-default/DashboardGridItem'; @@ -65,7 +65,13 @@ export function PanelSearchLayout({ dashboard, panelSearch = '', panelsPerRow }: } function PanelSearchHit({ panel }: { panel: VizPanel }) { - useEffect(() => activateSceneObjectAndParentTree(panel), [panel]); + useEffect(() => { + const deactivate = forceActivateFullSceneObjectTree(panel); + + return () => { + deactivate?.(); + }; + }, [panel]); return ; } diff --git a/public/app/features/dashboard-scene/utils/utils.ts b/public/app/features/dashboard-scene/utils/utils.ts index 3e34ec23362..3a26fc19170 100644 --- a/public/app/features/dashboard-scene/utils/utils.ts +++ b/public/app/features/dashboard-scene/utils/utils.ts @@ -275,6 +275,34 @@ export function activateSceneObjectAndParentTree(so: SceneObject): CancelActivat }; } +/** + * Adaptation of activateSceneObjectAndParentTree specific for PanelSearchLayout use case with + * with panelSearch and panelsPerRow custom panel filtering logic. + * + * Activating the whole tree because dashboard does not react to variable updates such as panel repeats + */ +export function forceActivateFullSceneObjectTree(so: SceneObject): CancelActivationHandler | undefined { + let cancel: CancelActivationHandler | undefined; + let parentCancel: CancelActivationHandler | undefined; + + if (so.parent) { + parentCancel = forceActivateFullSceneObjectTree(so.parent); + } + + if (!so.isActive) { + cancel = so.activate(); + return () => { + parentCancel?.(); + cancel?.(); + }; + } + + return () => { + parentCancel?.(); + cancel?.(); + }; +} + /** * @deprecated use activateSceneObjectAndParentTree instead. * Activates any inactive ancestors of the scene object. From a84ab52cc7e7ce6d7a1a0f09e7517a1932e85eef Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Thu, 9 Jan 2025 17:12:01 +0300 Subject: [PATCH 6/7] Provisioning: Add resource types (#98727) Co-authored-by: Mariell Hoversholm Co-authored-by: Roberto Jimenez Sanchez --- pkg/apis/provisioning/v0alpha1/classic.go | 22 + pkg/apis/provisioning/v0alpha1/doc.go | 6 + pkg/apis/provisioning/v0alpha1/jobs.go | 98 ++ pkg/apis/provisioning/v0alpha1/register.go | 129 ++ pkg/apis/provisioning/v0alpha1/types.go | 338 ++++ .../v0alpha1/zz_generated.deepcopy.go | 651 ++++++++ .../v0alpha1/zz_generated.defaults.go | 19 + .../v0alpha1/zz_generated.openapi.go | 1355 +++++++++++++++++ ...enerated.openapi_violation_exceptions.list | 13 + .../provisioning/v0alpha1/editingoptions.go | 43 + .../v0alpha1/githubrepositoryconfig.go | 79 + .../provisioning/v0alpha1/healthstatus.go | 45 + .../v0alpha1/localrepositoryconfig.go | 25 + .../provisioning/v0alpha1/repository.go | 211 +++ .../provisioning/v0alpha1/repositoryspec.go | 110 ++ .../provisioning/v0alpha1/repositorystatus.go | 52 + .../v0alpha1/s3repositoryconfig.go | 34 + .../provisioning/v0alpha1/syncstatus.go | 85 ++ .../provisioning/v0alpha1/webhookstatus.go | 54 + pkg/generated/applyconfiguration/utils.go | 38 +- .../clientset/versioned/clientset.go | 15 +- .../versioned/fake/clientset_generated.go | 7 + .../clientset/versioned/fake/register.go | 2 + .../clientset/versioned/scheme/register.go | 2 + .../typed/provisioning/v0alpha1/doc.go | 6 + .../typed/provisioning/v0alpha1/fake/doc.go | 6 + .../v0alpha1/fake/fake_provisioning_client.go | 26 + .../v0alpha1/fake/fake_repository.go | 37 + .../v0alpha1/generated_expansion.go | 7 + .../v0alpha1/provisioning_client.go | 93 ++ .../typed/provisioning/v0alpha1/repository.go | 60 + .../informers/externalversions/factory.go | 6 + .../informers/externalversions/generic.go | 11 +- .../provisioning/interface.go | 32 + .../provisioning/v0alpha1/interface.go | 31 + .../provisioning/v0alpha1/repository.go | 76 + .../v0alpha1/expansion_generated.go | 13 + .../provisioning/v0alpha1/repository.go | 56 + 38 files changed, 3882 insertions(+), 11 deletions(-) create mode 100644 pkg/apis/provisioning/v0alpha1/classic.go create mode 100644 pkg/apis/provisioning/v0alpha1/doc.go create mode 100644 pkg/apis/provisioning/v0alpha1/jobs.go create mode 100644 pkg/apis/provisioning/v0alpha1/register.go create mode 100644 pkg/apis/provisioning/v0alpha1/types.go create mode 100644 pkg/apis/provisioning/v0alpha1/zz_generated.deepcopy.go create mode 100644 pkg/apis/provisioning/v0alpha1/zz_generated.defaults.go create mode 100644 pkg/apis/provisioning/v0alpha1/zz_generated.openapi.go create mode 100644 pkg/apis/provisioning/v0alpha1/zz_generated.openapi_violation_exceptions.list create mode 100644 pkg/generated/applyconfiguration/provisioning/v0alpha1/editingoptions.go create mode 100644 pkg/generated/applyconfiguration/provisioning/v0alpha1/githubrepositoryconfig.go create mode 100644 pkg/generated/applyconfiguration/provisioning/v0alpha1/healthstatus.go create mode 100644 pkg/generated/applyconfiguration/provisioning/v0alpha1/localrepositoryconfig.go create mode 100644 pkg/generated/applyconfiguration/provisioning/v0alpha1/repository.go create mode 100644 pkg/generated/applyconfiguration/provisioning/v0alpha1/repositoryspec.go create mode 100644 pkg/generated/applyconfiguration/provisioning/v0alpha1/repositorystatus.go create mode 100644 pkg/generated/applyconfiguration/provisioning/v0alpha1/s3repositoryconfig.go create mode 100644 pkg/generated/applyconfiguration/provisioning/v0alpha1/syncstatus.go create mode 100644 pkg/generated/applyconfiguration/provisioning/v0alpha1/webhookstatus.go create mode 100644 pkg/generated/clientset/versioned/typed/provisioning/v0alpha1/doc.go create mode 100644 pkg/generated/clientset/versioned/typed/provisioning/v0alpha1/fake/doc.go create mode 100644 pkg/generated/clientset/versioned/typed/provisioning/v0alpha1/fake/fake_provisioning_client.go create mode 100644 pkg/generated/clientset/versioned/typed/provisioning/v0alpha1/fake/fake_repository.go create mode 100644 pkg/generated/clientset/versioned/typed/provisioning/v0alpha1/generated_expansion.go create mode 100644 pkg/generated/clientset/versioned/typed/provisioning/v0alpha1/provisioning_client.go create mode 100644 pkg/generated/clientset/versioned/typed/provisioning/v0alpha1/repository.go create mode 100644 pkg/generated/informers/externalversions/provisioning/interface.go create mode 100644 pkg/generated/informers/externalversions/provisioning/v0alpha1/interface.go create mode 100644 pkg/generated/informers/externalversions/provisioning/v0alpha1/repository.go create mode 100644 pkg/generated/listers/provisioning/v0alpha1/expansion_generated.go create mode 100644 pkg/generated/listers/provisioning/v0alpha1/repository.go diff --git a/pkg/apis/provisioning/v0alpha1/classic.go b/pkg/apis/provisioning/v0alpha1/classic.go new file mode 100644 index 00000000000..55e7cc289de --- /dev/null +++ b/pkg/apis/provisioning/v0alpha1/classic.go @@ -0,0 +1,22 @@ +package v0alpha1 + +// File types used from classic provisioning +// +enum +type ClassicFileType string + +const ( + // Dashboard JSON + ClassicDashboard ClassicFileType = "dashboard" + + // Datasource definitions + // eg: https://github.com/grafana/grafana/blob/v11.3.1/conf/provisioning/datasources/sample.yaml + ClassicDatasources ClassicFileType = "datasources" + + // Alert configuration + // https://github.com/grafana/grafana/blob/v11.3.1/conf/provisioning/alerting/sample.yaml + ClassicAlerting ClassicFileType = "alerting" + + // Access control + // https://github.com/grafana/grafana/blob/v11.3.1/conf/provisioning/access-control/sample.yaml + ClassicAccessControl ClassicFileType = "access-control" +) diff --git a/pkg/apis/provisioning/v0alpha1/doc.go b/pkg/apis/provisioning/v0alpha1/doc.go new file mode 100644 index 00000000000..f24a3d11d11 --- /dev/null +++ b/pkg/apis/provisioning/v0alpha1/doc.go @@ -0,0 +1,6 @@ +// +k8s:deepcopy-gen=package +// +k8s:openapi-gen=true +// +k8s:defaulter-gen=TypeMeta +// +groupName=provisioning.grafana.app + +package v0alpha1 // import "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1" diff --git a/pkg/apis/provisioning/v0alpha1/jobs.go b/pkg/apis/provisioning/v0alpha1/jobs.go new file mode 100644 index 00000000000..d5698d0172f --- /dev/null +++ b/pkg/apis/provisioning/v0alpha1/jobs.go @@ -0,0 +1,98 @@ +package v0alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// The repository name and type are stored as labels +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type Job struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec JobSpec `json:"spec,omitempty"` + Status JobStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type JobList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + + Items []Job `json:"items,omitempty"` +} + +// +enum +type JobAction string + +const ( + // Update a pull request -- send preview images, links etc + JobActionPullRequest JobAction = "pr" + + // Sync the remote branch with the grafana instance + JobActionSync JobAction = "sync" + + // Export from grafana into the remote repository + JobActionExport JobAction = "export" +) + +// +enum +type JobState string + +const ( + // Job has been submitted, but not processed yet + JobStatePending JobState = "pending" + + // The job is running + JobStateWorking JobState = "working" + + // Finished with success + JobStateSuccess JobState = "success" + + // Finished with errors + JobStateError JobState = "error" +) + +func (j JobState) Finished() bool { + return j == JobStateSuccess || j == JobStateError +} + +type JobSpec struct { + Action JobAction `json:"action"` + + // The branch of commit hash + Ref string `json:"ref,omitempty"` + + // Pull request number (when appropriate) + PR int `json:"pr,omitempty"` + Hash string `json:"hash,omitempty"` // used in PR code... not sure it is necessary + + // URL to the originator (eg, PR URL) + URL string `json:"url,omitempty"` +} + +// The job status +type JobStatus struct { + State JobState `json:"state,omitempty"` + Started int64 `json:"started,omitempty"` + Finished int64 `json:"finished,omitempty"` + Message string `json:"message,omitempty"` + Errors []string `json:"errors,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type WebhookResponse struct { + metav1.TypeMeta `json:",inline"` + + // HTTP Status code + // 200 implies that the payload was understood but nothing is required + // 202 implies that an async job has been scheduled to handle the request + Code int `json:"code,omitempty"` + + // Optional message + Message string `json:"added,omitempty"` + + // Jobs to be processed + // When the response is 202 (Accepted) the queued jobs will be returned + Job *JobSpec `json:"job,omitempty"` +} diff --git a/pkg/apis/provisioning/v0alpha1/register.go b/pkg/apis/provisioning/v0alpha1/register.go new file mode 100644 index 00000000000..c44c3a75bca --- /dev/null +++ b/pkg/apis/provisioning/v0alpha1/register.go @@ -0,0 +1,129 @@ +package v0alpha1 + +import ( + "errors" + "fmt" + "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + + "github.com/grafana/grafana/pkg/apimachinery/utils" +) + +const ( + GROUP = "provisioning.grafana.app" + VERSION = "v0alpha1" + APIVERSION = GROUP + "/" + VERSION +) + +var RepositoryResourceInfo = utils.NewResourceInfo(GROUP, VERSION, + "repositories", "repository", "Repositories", + func() runtime.Object { return &Repository{} }, // newObj + func() runtime.Object { return &RepositoryList{} }, // newList + utils.TableColumns{ // Returned by `kubectl get`. Doesn't affect disk storage. + Definition: []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string", Format: "name"}, + {Name: "Created At", Type: "date"}, + {Name: "Title", Type: "string"}, + {Name: "Type", Type: "string"}, + {Name: "Target", Type: "string"}, + }, + Reader: func(obj any) ([]interface{}, error) { + m, ok := obj.(*Repository) + if !ok { + return nil, errors.New("expected Repository") + } + + var target string + switch m.Spec.Type { + case LocalRepositoryType: + target = m.Spec.Local.Path + case S3RepositoryType: + target = m.Spec.S3.Bucket + case GitHubRepositoryType: + target = fmt.Sprintf("%s/%s", m.Spec.GitHub.Owner, m.Spec.GitHub.Repository) + } + + return []interface{}{ + m.Name, // may our may not be nice to read + m.CreationTimestamp.UTC().Format(time.RFC3339), + m.Spec.Title, // explicitly configured title that can change + m.Spec.Type, + target, + }, nil + }, + }) + +var JobResourceInfo = utils.NewResourceInfo(GROUP, VERSION, + "jobs", "job", "Job", + func() runtime.Object { return &Job{} }, // newObj + func() runtime.Object { return &JobList{} }, // newList + utils.TableColumns{ // Returned by `kubectl get`. Doesn't affect disk storage. + Definition: []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string", Format: "name"}, + {Name: "Created At", Type: "date"}, + {Name: "Action", Type: "string"}, + {Name: "State", Type: "string"}, + {Name: "Repository", Type: "string"}, + }, + Reader: func(obj any) ([]interface{}, error) { + m, ok := obj.(*Job) + if !ok { + return nil, errors.New("expected Repository") + } + + return []interface{}{ + m.Name, // may our may not be nice to read + m.CreationTimestamp.UTC().Format(time.RFC3339), + m.Spec.Action, + m.Status.State, + m.Labels["repository"], + }, nil + }, + }) + +var ( + // SchemeGroupVersion is group version used to register these objects + SchemeGroupVersion = schema.GroupVersion{Group: GROUP, Version: VERSION} + InternalGroupVersion = schema.GroupVersion{Group: GROUP, Version: runtime.APIVersionInternal} + + // SchemaBuilder is used by standard codegen + SchemeBuilder runtime.SchemeBuilder + localSchemeBuilder = &SchemeBuilder + AddToScheme = localSchemeBuilder.AddToScheme +) + +func init() { + localSchemeBuilder.Register(func(s *runtime.Scheme) error { + err := AddKnownTypes(SchemeGroupVersion, s) + if err != nil { + return err + } + metav1.AddToGroupVersion(s, SchemeGroupVersion) + return nil + }) +} + +// Adds the list of known types to the given scheme. +func AddKnownTypes(gv schema.GroupVersion, scheme *runtime.Scheme) error { + scheme.AddKnownTypes(gv, + &Repository{}, + &RepositoryList{}, + &HelloWorld{}, + &WebhookResponse{}, + &ResourceWrapper{}, + &FileList{}, + &HistoryList{}, + &TestResults{}, + &Job{}, + &JobList{}, + ) + return nil +} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} diff --git a/pkg/apis/provisioning/v0alpha1/types.go b/pkg/apis/provisioning/v0alpha1/types.go new file mode 100644 index 00000000000..2d4186d0936 --- /dev/null +++ b/pkg/apis/provisioning/v0alpha1/types.go @@ -0,0 +1,338 @@ +package v0alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + common "github.com/grafana/grafana/pkg/apimachinery/apis/common/v0alpha1" +) + +// When this code is changed, make sure to update the code generation. +// As of writing, this can be done via the hack dir in the root of the repo: ./hack/update-codegen.sh provisioning +// If you've opened the generated files in this dir at some point in VSCode, you may also have to re-open them to clear errors. +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type Repository struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec RepositorySpec `json:"spec,omitempty"` + Status RepositoryStatus `json:"status,omitempty"` +} + +type LocalRepositoryConfig struct { + Path string `json:"path,omitempty"` +} + +type S3RepositoryConfig struct { + Region string `json:"region,omitempty"` + Bucket string `json:"bucket,omitempty"` + + // TODO: Add ACL? + // TODO: Encryption?? + // TODO: How do we define access? Secrets? +} + +type GitHubRepositoryConfig struct { + // The owner of the repository (e.g. example in `example/test` or `https://github.com/example/test`). + Owner string `json:"owner,omitempty"` + // The name of the repository (e.g. test in `example/test` or `https://github.com/example/test`). + Repository string `json:"repository,omitempty"` + // The branch to use in the repository. + // By default, this is the main branch. + Branch string `json:"branch,omitempty"` + // Token for accessing the repository. + // TODO: this should be part of secrets and a simple reference. + Token string `json:"token,omitempty"` + // TODO: Do we want an SSH url instead maybe? + // TODO: On-prem GitHub Enterprise support? + + // Whether we should commit to change branches and use a Pull Request flow to achieve this. + // By default, this is false (i.e. we will commit straight to the main branch). + BranchWorkflow bool `json:"branchWorkflow,omitempty"` + + // Whether we should show dashboard previews in the pull requests caused by the BranchWorkflow option. + // By default, this is false (i.e. we will not create previews). + // This option is a no-op if BranchWorkflow is `false` or default. + GenerateDashboardPreviews bool `json:"generateDashboardPreviews,omitempty"` + + // PullRequestLinter enables the dashboard linter for this repository in Pull Requests + PullRequestLinter bool `json:"pullRequestLinter,omitempty"` +} + +// RepositoryType defines the types of Repository +// +enum +type RepositoryType string + +// RepositoryType values +const ( + LocalRepositoryType RepositoryType = "local" + S3RepositoryType RepositoryType = "s3" + GitHubRepositoryType RepositoryType = "github" +) + +type RepositorySpec struct { + // Describe the feature toggle + Title string `json:"title"` + + // Describe the feature toggle + Description string `json:"description,omitempty"` + + // The folder that is backed by the repository. + // The value is a reference to the Kubernetes metadata name of the folder in the same namespace. + Folder string `json:"folder,omitempty"` + + // Should we prefer emitting YAML for this repository, e.g. upon export? + // Editing existing dashboards will continue to emit the file format used in the repository. (TODO: implement this) + // If you delete and then recreate a dashboard, it will switch to the preferred format. + PreferYAML bool `json:"preferYaml,omitempty"` + + // Edit options within the repository + Editing EditingOptions `json:"editing"` + + // The repository type. When selected oneOf the values below should be non-nil + Type RepositoryType `json:"type"` + + // Linting enables linting for this repository + Linting bool `json:"linting,omitempty"` + + // The repository on the local file system. + // Mutually exclusive with s3 and github. + Local *LocalRepositoryConfig `json:"local,omitempty"` + + // The repository in an S3 bucket. + // Mutually exclusive with local and github. + S3 *S3RepositoryConfig `json:"s3,omitempty"` + + // The repository on GitHub. + // Mutually exclusive with local and s3. + // TODO: github or just 'git'?? + GitHub *GitHubRepositoryConfig `json:"github,omitempty"` +} + +type EditingOptions struct { + // End users can create new files in the remote file system + Create bool `json:"create"` + // End users can update existing files in the remote file system + Update bool `json:"update"` + // End users can delete existing files in the remote file system + Delete bool `json:"delete"` +} + +// The status of a Repository. +// This is expected never to be created by a kubectl call or similar, and is expected to rarely (if ever) be edited manually. +// As such, it is also a little less well structured than the spec, such as conditional-but-ever-present fields. +type RepositoryStatus struct { + // The generation of the spec last time reconciliation ran + ObservedGeneration int64 `json:"observedGeneration"` + + // This will get updated with the current health status (and updated periodically) + Health HealthStatus `json:"health"` + + // Sync information with the last sync information + Sync SyncStatus `json:"sync"` + + // Webhook Information (if applicable) + Webhook *WebhookStatus `json:"webhook"` +} + +type HealthStatus struct { + // When not healthy, requests will not be executed + Healthy bool `json:"healthy"` + + // When the health was checked last time + Checked int64 `json:"checked,omitempty"` + + // Summary messages (will be shown to users) + Message []string `json:"message,omitempty"` +} + +type SyncStatus struct { + // pending, running, success, error + State JobState `json:"state"` + + // The ID for the job that ran this sync + JobID string `json:"job,omitempty"` + + // When the sync job started + Started int64 `json:"started,omitempty"` + + // When the sync job finished + Finished int64 `json:"finished,omitempty"` + + // When the next sync check is scheduled + Scheduled int64 `json:"scheduled,omitempty"` + + // Summary messages (will be shown to users) + Message []string `json:"message,omitempty"` + + // The repository hash when the last sync ran + Hash string `json:"hash,omitempty"` +} + +type WebhookStatus struct { + ID int64 `json:"id,omitempty"` + URL string `json:"url,omitempty"` + Secret string `json:"secret,omitempty"` + SubscribedEvents []string `json:"subscribedEvents,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type RepositoryList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + + Items []Repository `json:"items,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type HelloWorld struct { + metav1.TypeMeta `json:",inline"` + + Whom string `json:"whom,omitempty"` +} + +// The kubernetes action required when loading a given resource +// +enum +type ResourceAction string + +// ResourceAction values +const ( + ResourceActionCreate ResourceAction = "create" + ResourceActionUpdate ResourceAction = "update" + ResourceActionDelete ResourceAction = "delete" +) + +// This is a container type for any resource type +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type ResourceWrapper struct { + metav1.TypeMeta `json:",inline"` + + // Path to the remote file + Path string `json:"path,omitempty"` + + // The commit hash (if exists) + Ref string `json:"ref,omitempty"` + + // The repo hash value + Hash string `json:"hash,omitempty"` + + // The modified time in the remote file system + Timestamp *metav1.Time `json:"timestamp,omitempty"` + + // Different flavors of the same object + Resource ResourceObjects `json:"resource"` + + // Lint results + Lint []LintIssue `json:"lint,omitempty"` + + // If errors exist, show them here + Errors []string `json:"errors,omitempty"` +} + +// The kubernetes action required when loading a given resource +// +enum +type LintSeverity string + +// ResourceAction values +const ( + LintSeverityExclude LintSeverity = "exclude" + LintSeverityQuiet LintSeverity = "quiet" + LintSeverityWarning LintSeverity = "warning" + LintSeverityError LintSeverity = "error" + LintSeverityFixed LintSeverity = "fixed" +) + +type LintIssue struct { + Severity LintSeverity `json:"severity"` + Rule string `json:"rule"` + Message string `json:"message"` +} + +type ResourceType struct { + Group string `json:"group,omitempty"` + Version string `json:"version,omitempty"` + Kind string `json:"kind,omitempty"` + Resource string `json:"resource,omitempty"` + + // For non-k8s native formats, what did this start as + Classic ClassicFileType `json:"classic,omitempty"` +} + +type ResourceObjects struct { + // The identified type for this object + Type ResourceType `json:"type"` + + // The resource from the repository with all modifications applied + // eg, the name, folder etc will all be applied to this object + File common.Unstructured `json:"file,omitempty"` + + // The same value, currently saved in the grafana database + Existing common.Unstructured `json:"existing,omitempty"` + + // The action required/used for dryRun + Action ResourceAction `json:"action,omitempty"` + + // The value returned from a dryRun request + DryRun common.Unstructured `json:"dryRun,omitempty"` +} + +// Information we can get just from the file listing +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type FileList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + + // should be named "items", but avoid subresource error for now: + // kubernetes/kubernetes#126809 + Items []FileItem `json:"files,omitempty"` +} + +type FileItem struct { + Path string `json:"path"` + Size int64 `json:"size,omitempty"` + Hash string `json:"hash,omitempty"` + Modified int64 `json:"modified,omitempty"` + Author string `json:"author,omitempty"` +} + +// HistoryList is a list of versions of a resource +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type TestResults struct { + metav1.TypeMeta `json:",inline"` + + // HTTP status code + Code int `json:"code"` + + // Is the connection healthy + Success bool `json:"success"` + + // Error descriptions + Errors []string `json:"errors,omitempty"` + + // Optional details + Details *common.Unstructured `json:"details,omitempty"` +} + +// HistoryList is a list of versions of a resource +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type HistoryList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + + // should be named "items", but avoid subresource error for now: + // kubernetes/kubernetes#126809 + Items []HistoryItem `json:"items,omitempty"` +} + +type Author struct { + Name string `json:"name"` + Username string `json:"username"` + AvatarURL string `json:"avatarURL,omitempty"` +} + +type HistoryItem struct { + Ref string `json:"ref"` + Message string `json:"message"` + Authors []Author `json:"authors"` + CreatedAt int64 `json:"createdAt"` +} diff --git a/pkg/apis/provisioning/v0alpha1/zz_generated.deepcopy.go b/pkg/apis/provisioning/v0alpha1/zz_generated.deepcopy.go new file mode 100644 index 00000000000..2c5d9cad87c --- /dev/null +++ b/pkg/apis/provisioning/v0alpha1/zz_generated.deepcopy.go @@ -0,0 +1,651 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +// SPDX-License-Identifier: AGPL-3.0-only + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v0alpha1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Author) DeepCopyInto(out *Author) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Author. +func (in *Author) DeepCopy() *Author { + if in == nil { + return nil + } + out := new(Author) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EditingOptions) DeepCopyInto(out *EditingOptions) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EditingOptions. +func (in *EditingOptions) DeepCopy() *EditingOptions { + if in == nil { + return nil + } + out := new(EditingOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FileItem) DeepCopyInto(out *FileItem) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FileItem. +func (in *FileItem) DeepCopy() *FileItem { + if in == nil { + return nil + } + out := new(FileItem) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FileList) DeepCopyInto(out *FileList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]FileItem, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FileList. +func (in *FileList) DeepCopy() *FileList { + if in == nil { + return nil + } + out := new(FileList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *FileList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GitHubRepositoryConfig) DeepCopyInto(out *GitHubRepositoryConfig) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GitHubRepositoryConfig. +func (in *GitHubRepositoryConfig) DeepCopy() *GitHubRepositoryConfig { + if in == nil { + return nil + } + out := new(GitHubRepositoryConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HealthStatus) DeepCopyInto(out *HealthStatus) { + *out = *in + if in.Message != nil { + in, out := &in.Message, &out.Message + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HealthStatus. +func (in *HealthStatus) DeepCopy() *HealthStatus { + if in == nil { + return nil + } + out := new(HealthStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HelloWorld) DeepCopyInto(out *HelloWorld) { + *out = *in + out.TypeMeta = in.TypeMeta + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelloWorld. +func (in *HelloWorld) DeepCopy() *HelloWorld { + if in == nil { + return nil + } + out := new(HelloWorld) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *HelloWorld) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HistoryItem) DeepCopyInto(out *HistoryItem) { + *out = *in + if in.Authors != nil { + in, out := &in.Authors, &out.Authors + *out = make([]Author, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HistoryItem. +func (in *HistoryItem) DeepCopy() *HistoryItem { + if in == nil { + return nil + } + out := new(HistoryItem) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HistoryList) DeepCopyInto(out *HistoryList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]HistoryItem, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HistoryList. +func (in *HistoryList) DeepCopy() *HistoryList { + if in == nil { + return nil + } + out := new(HistoryList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *HistoryList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Job) DeepCopyInto(out *Job) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Job. +func (in *Job) DeepCopy() *Job { + if in == nil { + return nil + } + out := new(Job) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Job) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *JobList) DeepCopyInto(out *JobList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Job, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobList. +func (in *JobList) DeepCopy() *JobList { + if in == nil { + return nil + } + out := new(JobList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *JobList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *JobSpec) DeepCopyInto(out *JobSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobSpec. +func (in *JobSpec) DeepCopy() *JobSpec { + if in == nil { + return nil + } + out := new(JobSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *JobStatus) DeepCopyInto(out *JobStatus) { + *out = *in + if in.Errors != nil { + in, out := &in.Errors, &out.Errors + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobStatus. +func (in *JobStatus) DeepCopy() *JobStatus { + if in == nil { + return nil + } + out := new(JobStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LintIssue) DeepCopyInto(out *LintIssue) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LintIssue. +func (in *LintIssue) DeepCopy() *LintIssue { + if in == nil { + return nil + } + out := new(LintIssue) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LocalRepositoryConfig) DeepCopyInto(out *LocalRepositoryConfig) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LocalRepositoryConfig. +func (in *LocalRepositoryConfig) DeepCopy() *LocalRepositoryConfig { + if in == nil { + return nil + } + out := new(LocalRepositoryConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Repository) DeepCopyInto(out *Repository) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Repository. +func (in *Repository) DeepCopy() *Repository { + if in == nil { + return nil + } + out := new(Repository) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Repository) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RepositoryList) DeepCopyInto(out *RepositoryList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Repository, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RepositoryList. +func (in *RepositoryList) DeepCopy() *RepositoryList { + if in == nil { + return nil + } + out := new(RepositoryList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *RepositoryList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RepositorySpec) DeepCopyInto(out *RepositorySpec) { + *out = *in + out.Editing = in.Editing + if in.Local != nil { + in, out := &in.Local, &out.Local + *out = new(LocalRepositoryConfig) + **out = **in + } + if in.S3 != nil { + in, out := &in.S3, &out.S3 + *out = new(S3RepositoryConfig) + **out = **in + } + if in.GitHub != nil { + in, out := &in.GitHub, &out.GitHub + *out = new(GitHubRepositoryConfig) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RepositorySpec. +func (in *RepositorySpec) DeepCopy() *RepositorySpec { + if in == nil { + return nil + } + out := new(RepositorySpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RepositoryStatus) DeepCopyInto(out *RepositoryStatus) { + *out = *in + in.Health.DeepCopyInto(&out.Health) + in.Sync.DeepCopyInto(&out.Sync) + if in.Webhook != nil { + in, out := &in.Webhook, &out.Webhook + *out = new(WebhookStatus) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RepositoryStatus. +func (in *RepositoryStatus) DeepCopy() *RepositoryStatus { + if in == nil { + return nil + } + out := new(RepositoryStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceObjects) DeepCopyInto(out *ResourceObjects) { + *out = *in + out.Type = in.Type + in.File.DeepCopyInto(&out.File) + in.Existing.DeepCopyInto(&out.Existing) + in.DryRun.DeepCopyInto(&out.DryRun) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceObjects. +func (in *ResourceObjects) DeepCopy() *ResourceObjects { + if in == nil { + return nil + } + out := new(ResourceObjects) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceType) DeepCopyInto(out *ResourceType) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceType. +func (in *ResourceType) DeepCopy() *ResourceType { + if in == nil { + return nil + } + out := new(ResourceType) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceWrapper) DeepCopyInto(out *ResourceWrapper) { + *out = *in + out.TypeMeta = in.TypeMeta + if in.Timestamp != nil { + in, out := &in.Timestamp, &out.Timestamp + *out = (*in).DeepCopy() + } + in.Resource.DeepCopyInto(&out.Resource) + if in.Lint != nil { + in, out := &in.Lint, &out.Lint + *out = make([]LintIssue, len(*in)) + copy(*out, *in) + } + if in.Errors != nil { + in, out := &in.Errors, &out.Errors + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceWrapper. +func (in *ResourceWrapper) DeepCopy() *ResourceWrapper { + if in == nil { + return nil + } + out := new(ResourceWrapper) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ResourceWrapper) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *S3RepositoryConfig) DeepCopyInto(out *S3RepositoryConfig) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S3RepositoryConfig. +func (in *S3RepositoryConfig) DeepCopy() *S3RepositoryConfig { + if in == nil { + return nil + } + out := new(S3RepositoryConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SyncStatus) DeepCopyInto(out *SyncStatus) { + *out = *in + if in.Message != nil { + in, out := &in.Message, &out.Message + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SyncStatus. +func (in *SyncStatus) DeepCopy() *SyncStatus { + if in == nil { + return nil + } + out := new(SyncStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TestResults) DeepCopyInto(out *TestResults) { + *out = *in + out.TypeMeta = in.TypeMeta + if in.Errors != nil { + in, out := &in.Errors, &out.Errors + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Details != nil { + in, out := &in.Details, &out.Details + *out = (*in).DeepCopy() + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TestResults. +func (in *TestResults) DeepCopy() *TestResults { + if in == nil { + return nil + } + out := new(TestResults) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TestResults) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WebhookResponse) DeepCopyInto(out *WebhookResponse) { + *out = *in + out.TypeMeta = in.TypeMeta + if in.Job != nil { + in, out := &in.Job, &out.Job + *out = new(JobSpec) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebhookResponse. +func (in *WebhookResponse) DeepCopy() *WebhookResponse { + if in == nil { + return nil + } + out := new(WebhookResponse) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *WebhookResponse) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WebhookStatus) DeepCopyInto(out *WebhookStatus) { + *out = *in + if in.SubscribedEvents != nil { + in, out := &in.SubscribedEvents, &out.SubscribedEvents + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebhookStatus. +func (in *WebhookStatus) DeepCopy() *WebhookStatus { + if in == nil { + return nil + } + out := new(WebhookStatus) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/apis/provisioning/v0alpha1/zz_generated.defaults.go b/pkg/apis/provisioning/v0alpha1/zz_generated.defaults.go new file mode 100644 index 00000000000..238fc2f4edc --- /dev/null +++ b/pkg/apis/provisioning/v0alpha1/zz_generated.defaults.go @@ -0,0 +1,19 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +// SPDX-License-Identifier: AGPL-3.0-only + +// Code generated by defaulter-gen. DO NOT EDIT. + +package v0alpha1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// RegisterDefaults adds defaulters functions to the given scheme. +// Public to allow building arbitrary schemes. +// All generated defaulters are covering - they call all nested defaulters. +func RegisterDefaults(scheme *runtime.Scheme) error { + return nil +} diff --git a/pkg/apis/provisioning/v0alpha1/zz_generated.openapi.go b/pkg/apis/provisioning/v0alpha1/zz_generated.openapi.go new file mode 100644 index 00000000000..e72e8c3ba96 --- /dev/null +++ b/pkg/apis/provisioning/v0alpha1/zz_generated.openapi.go @@ -0,0 +1,1355 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +// SPDX-License-Identifier: AGPL-3.0-only + +// Code generated by openapi-gen. DO NOT EDIT. + +package v0alpha1 + +import ( + common "k8s.io/kube-openapi/pkg/common" + spec "k8s.io/kube-openapi/pkg/validation/spec" +) + +func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { + return map[string]common.OpenAPIDefinition{ + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.Author": schema_pkg_apis_provisioning_v0alpha1_Author(ref), + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.EditingOptions": schema_pkg_apis_provisioning_v0alpha1_EditingOptions(ref), + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.FileItem": schema_pkg_apis_provisioning_v0alpha1_FileItem(ref), + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.FileList": schema_pkg_apis_provisioning_v0alpha1_FileList(ref), + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.GitHubRepositoryConfig": schema_pkg_apis_provisioning_v0alpha1_GitHubRepositoryConfig(ref), + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.HealthStatus": schema_pkg_apis_provisioning_v0alpha1_HealthStatus(ref), + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.HelloWorld": schema_pkg_apis_provisioning_v0alpha1_HelloWorld(ref), + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.HistoryItem": schema_pkg_apis_provisioning_v0alpha1_HistoryItem(ref), + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.HistoryList": schema_pkg_apis_provisioning_v0alpha1_HistoryList(ref), + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.Job": schema_pkg_apis_provisioning_v0alpha1_Job(ref), + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.JobList": schema_pkg_apis_provisioning_v0alpha1_JobList(ref), + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.JobSpec": schema_pkg_apis_provisioning_v0alpha1_JobSpec(ref), + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.JobStatus": schema_pkg_apis_provisioning_v0alpha1_JobStatus(ref), + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.LintIssue": schema_pkg_apis_provisioning_v0alpha1_LintIssue(ref), + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.LocalRepositoryConfig": schema_pkg_apis_provisioning_v0alpha1_LocalRepositoryConfig(ref), + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.Repository": schema_pkg_apis_provisioning_v0alpha1_Repository(ref), + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.RepositoryList": schema_pkg_apis_provisioning_v0alpha1_RepositoryList(ref), + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.RepositorySpec": schema_pkg_apis_provisioning_v0alpha1_RepositorySpec(ref), + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.RepositoryStatus": schema_pkg_apis_provisioning_v0alpha1_RepositoryStatus(ref), + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.ResourceObjects": schema_pkg_apis_provisioning_v0alpha1_ResourceObjects(ref), + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.ResourceType": schema_pkg_apis_provisioning_v0alpha1_ResourceType(ref), + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.ResourceWrapper": schema_pkg_apis_provisioning_v0alpha1_ResourceWrapper(ref), + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.S3RepositoryConfig": schema_pkg_apis_provisioning_v0alpha1_S3RepositoryConfig(ref), + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.SyncStatus": schema_pkg_apis_provisioning_v0alpha1_SyncStatus(ref), + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.TestResults": schema_pkg_apis_provisioning_v0alpha1_TestResults(ref), + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.WebhookResponse": schema_pkg_apis_provisioning_v0alpha1_WebhookResponse(ref), + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.WebhookStatus": schema_pkg_apis_provisioning_v0alpha1_WebhookStatus(ref), + } +} + +func schema_pkg_apis_provisioning_v0alpha1_Author(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "username": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "avatarURL": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"name", "username"}, + }, + }, + } +} + +func schema_pkg_apis_provisioning_v0alpha1_EditingOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "create": { + SchemaProps: spec.SchemaProps{ + Description: "End users can create new files in the remote file system", + Default: false, + Type: []string{"boolean"}, + Format: "", + }, + }, + "update": { + SchemaProps: spec.SchemaProps{ + Description: "End users can update existing files in the remote file system", + Default: false, + Type: []string{"boolean"}, + Format: "", + }, + }, + "delete": { + SchemaProps: spec.SchemaProps{ + Description: "End users can delete existing files in the remote file system", + Default: false, + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + Required: []string{"create", "update", "delete"}, + }, + }, + } +} + +func schema_pkg_apis_provisioning_v0alpha1_FileItem(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "path": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "size": { + SchemaProps: spec.SchemaProps{ + Type: []string{"integer"}, + Format: "int64", + }, + }, + "hash": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "modified": { + SchemaProps: spec.SchemaProps{ + Type: []string{"integer"}, + Format: "int64", + }, + }, + "author": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"path"}, + }, + }, + } +} + +func schema_pkg_apis_provisioning_v0alpha1_FileList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Information we can get just from the file listing", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "files": { + SchemaProps: spec.SchemaProps{ + Description: "should be named \"items\", but avoid subresource error for now: kubernetes/kubernetes#126809", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.FileItem"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.FileItem", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_provisioning_v0alpha1_GitHubRepositoryConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "owner": { + SchemaProps: spec.SchemaProps{ + Description: "The owner of the repository (e.g. example in `example/test` or `https://github.com/example/test`).", + Type: []string{"string"}, + Format: "", + }, + }, + "repository": { + SchemaProps: spec.SchemaProps{ + Description: "The name of the repository (e.g. test in `example/test` or `https://github.com/example/test`).", + Type: []string{"string"}, + Format: "", + }, + }, + "branch": { + SchemaProps: spec.SchemaProps{ + Description: "The branch to use in the repository. By default, this is the main branch.", + Type: []string{"string"}, + Format: "", + }, + }, + "token": { + SchemaProps: spec.SchemaProps{ + Description: "Token for accessing the repository.", + Type: []string{"string"}, + Format: "", + }, + }, + "branchWorkflow": { + SchemaProps: spec.SchemaProps{ + Description: "Whether we should commit to change branches and use a Pull Request flow to achieve this. By default, this is false (i.e. we will commit straight to the main branch).", + Type: []string{"boolean"}, + Format: "", + }, + }, + "generateDashboardPreviews": { + SchemaProps: spec.SchemaProps{ + Description: "Whether we should show dashboard previews in the pull requests caused by the BranchWorkflow option. By default, this is false (i.e. we will not create previews). This option is a no-op if BranchWorkflow is `false` or default.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "pullRequestLinter": { + SchemaProps: spec.SchemaProps{ + Description: "PullRequestLinter enables the dashboard linter for this repository in Pull Requests", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_provisioning_v0alpha1_HealthStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "healthy": { + SchemaProps: spec.SchemaProps{ + Description: "When not healthy, requests will not be executed", + Default: false, + Type: []string{"boolean"}, + Format: "", + }, + }, + "checked": { + SchemaProps: spec.SchemaProps{ + Description: "When the health was checked last time", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "Summary messages (will be shown to users)", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"healthy"}, + }, + }, + } +} + +func schema_pkg_apis_provisioning_v0alpha1_HelloWorld(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "whom": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_provisioning_v0alpha1_HistoryItem(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "ref": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "authors": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.Author"), + }, + }, + }, + }, + }, + "createdAt": { + SchemaProps: spec.SchemaProps{ + Default: 0, + Type: []string{"integer"}, + Format: "int64", + }, + }, + }, + Required: []string{"ref", "message", "authors", "createdAt"}, + }, + }, + Dependencies: []string{ + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.Author"}, + } +} + +func schema_pkg_apis_provisioning_v0alpha1_HistoryList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "HistoryList is a list of versions of a resource", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "should be named \"items\", but avoid subresource error for now: kubernetes/kubernetes#126809", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.HistoryItem"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.HistoryItem", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_provisioning_v0alpha1_Job(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "The repository name and type are stored as labels", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.JobSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.JobStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.JobSpec", "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.JobStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_provisioning_v0alpha1_JobList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.Job"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.Job", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_provisioning_v0alpha1_JobSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "action": { + SchemaProps: spec.SchemaProps{ + Description: "Possible enum values:\n - `\"export\"` Export from grafana into the remote repository\n - `\"pr\"` Update a pull request -- send preview images, links etc\n - `\"sync\"` Sync the remote branch with the grafana instance", + Default: "", + Type: []string{"string"}, + Format: "", + Enum: []interface{}{"export", "pr", "sync"}, + }, + }, + "ref": { + SchemaProps: spec.SchemaProps{ + Description: "The branch of commit hash", + Type: []string{"string"}, + Format: "", + }, + }, + "pr": { + SchemaProps: spec.SchemaProps{ + Description: "Pull request number (when appropriate)", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "hash": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "url": { + SchemaProps: spec.SchemaProps{ + Description: "URL to the originator (eg, PR URL)", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"action"}, + }, + }, + } +} + +func schema_pkg_apis_provisioning_v0alpha1_JobStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "The job status", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "state": { + SchemaProps: spec.SchemaProps{ + Description: "Possible enum values:\n - `\"error\"` Finished with errors\n - `\"pending\"` Job has been submitted, but not processed yet\n - `\"success\"` Finished with success\n - `\"working\"` The job is running", + Type: []string{"string"}, + Format: "", + Enum: []interface{}{"error", "pending", "success", "working"}, + }, + }, + "started": { + SchemaProps: spec.SchemaProps{ + Type: []string{"integer"}, + Format: "int64", + }, + }, + "finished": { + SchemaProps: spec.SchemaProps{ + Type: []string{"integer"}, + Format: "int64", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "errors": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_provisioning_v0alpha1_LintIssue(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "severity": { + SchemaProps: spec.SchemaProps{ + Description: "Possible enum values:\n - `\"error\"`\n - `\"exclude\"`\n - `\"fixed\"`\n - `\"quiet\"`\n - `\"warning\"`", + Default: "", + Type: []string{"string"}, + Format: "", + Enum: []interface{}{"error", "exclude", "fixed", "quiet", "warning"}, + }, + }, + "rule": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"severity", "rule", "message"}, + }, + }, + } +} + +func schema_pkg_apis_provisioning_v0alpha1_LocalRepositoryConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "path": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_provisioning_v0alpha1_Repository(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "When this code is changed, make sure to update the code generation. As of writing, this can be done via the hack dir in the root of the repo: ./hack/update-codegen.sh provisioning If you've opened the generated files in this dir at some point in VSCode, you may also have to re-open them to clear errors.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.RepositorySpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.RepositoryStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.RepositorySpec", "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.RepositoryStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_provisioning_v0alpha1_RepositoryList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.Repository"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.Repository", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_provisioning_v0alpha1_RepositorySpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "title": { + SchemaProps: spec.SchemaProps{ + Description: "Describe the feature toggle", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "description": { + SchemaProps: spec.SchemaProps{ + Description: "Describe the feature toggle", + Type: []string{"string"}, + Format: "", + }, + }, + "folder": { + SchemaProps: spec.SchemaProps{ + Description: "The folder that is backed by the repository. The value is a reference to the Kubernetes metadata name of the folder in the same namespace.", + Type: []string{"string"}, + Format: "", + }, + }, + "preferYaml": { + SchemaProps: spec.SchemaProps{ + Description: "Should we prefer emitting YAML for this repository, e.g. upon export? Editing existing dashboards will continue to emit the file format used in the repository. (TODO: implement this) If you delete and then recreate a dashboard, it will switch to the preferred format.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "editing": { + SchemaProps: spec.SchemaProps{ + Description: "Edit options within the repository", + Default: map[string]interface{}{}, + Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.EditingOptions"), + }, + }, + "type": { + SchemaProps: spec.SchemaProps{ + Description: "The repository type. When selected oneOf the values below should be non-nil\n\nPossible enum values:\n - `\"github\"`\n - `\"local\"`\n - `\"s3\"`", + Default: "", + Type: []string{"string"}, + Format: "", + Enum: []interface{}{"github", "local", "s3"}, + }, + }, + "linting": { + SchemaProps: spec.SchemaProps{ + Description: "Linting enables linting for this repository", + Type: []string{"boolean"}, + Format: "", + }, + }, + "local": { + SchemaProps: spec.SchemaProps{ + Description: "The repository on the local file system. Mutually exclusive with s3 and github.", + Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.LocalRepositoryConfig"), + }, + }, + "s3": { + SchemaProps: spec.SchemaProps{ + Description: "The repository in an S3 bucket. Mutually exclusive with local and github.", + Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.S3RepositoryConfig"), + }, + }, + "github": { + SchemaProps: spec.SchemaProps{ + Description: "The repository on GitHub. Mutually exclusive with local and s3.", + Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.GitHubRepositoryConfig"), + }, + }, + }, + Required: []string{"title", "editing", "type"}, + }, + }, + Dependencies: []string{ + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.EditingOptions", "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.GitHubRepositoryConfig", "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.LocalRepositoryConfig", "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.S3RepositoryConfig"}, + } +} + +func schema_pkg_apis_provisioning_v0alpha1_RepositoryStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "The status of a Repository. This is expected never to be created by a kubectl call or similar, and is expected to rarely (if ever) be edited manually. As such, it is also a little less well structured than the spec, such as conditional-but-ever-present fields.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "observedGeneration": { + SchemaProps: spec.SchemaProps{ + Description: "The generation of the spec last time reconciliation ran", + Default: 0, + Type: []string{"integer"}, + Format: "int64", + }, + }, + "health": { + SchemaProps: spec.SchemaProps{ + Description: "This will get updated with the current health status (and updated periodically)", + Default: map[string]interface{}{}, + Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.HealthStatus"), + }, + }, + "sync": { + SchemaProps: spec.SchemaProps{ + Description: "Sync information with the last sync information", + Default: map[string]interface{}{}, + Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.SyncStatus"), + }, + }, + "webhook": { + SchemaProps: spec.SchemaProps{ + Description: "Webhook Information (if applicable)", + Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.WebhookStatus"), + }, + }, + }, + Required: []string{"observedGeneration", "health", "sync", "webhook"}, + }, + }, + Dependencies: []string{ + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.HealthStatus", "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.SyncStatus", "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.WebhookStatus"}, + } +} + +func schema_pkg_apis_provisioning_v0alpha1_ResourceObjects(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Description: "The identified type for this object", + Default: map[string]interface{}{}, + Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.ResourceType"), + }, + }, + "file": { + SchemaProps: spec.SchemaProps{ + Description: "The resource from the repository with all modifications applied eg, the name, folder etc will all be applied to this object", + Ref: ref("github.com/grafana/grafana/pkg/apimachinery/apis/common/v0alpha1.Unstructured"), + }, + }, + "existing": { + SchemaProps: spec.SchemaProps{ + Description: "The same value, currently saved in the grafana database", + Ref: ref("github.com/grafana/grafana/pkg/apimachinery/apis/common/v0alpha1.Unstructured"), + }, + }, + "action": { + SchemaProps: spec.SchemaProps{ + Description: "The action required/used for dryRun\n\nPossible enum values:\n - `\"create\"`\n - `\"delete\"`\n - `\"update\"`", + Type: []string{"string"}, + Format: "", + Enum: []interface{}{"create", "delete", "update"}, + }, + }, + "dryRun": { + SchemaProps: spec.SchemaProps{ + Description: "The value returned from a dryRun request", + Ref: ref("github.com/grafana/grafana/pkg/apimachinery/apis/common/v0alpha1.Unstructured"), + }, + }, + }, + Required: []string{"type"}, + }, + }, + Dependencies: []string{ + "github.com/grafana/grafana/pkg/apimachinery/apis/common/v0alpha1.Unstructured", "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.ResourceType"}, + } +} + +func schema_pkg_apis_provisioning_v0alpha1_ResourceType(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "group": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "resource": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "classic": { + SchemaProps: spec.SchemaProps{ + Description: "For non-k8s native formats, what did this start as\n\nPossible enum values:\n - `\"access-control\"` Access control https://github.com/grafana/grafana/blob/v11.3.1/conf/provisioning/access-control/sample.yaml\n - `\"alerting\"` Alert configuration https://github.com/grafana/grafana/blob/v11.3.1/conf/provisioning/alerting/sample.yaml\n - `\"dashboard\"` Dashboard JSON\n - `\"datasources\"` Datasource definitions eg: https://github.com/grafana/grafana/blob/v11.3.1/conf/provisioning/datasources/sample.yaml", + Type: []string{"string"}, + Format: "", + Enum: []interface{}{"access-control", "alerting", "dashboard", "datasources"}, + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_provisioning_v0alpha1_ResourceWrapper(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "This is a container type for any resource type", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "path": { + SchemaProps: spec.SchemaProps{ + Description: "Path to the remote file", + Type: []string{"string"}, + Format: "", + }, + }, + "ref": { + SchemaProps: spec.SchemaProps{ + Description: "The commit hash (if exists)", + Type: []string{"string"}, + Format: "", + }, + }, + "hash": { + SchemaProps: spec.SchemaProps{ + Description: "The repo hash value", + Type: []string{"string"}, + Format: "", + }, + }, + "timestamp": { + SchemaProps: spec.SchemaProps{ + Description: "The modified time in the remote file system", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "resource": { + SchemaProps: spec.SchemaProps{ + Description: "Different flavors of the same object", + Default: map[string]interface{}{}, + Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.ResourceObjects"), + }, + }, + "lint": { + SchemaProps: spec.SchemaProps{ + Description: "Lint results", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.LintIssue"), + }, + }, + }, + }, + }, + "errors": { + SchemaProps: spec.SchemaProps{ + Description: "If errors exist, show them here", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"resource"}, + }, + }, + Dependencies: []string{ + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.LintIssue", "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.ResourceObjects", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + } +} + +func schema_pkg_apis_provisioning_v0alpha1_S3RepositoryConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "region": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "bucket": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_provisioning_v0alpha1_SyncStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "state": { + SchemaProps: spec.SchemaProps{ + Description: "pending, running, success, error\n\nPossible enum values:\n - `\"error\"` Finished with errors\n - `\"pending\"` Job has been submitted, but not processed yet\n - `\"success\"` Finished with success\n - `\"working\"` The job is running", + Default: "", + Type: []string{"string"}, + Format: "", + Enum: []interface{}{"error", "pending", "success", "working"}, + }, + }, + "job": { + SchemaProps: spec.SchemaProps{ + Description: "The ID for the job that ran this sync", + Type: []string{"string"}, + Format: "", + }, + }, + "started": { + SchemaProps: spec.SchemaProps{ + Description: "When the sync job started", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "finished": { + SchemaProps: spec.SchemaProps{ + Description: "When the sync job finished", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "scheduled": { + SchemaProps: spec.SchemaProps{ + Description: "When the next sync check is scheduled", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "Summary messages (will be shown to users)", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "hash": { + SchemaProps: spec.SchemaProps{ + Description: "The repository hash when the last sync ran", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"state"}, + }, + }, + } +} + +func schema_pkg_apis_provisioning_v0alpha1_TestResults(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "HistoryList is a list of versions of a resource", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "code": { + SchemaProps: spec.SchemaProps{ + Description: "HTTP status code", + Default: 0, + Type: []string{"integer"}, + Format: "int32", + }, + }, + "success": { + SchemaProps: spec.SchemaProps{ + Description: "Is the connection healthy", + Default: false, + Type: []string{"boolean"}, + Format: "", + }, + }, + "errors": { + SchemaProps: spec.SchemaProps{ + Description: "Error descriptions", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "details": { + SchemaProps: spec.SchemaProps{ + Description: "Optional details", + Ref: ref("github.com/grafana/grafana/pkg/apimachinery/apis/common/v0alpha1.Unstructured"), + }, + }, + }, + Required: []string{"code", "success"}, + }, + }, + Dependencies: []string{ + "github.com/grafana/grafana/pkg/apimachinery/apis/common/v0alpha1.Unstructured"}, + } +} + +func schema_pkg_apis_provisioning_v0alpha1_WebhookResponse(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "code": { + SchemaProps: spec.SchemaProps{ + Description: "HTTP Status code 200 implies that the payload was understood but nothing is required 202 implies that an async job has been scheduled to handle the request", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "added": { + SchemaProps: spec.SchemaProps{ + Description: "Optional message", + Type: []string{"string"}, + Format: "", + }, + }, + "job": { + SchemaProps: spec.SchemaProps{ + Description: "Jobs to be processed When the response is 202 (Accepted) the queued jobs will be returned", + Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.JobSpec"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.JobSpec"}, + } +} + +func schema_pkg_apis_provisioning_v0alpha1_WebhookStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "id": { + SchemaProps: spec.SchemaProps{ + Type: []string{"integer"}, + Format: "int64", + }, + }, + "url": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "secret": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "subscribedEvents": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + }, + }, + } +} diff --git a/pkg/apis/provisioning/v0alpha1/zz_generated.openapi_violation_exceptions.list b/pkg/apis/provisioning/v0alpha1/zz_generated.openapi_violation_exceptions.list new file mode 100644 index 00000000000..86d4fbe5def --- /dev/null +++ b/pkg/apis/provisioning/v0alpha1/zz_generated.openapi_violation_exceptions.list @@ -0,0 +1,13 @@ +API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,HealthStatus,Message +API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,HistoryItem,Authors +API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,JobStatus,Errors +API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,ResourceWrapper,Errors +API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,ResourceWrapper,Lint +API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,SyncStatus,Message +API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,TestResults,Errors +API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,WebhookStatus,SubscribedEvents +API rule violation: names_match,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,FileList,Items +API rule violation: names_match,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,RepositorySpec,GitHub +API rule violation: names_match,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,RepositorySpec,PreferYAML +API rule violation: names_match,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,SyncStatus,JobID +API rule violation: names_match,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,WebhookResponse,Message diff --git a/pkg/generated/applyconfiguration/provisioning/v0alpha1/editingoptions.go b/pkg/generated/applyconfiguration/provisioning/v0alpha1/editingoptions.go new file mode 100644 index 00000000000..9807b8fa4d8 --- /dev/null +++ b/pkg/generated/applyconfiguration/provisioning/v0alpha1/editingoptions.go @@ -0,0 +1,43 @@ +// SPDX-License-Identifier: AGPL-3.0-only + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v0alpha1 + +// EditingOptionsApplyConfiguration represents a declarative configuration of the EditingOptions type for use +// with apply. +type EditingOptionsApplyConfiguration struct { + Create *bool `json:"create,omitempty"` + Update *bool `json:"update,omitempty"` + Delete *bool `json:"delete,omitempty"` +} + +// EditingOptionsApplyConfiguration constructs a declarative configuration of the EditingOptions type for use with +// apply. +func EditingOptions() *EditingOptionsApplyConfiguration { + return &EditingOptionsApplyConfiguration{} +} + +// WithCreate sets the Create field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Create field is set to the value of the last call. +func (b *EditingOptionsApplyConfiguration) WithCreate(value bool) *EditingOptionsApplyConfiguration { + b.Create = &value + return b +} + +// WithUpdate sets the Update field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Update field is set to the value of the last call. +func (b *EditingOptionsApplyConfiguration) WithUpdate(value bool) *EditingOptionsApplyConfiguration { + b.Update = &value + return b +} + +// WithDelete sets the Delete field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Delete field is set to the value of the last call. +func (b *EditingOptionsApplyConfiguration) WithDelete(value bool) *EditingOptionsApplyConfiguration { + b.Delete = &value + return b +} diff --git a/pkg/generated/applyconfiguration/provisioning/v0alpha1/githubrepositoryconfig.go b/pkg/generated/applyconfiguration/provisioning/v0alpha1/githubrepositoryconfig.go new file mode 100644 index 00000000000..5d6da1efda6 --- /dev/null +++ b/pkg/generated/applyconfiguration/provisioning/v0alpha1/githubrepositoryconfig.go @@ -0,0 +1,79 @@ +// SPDX-License-Identifier: AGPL-3.0-only + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v0alpha1 + +// GitHubRepositoryConfigApplyConfiguration represents a declarative configuration of the GitHubRepositoryConfig type for use +// with apply. +type GitHubRepositoryConfigApplyConfiguration struct { + Owner *string `json:"owner,omitempty"` + Repository *string `json:"repository,omitempty"` + Branch *string `json:"branch,omitempty"` + Token *string `json:"token,omitempty"` + BranchWorkflow *bool `json:"branchWorkflow,omitempty"` + GenerateDashboardPreviews *bool `json:"generateDashboardPreviews,omitempty"` + PullRequestLinter *bool `json:"pullRequestLinter,omitempty"` +} + +// GitHubRepositoryConfigApplyConfiguration constructs a declarative configuration of the GitHubRepositoryConfig type for use with +// apply. +func GitHubRepositoryConfig() *GitHubRepositoryConfigApplyConfiguration { + return &GitHubRepositoryConfigApplyConfiguration{} +} + +// WithOwner sets the Owner field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Owner field is set to the value of the last call. +func (b *GitHubRepositoryConfigApplyConfiguration) WithOwner(value string) *GitHubRepositoryConfigApplyConfiguration { + b.Owner = &value + return b +} + +// WithRepository sets the Repository field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Repository field is set to the value of the last call. +func (b *GitHubRepositoryConfigApplyConfiguration) WithRepository(value string) *GitHubRepositoryConfigApplyConfiguration { + b.Repository = &value + return b +} + +// WithBranch sets the Branch field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Branch field is set to the value of the last call. +func (b *GitHubRepositoryConfigApplyConfiguration) WithBranch(value string) *GitHubRepositoryConfigApplyConfiguration { + b.Branch = &value + return b +} + +// WithToken sets the Token field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Token field is set to the value of the last call. +func (b *GitHubRepositoryConfigApplyConfiguration) WithToken(value string) *GitHubRepositoryConfigApplyConfiguration { + b.Token = &value + return b +} + +// WithBranchWorkflow sets the BranchWorkflow field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the BranchWorkflow field is set to the value of the last call. +func (b *GitHubRepositoryConfigApplyConfiguration) WithBranchWorkflow(value bool) *GitHubRepositoryConfigApplyConfiguration { + b.BranchWorkflow = &value + return b +} + +// WithGenerateDashboardPreviews sets the GenerateDashboardPreviews field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateDashboardPreviews field is set to the value of the last call. +func (b *GitHubRepositoryConfigApplyConfiguration) WithGenerateDashboardPreviews(value bool) *GitHubRepositoryConfigApplyConfiguration { + b.GenerateDashboardPreviews = &value + return b +} + +// WithPullRequestLinter sets the PullRequestLinter field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PullRequestLinter field is set to the value of the last call. +func (b *GitHubRepositoryConfigApplyConfiguration) WithPullRequestLinter(value bool) *GitHubRepositoryConfigApplyConfiguration { + b.PullRequestLinter = &value + return b +} diff --git a/pkg/generated/applyconfiguration/provisioning/v0alpha1/healthstatus.go b/pkg/generated/applyconfiguration/provisioning/v0alpha1/healthstatus.go new file mode 100644 index 00000000000..6d3b33cb318 --- /dev/null +++ b/pkg/generated/applyconfiguration/provisioning/v0alpha1/healthstatus.go @@ -0,0 +1,45 @@ +// SPDX-License-Identifier: AGPL-3.0-only + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v0alpha1 + +// HealthStatusApplyConfiguration represents a declarative configuration of the HealthStatus type for use +// with apply. +type HealthStatusApplyConfiguration struct { + Healthy *bool `json:"healthy,omitempty"` + Checked *int64 `json:"checked,omitempty"` + Message []string `json:"message,omitempty"` +} + +// HealthStatusApplyConfiguration constructs a declarative configuration of the HealthStatus type for use with +// apply. +func HealthStatus() *HealthStatusApplyConfiguration { + return &HealthStatusApplyConfiguration{} +} + +// WithHealthy sets the Healthy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Healthy field is set to the value of the last call. +func (b *HealthStatusApplyConfiguration) WithHealthy(value bool) *HealthStatusApplyConfiguration { + b.Healthy = &value + return b +} + +// WithChecked sets the Checked field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Checked field is set to the value of the last call. +func (b *HealthStatusApplyConfiguration) WithChecked(value int64) *HealthStatusApplyConfiguration { + b.Checked = &value + return b +} + +// WithMessage adds the given value to the Message field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Message field. +func (b *HealthStatusApplyConfiguration) WithMessage(values ...string) *HealthStatusApplyConfiguration { + for i := range values { + b.Message = append(b.Message, values[i]) + } + return b +} diff --git a/pkg/generated/applyconfiguration/provisioning/v0alpha1/localrepositoryconfig.go b/pkg/generated/applyconfiguration/provisioning/v0alpha1/localrepositoryconfig.go new file mode 100644 index 00000000000..ad02843a318 --- /dev/null +++ b/pkg/generated/applyconfiguration/provisioning/v0alpha1/localrepositoryconfig.go @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: AGPL-3.0-only + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v0alpha1 + +// LocalRepositoryConfigApplyConfiguration represents a declarative configuration of the LocalRepositoryConfig type for use +// with apply. +type LocalRepositoryConfigApplyConfiguration struct { + Path *string `json:"path,omitempty"` +} + +// LocalRepositoryConfigApplyConfiguration constructs a declarative configuration of the LocalRepositoryConfig type for use with +// apply. +func LocalRepositoryConfig() *LocalRepositoryConfigApplyConfiguration { + return &LocalRepositoryConfigApplyConfiguration{} +} + +// WithPath sets the Path field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Path field is set to the value of the last call. +func (b *LocalRepositoryConfigApplyConfiguration) WithPath(value string) *LocalRepositoryConfigApplyConfiguration { + b.Path = &value + return b +} diff --git a/pkg/generated/applyconfiguration/provisioning/v0alpha1/repository.go b/pkg/generated/applyconfiguration/provisioning/v0alpha1/repository.go new file mode 100644 index 00000000000..19a4e828600 --- /dev/null +++ b/pkg/generated/applyconfiguration/provisioning/v0alpha1/repository.go @@ -0,0 +1,211 @@ +// SPDX-License-Identifier: AGPL-3.0-only + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v0alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// RepositoryApplyConfiguration represents a declarative configuration of the Repository type for use +// with apply. +type RepositoryApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *RepositorySpecApplyConfiguration `json:"spec,omitempty"` + Status *RepositoryStatusApplyConfiguration `json:"status,omitempty"` +} + +// Repository constructs a declarative configuration of the Repository type for use with +// apply. +func Repository(name, namespace string) *RepositoryApplyConfiguration { + b := &RepositoryApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Repository") + b.WithAPIVersion("provisioning.grafana.app/v0alpha1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *RepositoryApplyConfiguration) WithKind(value string) *RepositoryApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *RepositoryApplyConfiguration) WithAPIVersion(value string) *RepositoryApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *RepositoryApplyConfiguration) WithName(value string) *RepositoryApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *RepositoryApplyConfiguration) WithGenerateName(value string) *RepositoryApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *RepositoryApplyConfiguration) WithNamespace(value string) *RepositoryApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *RepositoryApplyConfiguration) WithUID(value types.UID) *RepositoryApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *RepositoryApplyConfiguration) WithResourceVersion(value string) *RepositoryApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *RepositoryApplyConfiguration) WithGeneration(value int64) *RepositoryApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *RepositoryApplyConfiguration) WithCreationTimestamp(value metav1.Time) *RepositoryApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *RepositoryApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *RepositoryApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *RepositoryApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *RepositoryApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *RepositoryApplyConfiguration) WithLabels(entries map[string]string) *RepositoryApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *RepositoryApplyConfiguration) WithAnnotations(entries map[string]string) *RepositoryApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *RepositoryApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *RepositoryApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *RepositoryApplyConfiguration) WithFinalizers(values ...string) *RepositoryApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *RepositoryApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *RepositoryApplyConfiguration) WithSpec(value *RepositorySpecApplyConfiguration) *RepositoryApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *RepositoryApplyConfiguration) WithStatus(value *RepositoryStatusApplyConfiguration) *RepositoryApplyConfiguration { + b.Status = value + return b +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *RepositoryApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} diff --git a/pkg/generated/applyconfiguration/provisioning/v0alpha1/repositoryspec.go b/pkg/generated/applyconfiguration/provisioning/v0alpha1/repositoryspec.go new file mode 100644 index 00000000000..a1dd9ce6c07 --- /dev/null +++ b/pkg/generated/applyconfiguration/provisioning/v0alpha1/repositoryspec.go @@ -0,0 +1,110 @@ +// SPDX-License-Identifier: AGPL-3.0-only + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v0alpha1 + +import ( + provisioningv0alpha1 "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1" +) + +// RepositorySpecApplyConfiguration represents a declarative configuration of the RepositorySpec type for use +// with apply. +type RepositorySpecApplyConfiguration struct { + Title *string `json:"title,omitempty"` + Description *string `json:"description,omitempty"` + Folder *string `json:"folder,omitempty"` + PreferYAML *bool `json:"preferYaml,omitempty"` + Editing *EditingOptionsApplyConfiguration `json:"editing,omitempty"` + Type *provisioningv0alpha1.RepositoryType `json:"type,omitempty"` + Linting *bool `json:"linting,omitempty"` + Local *LocalRepositoryConfigApplyConfiguration `json:"local,omitempty"` + S3 *S3RepositoryConfigApplyConfiguration `json:"s3,omitempty"` + GitHub *GitHubRepositoryConfigApplyConfiguration `json:"github,omitempty"` +} + +// RepositorySpecApplyConfiguration constructs a declarative configuration of the RepositorySpec type for use with +// apply. +func RepositorySpec() *RepositorySpecApplyConfiguration { + return &RepositorySpecApplyConfiguration{} +} + +// WithTitle sets the Title field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Title field is set to the value of the last call. +func (b *RepositorySpecApplyConfiguration) WithTitle(value string) *RepositorySpecApplyConfiguration { + b.Title = &value + return b +} + +// WithDescription sets the Description field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Description field is set to the value of the last call. +func (b *RepositorySpecApplyConfiguration) WithDescription(value string) *RepositorySpecApplyConfiguration { + b.Description = &value + return b +} + +// WithFolder sets the Folder field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Folder field is set to the value of the last call. +func (b *RepositorySpecApplyConfiguration) WithFolder(value string) *RepositorySpecApplyConfiguration { + b.Folder = &value + return b +} + +// WithPreferYAML sets the PreferYAML field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PreferYAML field is set to the value of the last call. +func (b *RepositorySpecApplyConfiguration) WithPreferYAML(value bool) *RepositorySpecApplyConfiguration { + b.PreferYAML = &value + return b +} + +// WithEditing sets the Editing field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Editing field is set to the value of the last call. +func (b *RepositorySpecApplyConfiguration) WithEditing(value *EditingOptionsApplyConfiguration) *RepositorySpecApplyConfiguration { + b.Editing = value + return b +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *RepositorySpecApplyConfiguration) WithType(value provisioningv0alpha1.RepositoryType) *RepositorySpecApplyConfiguration { + b.Type = &value + return b +} + +// WithLinting sets the Linting field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Linting field is set to the value of the last call. +func (b *RepositorySpecApplyConfiguration) WithLinting(value bool) *RepositorySpecApplyConfiguration { + b.Linting = &value + return b +} + +// WithLocal sets the Local field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Local field is set to the value of the last call. +func (b *RepositorySpecApplyConfiguration) WithLocal(value *LocalRepositoryConfigApplyConfiguration) *RepositorySpecApplyConfiguration { + b.Local = value + return b +} + +// WithS3 sets the S3 field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the S3 field is set to the value of the last call. +func (b *RepositorySpecApplyConfiguration) WithS3(value *S3RepositoryConfigApplyConfiguration) *RepositorySpecApplyConfiguration { + b.S3 = value + return b +} + +// WithGitHub sets the GitHub field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GitHub field is set to the value of the last call. +func (b *RepositorySpecApplyConfiguration) WithGitHub(value *GitHubRepositoryConfigApplyConfiguration) *RepositorySpecApplyConfiguration { + b.GitHub = value + return b +} diff --git a/pkg/generated/applyconfiguration/provisioning/v0alpha1/repositorystatus.go b/pkg/generated/applyconfiguration/provisioning/v0alpha1/repositorystatus.go new file mode 100644 index 00000000000..73ed9c0d1cf --- /dev/null +++ b/pkg/generated/applyconfiguration/provisioning/v0alpha1/repositorystatus.go @@ -0,0 +1,52 @@ +// SPDX-License-Identifier: AGPL-3.0-only + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v0alpha1 + +// RepositoryStatusApplyConfiguration represents a declarative configuration of the RepositoryStatus type for use +// with apply. +type RepositoryStatusApplyConfiguration struct { + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` + Health *HealthStatusApplyConfiguration `json:"health,omitempty"` + Sync *SyncStatusApplyConfiguration `json:"sync,omitempty"` + Webhook *WebhookStatusApplyConfiguration `json:"webhook,omitempty"` +} + +// RepositoryStatusApplyConfiguration constructs a declarative configuration of the RepositoryStatus type for use with +// apply. +func RepositoryStatus() *RepositoryStatusApplyConfiguration { + return &RepositoryStatusApplyConfiguration{} +} + +// WithObservedGeneration sets the ObservedGeneration field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ObservedGeneration field is set to the value of the last call. +func (b *RepositoryStatusApplyConfiguration) WithObservedGeneration(value int64) *RepositoryStatusApplyConfiguration { + b.ObservedGeneration = &value + return b +} + +// WithHealth sets the Health field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Health field is set to the value of the last call. +func (b *RepositoryStatusApplyConfiguration) WithHealth(value *HealthStatusApplyConfiguration) *RepositoryStatusApplyConfiguration { + b.Health = value + return b +} + +// WithSync sets the Sync field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Sync field is set to the value of the last call. +func (b *RepositoryStatusApplyConfiguration) WithSync(value *SyncStatusApplyConfiguration) *RepositoryStatusApplyConfiguration { + b.Sync = value + return b +} + +// WithWebhook sets the Webhook field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Webhook field is set to the value of the last call. +func (b *RepositoryStatusApplyConfiguration) WithWebhook(value *WebhookStatusApplyConfiguration) *RepositoryStatusApplyConfiguration { + b.Webhook = value + return b +} diff --git a/pkg/generated/applyconfiguration/provisioning/v0alpha1/s3repositoryconfig.go b/pkg/generated/applyconfiguration/provisioning/v0alpha1/s3repositoryconfig.go new file mode 100644 index 00000000000..b33e875bd91 --- /dev/null +++ b/pkg/generated/applyconfiguration/provisioning/v0alpha1/s3repositoryconfig.go @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: AGPL-3.0-only + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v0alpha1 + +// S3RepositoryConfigApplyConfiguration represents a declarative configuration of the S3RepositoryConfig type for use +// with apply. +type S3RepositoryConfigApplyConfiguration struct { + Region *string `json:"region,omitempty"` + Bucket *string `json:"bucket,omitempty"` +} + +// S3RepositoryConfigApplyConfiguration constructs a declarative configuration of the S3RepositoryConfig type for use with +// apply. +func S3RepositoryConfig() *S3RepositoryConfigApplyConfiguration { + return &S3RepositoryConfigApplyConfiguration{} +} + +// WithRegion sets the Region field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Region field is set to the value of the last call. +func (b *S3RepositoryConfigApplyConfiguration) WithRegion(value string) *S3RepositoryConfigApplyConfiguration { + b.Region = &value + return b +} + +// WithBucket sets the Bucket field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Bucket field is set to the value of the last call. +func (b *S3RepositoryConfigApplyConfiguration) WithBucket(value string) *S3RepositoryConfigApplyConfiguration { + b.Bucket = &value + return b +} diff --git a/pkg/generated/applyconfiguration/provisioning/v0alpha1/syncstatus.go b/pkg/generated/applyconfiguration/provisioning/v0alpha1/syncstatus.go new file mode 100644 index 00000000000..76129b21998 --- /dev/null +++ b/pkg/generated/applyconfiguration/provisioning/v0alpha1/syncstatus.go @@ -0,0 +1,85 @@ +// SPDX-License-Identifier: AGPL-3.0-only + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v0alpha1 + +import ( + provisioningv0alpha1 "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1" +) + +// SyncStatusApplyConfiguration represents a declarative configuration of the SyncStatus type for use +// with apply. +type SyncStatusApplyConfiguration struct { + State *provisioningv0alpha1.JobState `json:"state,omitempty"` + JobID *string `json:"job,omitempty"` + Started *int64 `json:"started,omitempty"` + Finished *int64 `json:"finished,omitempty"` + Scheduled *int64 `json:"scheduled,omitempty"` + Message []string `json:"message,omitempty"` + Hash *string `json:"hash,omitempty"` +} + +// SyncStatusApplyConfiguration constructs a declarative configuration of the SyncStatus type for use with +// apply. +func SyncStatus() *SyncStatusApplyConfiguration { + return &SyncStatusApplyConfiguration{} +} + +// WithState sets the State field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the State field is set to the value of the last call. +func (b *SyncStatusApplyConfiguration) WithState(value provisioningv0alpha1.JobState) *SyncStatusApplyConfiguration { + b.State = &value + return b +} + +// WithJobID sets the JobID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the JobID field is set to the value of the last call. +func (b *SyncStatusApplyConfiguration) WithJobID(value string) *SyncStatusApplyConfiguration { + b.JobID = &value + return b +} + +// WithStarted sets the Started field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Started field is set to the value of the last call. +func (b *SyncStatusApplyConfiguration) WithStarted(value int64) *SyncStatusApplyConfiguration { + b.Started = &value + return b +} + +// WithFinished sets the Finished field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Finished field is set to the value of the last call. +func (b *SyncStatusApplyConfiguration) WithFinished(value int64) *SyncStatusApplyConfiguration { + b.Finished = &value + return b +} + +// WithScheduled sets the Scheduled field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Scheduled field is set to the value of the last call. +func (b *SyncStatusApplyConfiguration) WithScheduled(value int64) *SyncStatusApplyConfiguration { + b.Scheduled = &value + return b +} + +// WithMessage adds the given value to the Message field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Message field. +func (b *SyncStatusApplyConfiguration) WithMessage(values ...string) *SyncStatusApplyConfiguration { + for i := range values { + b.Message = append(b.Message, values[i]) + } + return b +} + +// WithHash sets the Hash field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Hash field is set to the value of the last call. +func (b *SyncStatusApplyConfiguration) WithHash(value string) *SyncStatusApplyConfiguration { + b.Hash = &value + return b +} diff --git a/pkg/generated/applyconfiguration/provisioning/v0alpha1/webhookstatus.go b/pkg/generated/applyconfiguration/provisioning/v0alpha1/webhookstatus.go new file mode 100644 index 00000000000..e42f7b9c134 --- /dev/null +++ b/pkg/generated/applyconfiguration/provisioning/v0alpha1/webhookstatus.go @@ -0,0 +1,54 @@ +// SPDX-License-Identifier: AGPL-3.0-only + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v0alpha1 + +// WebhookStatusApplyConfiguration represents a declarative configuration of the WebhookStatus type for use +// with apply. +type WebhookStatusApplyConfiguration struct { + ID *int64 `json:"id,omitempty"` + URL *string `json:"url,omitempty"` + Secret *string `json:"secret,omitempty"` + SubscribedEvents []string `json:"subscribedEvents,omitempty"` +} + +// WebhookStatusApplyConfiguration constructs a declarative configuration of the WebhookStatus type for use with +// apply. +func WebhookStatus() *WebhookStatusApplyConfiguration { + return &WebhookStatusApplyConfiguration{} +} + +// WithID sets the ID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ID field is set to the value of the last call. +func (b *WebhookStatusApplyConfiguration) WithID(value int64) *WebhookStatusApplyConfiguration { + b.ID = &value + return b +} + +// WithURL sets the URL field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the URL field is set to the value of the last call. +func (b *WebhookStatusApplyConfiguration) WithURL(value string) *WebhookStatusApplyConfiguration { + b.URL = &value + return b +} + +// WithSecret sets the Secret field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Secret field is set to the value of the last call. +func (b *WebhookStatusApplyConfiguration) WithSecret(value string) *WebhookStatusApplyConfiguration { + b.Secret = &value + return b +} + +// WithSubscribedEvents adds the given value to the SubscribedEvents field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the SubscribedEvents field. +func (b *WebhookStatusApplyConfiguration) WithSubscribedEvents(values ...string) *WebhookStatusApplyConfiguration { + for i := range values { + b.SubscribedEvents = append(b.SubscribedEvents, values[i]) + } + return b +} diff --git a/pkg/generated/applyconfiguration/utils.go b/pkg/generated/applyconfiguration/utils.go index d792c0be680..ca48543f341 100644 --- a/pkg/generated/applyconfiguration/utils.go +++ b/pkg/generated/applyconfiguration/utils.go @@ -5,9 +5,11 @@ package applyconfiguration import ( - v0alpha1 "github.com/grafana/grafana/pkg/apis/service/v0alpha1" + v0alpha1 "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1" + servicev0alpha1 "github.com/grafana/grafana/pkg/apis/service/v0alpha1" internal "github.com/grafana/grafana/pkg/generated/applyconfiguration/internal" - servicev0alpha1 "github.com/grafana/grafana/pkg/generated/applyconfiguration/service/v0alpha1" + provisioningv0alpha1 "github.com/grafana/grafana/pkg/generated/applyconfiguration/provisioning/v0alpha1" + applyconfigurationservicev0alpha1 "github.com/grafana/grafana/pkg/generated/applyconfiguration/service/v0alpha1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" testing "k8s.io/client-go/testing" @@ -17,11 +19,33 @@ import ( // apply configuration type exists for the given GroupVersionKind. func ForKind(kind schema.GroupVersionKind) interface{} { switch kind { - // Group=service.grafana.app, Version=v0alpha1 - case v0alpha1.SchemeGroupVersion.WithKind("ExternalName"): - return &servicev0alpha1.ExternalNameApplyConfiguration{} - case v0alpha1.SchemeGroupVersion.WithKind("ExternalNameSpec"): - return &servicev0alpha1.ExternalNameSpecApplyConfiguration{} + // Group=provisioning.grafana.app, Version=v0alpha1 + case v0alpha1.SchemeGroupVersion.WithKind("EditingOptions"): + return &provisioningv0alpha1.EditingOptionsApplyConfiguration{} + case v0alpha1.SchemeGroupVersion.WithKind("GitHubRepositoryConfig"): + return &provisioningv0alpha1.GitHubRepositoryConfigApplyConfiguration{} + case v0alpha1.SchemeGroupVersion.WithKind("HealthStatus"): + return &provisioningv0alpha1.HealthStatusApplyConfiguration{} + case v0alpha1.SchemeGroupVersion.WithKind("LocalRepositoryConfig"): + return &provisioningv0alpha1.LocalRepositoryConfigApplyConfiguration{} + case v0alpha1.SchemeGroupVersion.WithKind("Repository"): + return &provisioningv0alpha1.RepositoryApplyConfiguration{} + case v0alpha1.SchemeGroupVersion.WithKind("RepositorySpec"): + return &provisioningv0alpha1.RepositorySpecApplyConfiguration{} + case v0alpha1.SchemeGroupVersion.WithKind("RepositoryStatus"): + return &provisioningv0alpha1.RepositoryStatusApplyConfiguration{} + case v0alpha1.SchemeGroupVersion.WithKind("S3RepositoryConfig"): + return &provisioningv0alpha1.S3RepositoryConfigApplyConfiguration{} + case v0alpha1.SchemeGroupVersion.WithKind("SyncStatus"): + return &provisioningv0alpha1.SyncStatusApplyConfiguration{} + case v0alpha1.SchemeGroupVersion.WithKind("WebhookStatus"): + return &provisioningv0alpha1.WebhookStatusApplyConfiguration{} + + // Group=service.grafana.app, Version=v0alpha1 + case servicev0alpha1.SchemeGroupVersion.WithKind("ExternalName"): + return &applyconfigurationservicev0alpha1.ExternalNameApplyConfiguration{} + case servicev0alpha1.SchemeGroupVersion.WithKind("ExternalNameSpec"): + return &applyconfigurationservicev0alpha1.ExternalNameSpecApplyConfiguration{} } return nil diff --git a/pkg/generated/clientset/versioned/clientset.go b/pkg/generated/clientset/versioned/clientset.go index 972fed70d47..ad40ccbcfed 100644 --- a/pkg/generated/clientset/versioned/clientset.go +++ b/pkg/generated/clientset/versioned/clientset.go @@ -8,6 +8,7 @@ import ( fmt "fmt" http "net/http" + provisioningv0alpha1 "github.com/grafana/grafana/pkg/generated/clientset/versioned/typed/provisioning/v0alpha1" servicev0alpha1 "github.com/grafana/grafana/pkg/generated/clientset/versioned/typed/service/v0alpha1" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" @@ -16,13 +17,20 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface + ProvisioningV0alpha1() provisioningv0alpha1.ProvisioningV0alpha1Interface ServiceV0alpha1() servicev0alpha1.ServiceV0alpha1Interface } // Clientset contains the clients for groups. type Clientset struct { *discovery.DiscoveryClient - serviceV0alpha1 *servicev0alpha1.ServiceV0alpha1Client + provisioningV0alpha1 *provisioningv0alpha1.ProvisioningV0alpha1Client + serviceV0alpha1 *servicev0alpha1.ServiceV0alpha1Client +} + +// ProvisioningV0alpha1 retrieves the ProvisioningV0alpha1Client +func (c *Clientset) ProvisioningV0alpha1() provisioningv0alpha1.ProvisioningV0alpha1Interface { + return c.provisioningV0alpha1 } // ServiceV0alpha1 retrieves the ServiceV0alpha1Client @@ -74,6 +82,10 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, var cs Clientset var err error + cs.provisioningV0alpha1, err = provisioningv0alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } cs.serviceV0alpha1, err = servicev0alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err @@ -99,6 +111,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { // New creates a new Clientset for the given RESTClient. func New(c rest.Interface) *Clientset { var cs Clientset + cs.provisioningV0alpha1 = provisioningv0alpha1.New(c) cs.serviceV0alpha1 = servicev0alpha1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) diff --git a/pkg/generated/clientset/versioned/fake/clientset_generated.go b/pkg/generated/clientset/versioned/fake/clientset_generated.go index 0db3aa0390a..3a8cf9c1302 100644 --- a/pkg/generated/clientset/versioned/fake/clientset_generated.go +++ b/pkg/generated/clientset/versioned/fake/clientset_generated.go @@ -7,6 +7,8 @@ package fake import ( applyconfiguration "github.com/grafana/grafana/pkg/generated/applyconfiguration" clientset "github.com/grafana/grafana/pkg/generated/clientset/versioned" + provisioningv0alpha1 "github.com/grafana/grafana/pkg/generated/clientset/versioned/typed/provisioning/v0alpha1" + fakeprovisioningv0alpha1 "github.com/grafana/grafana/pkg/generated/clientset/versioned/typed/provisioning/v0alpha1/fake" servicev0alpha1 "github.com/grafana/grafana/pkg/generated/clientset/versioned/typed/service/v0alpha1" fakeservicev0alpha1 "github.com/grafana/grafana/pkg/generated/clientset/versioned/typed/service/v0alpha1/fake" "k8s.io/apimachinery/pkg/runtime" @@ -102,6 +104,11 @@ var ( _ testing.FakeClient = &Clientset{} ) +// ProvisioningV0alpha1 retrieves the ProvisioningV0alpha1Client +func (c *Clientset) ProvisioningV0alpha1() provisioningv0alpha1.ProvisioningV0alpha1Interface { + return &fakeprovisioningv0alpha1.FakeProvisioningV0alpha1{Fake: &c.Fake} +} + // ServiceV0alpha1 retrieves the ServiceV0alpha1Client func (c *Clientset) ServiceV0alpha1() servicev0alpha1.ServiceV0alpha1Interface { return &fakeservicev0alpha1.FakeServiceV0alpha1{Fake: &c.Fake} diff --git a/pkg/generated/clientset/versioned/fake/register.go b/pkg/generated/clientset/versioned/fake/register.go index bbf12658e76..d64a8572697 100644 --- a/pkg/generated/clientset/versioned/fake/register.go +++ b/pkg/generated/clientset/versioned/fake/register.go @@ -5,6 +5,7 @@ package fake import ( + provisioningv0alpha1 "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1" servicev0alpha1 "github.com/grafana/grafana/pkg/apis/service/v0alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" @@ -17,6 +18,7 @@ var scheme = runtime.NewScheme() var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ + provisioningv0alpha1.AddToScheme, servicev0alpha1.AddToScheme, } diff --git a/pkg/generated/clientset/versioned/scheme/register.go b/pkg/generated/clientset/versioned/scheme/register.go index dd6e9619160..0aa0fb1be43 100644 --- a/pkg/generated/clientset/versioned/scheme/register.go +++ b/pkg/generated/clientset/versioned/scheme/register.go @@ -5,6 +5,7 @@ package scheme import ( + provisioningv0alpha1 "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1" servicev0alpha1 "github.com/grafana/grafana/pkg/apis/service/v0alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" @@ -17,6 +18,7 @@ var Scheme = runtime.NewScheme() var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ + provisioningv0alpha1.AddToScheme, servicev0alpha1.AddToScheme, } diff --git a/pkg/generated/clientset/versioned/typed/provisioning/v0alpha1/doc.go b/pkg/generated/clientset/versioned/typed/provisioning/v0alpha1/doc.go new file mode 100644 index 00000000000..1c86744fecc --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/provisioning/v0alpha1/doc.go @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: AGPL-3.0-only + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v0alpha1 diff --git a/pkg/generated/clientset/versioned/typed/provisioning/v0alpha1/fake/doc.go b/pkg/generated/clientset/versioned/typed/provisioning/v0alpha1/fake/doc.go new file mode 100644 index 00000000000..d96b985b3ea --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/provisioning/v0alpha1/fake/doc.go @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: AGPL-3.0-only + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/generated/clientset/versioned/typed/provisioning/v0alpha1/fake/fake_provisioning_client.go b/pkg/generated/clientset/versioned/typed/provisioning/v0alpha1/fake/fake_provisioning_client.go new file mode 100644 index 00000000000..eb97df6de39 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/provisioning/v0alpha1/fake/fake_provisioning_client.go @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: AGPL-3.0-only + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v0alpha1 "github.com/grafana/grafana/pkg/generated/clientset/versioned/typed/provisioning/v0alpha1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeProvisioningV0alpha1 struct { + *testing.Fake +} + +func (c *FakeProvisioningV0alpha1) Repositories(namespace string) v0alpha1.RepositoryInterface { + return newFakeRepositories(c, namespace) +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeProvisioningV0alpha1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/generated/clientset/versioned/typed/provisioning/v0alpha1/fake/fake_repository.go b/pkg/generated/clientset/versioned/typed/provisioning/v0alpha1/fake/fake_repository.go new file mode 100644 index 00000000000..3991d3c4ea8 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/provisioning/v0alpha1/fake/fake_repository.go @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: AGPL-3.0-only + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v0alpha1 "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1" + provisioningv0alpha1 "github.com/grafana/grafana/pkg/generated/applyconfiguration/provisioning/v0alpha1" + typedprovisioningv0alpha1 "github.com/grafana/grafana/pkg/generated/clientset/versioned/typed/provisioning/v0alpha1" + gentype "k8s.io/client-go/gentype" +) + +// fakeRepositories implements RepositoryInterface +type fakeRepositories struct { + *gentype.FakeClientWithListAndApply[*v0alpha1.Repository, *v0alpha1.RepositoryList, *provisioningv0alpha1.RepositoryApplyConfiguration] + Fake *FakeProvisioningV0alpha1 +} + +func newFakeRepositories(fake *FakeProvisioningV0alpha1, namespace string) typedprovisioningv0alpha1.RepositoryInterface { + return &fakeRepositories{ + gentype.NewFakeClientWithListAndApply[*v0alpha1.Repository, *v0alpha1.RepositoryList, *provisioningv0alpha1.RepositoryApplyConfiguration]( + fake.Fake, + namespace, + v0alpha1.SchemeGroupVersion.WithResource("repositories"), + v0alpha1.SchemeGroupVersion.WithKind("Repository"), + func() *v0alpha1.Repository { return &v0alpha1.Repository{} }, + func() *v0alpha1.RepositoryList { return &v0alpha1.RepositoryList{} }, + func(dst, src *v0alpha1.RepositoryList) { dst.ListMeta = src.ListMeta }, + func(list *v0alpha1.RepositoryList) []*v0alpha1.Repository { return gentype.ToPointerSlice(list.Items) }, + func(list *v0alpha1.RepositoryList, items []*v0alpha1.Repository) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, + } +} diff --git a/pkg/generated/clientset/versioned/typed/provisioning/v0alpha1/generated_expansion.go b/pkg/generated/clientset/versioned/typed/provisioning/v0alpha1/generated_expansion.go new file mode 100644 index 00000000000..2e9e7e51d5b --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/provisioning/v0alpha1/generated_expansion.go @@ -0,0 +1,7 @@ +// SPDX-License-Identifier: AGPL-3.0-only + +// Code generated by client-gen. DO NOT EDIT. + +package v0alpha1 + +type RepositoryExpansion interface{} diff --git a/pkg/generated/clientset/versioned/typed/provisioning/v0alpha1/provisioning_client.go b/pkg/generated/clientset/versioned/typed/provisioning/v0alpha1/provisioning_client.go new file mode 100644 index 00000000000..f74abfaed38 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/provisioning/v0alpha1/provisioning_client.go @@ -0,0 +1,93 @@ +// SPDX-License-Identifier: AGPL-3.0-only + +// Code generated by client-gen. DO NOT EDIT. + +package v0alpha1 + +import ( + http "net/http" + + provisioningv0alpha1 "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1" + scheme "github.com/grafana/grafana/pkg/generated/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" +) + +type ProvisioningV0alpha1Interface interface { + RESTClient() rest.Interface + RepositoriesGetter +} + +// ProvisioningV0alpha1Client is used to interact with features provided by the provisioning.grafana.app group. +type ProvisioningV0alpha1Client struct { + restClient rest.Interface +} + +func (c *ProvisioningV0alpha1Client) Repositories(namespace string) RepositoryInterface { + return newRepositories(c, namespace) +} + +// NewForConfig creates a new ProvisioningV0alpha1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*ProvisioningV0alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new ProvisioningV0alpha1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*ProvisioningV0alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &ProvisioningV0alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new ProvisioningV0alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *ProvisioningV0alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new ProvisioningV0alpha1Client for the given RESTClient. +func New(c rest.Interface) *ProvisioningV0alpha1Client { + return &ProvisioningV0alpha1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := provisioningv0alpha1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *ProvisioningV0alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/generated/clientset/versioned/typed/provisioning/v0alpha1/repository.go b/pkg/generated/clientset/versioned/typed/provisioning/v0alpha1/repository.go new file mode 100644 index 00000000000..9425083857b --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/provisioning/v0alpha1/repository.go @@ -0,0 +1,60 @@ +// SPDX-License-Identifier: AGPL-3.0-only + +// Code generated by client-gen. DO NOT EDIT. + +package v0alpha1 + +import ( + context "context" + + provisioningv0alpha1 "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1" + applyconfigurationprovisioningv0alpha1 "github.com/grafana/grafana/pkg/generated/applyconfiguration/provisioning/v0alpha1" + scheme "github.com/grafana/grafana/pkg/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// RepositoriesGetter has a method to return a RepositoryInterface. +// A group's client should implement this interface. +type RepositoriesGetter interface { + Repositories(namespace string) RepositoryInterface +} + +// RepositoryInterface has methods to work with Repository resources. +type RepositoryInterface interface { + Create(ctx context.Context, repository *provisioningv0alpha1.Repository, opts v1.CreateOptions) (*provisioningv0alpha1.Repository, error) + Update(ctx context.Context, repository *provisioningv0alpha1.Repository, opts v1.UpdateOptions) (*provisioningv0alpha1.Repository, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, repository *provisioningv0alpha1.Repository, opts v1.UpdateOptions) (*provisioningv0alpha1.Repository, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*provisioningv0alpha1.Repository, error) + List(ctx context.Context, opts v1.ListOptions) (*provisioningv0alpha1.RepositoryList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *provisioningv0alpha1.Repository, err error) + Apply(ctx context.Context, repository *applyconfigurationprovisioningv0alpha1.RepositoryApplyConfiguration, opts v1.ApplyOptions) (result *provisioningv0alpha1.Repository, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). + ApplyStatus(ctx context.Context, repository *applyconfigurationprovisioningv0alpha1.RepositoryApplyConfiguration, opts v1.ApplyOptions) (result *provisioningv0alpha1.Repository, err error) + RepositoryExpansion +} + +// repositories implements RepositoryInterface +type repositories struct { + *gentype.ClientWithListAndApply[*provisioningv0alpha1.Repository, *provisioningv0alpha1.RepositoryList, *applyconfigurationprovisioningv0alpha1.RepositoryApplyConfiguration] +} + +// newRepositories returns a Repositories +func newRepositories(c *ProvisioningV0alpha1Client, namespace string) *repositories { + return &repositories{ + gentype.NewClientWithListAndApply[*provisioningv0alpha1.Repository, *provisioningv0alpha1.RepositoryList, *applyconfigurationprovisioningv0alpha1.RepositoryApplyConfiguration]( + "repositories", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *provisioningv0alpha1.Repository { return &provisioningv0alpha1.Repository{} }, + func() *provisioningv0alpha1.RepositoryList { return &provisioningv0alpha1.RepositoryList{} }, + ), + } +} diff --git a/pkg/generated/informers/externalversions/factory.go b/pkg/generated/informers/externalversions/factory.go index 93a498c5d2a..86ef036dae3 100644 --- a/pkg/generated/informers/externalversions/factory.go +++ b/pkg/generated/informers/externalversions/factory.go @@ -11,6 +11,7 @@ import ( versioned "github.com/grafana/grafana/pkg/generated/clientset/versioned" internalinterfaces "github.com/grafana/grafana/pkg/generated/informers/externalversions/internalinterfaces" + provisioning "github.com/grafana/grafana/pkg/generated/informers/externalversions/provisioning" service "github.com/grafana/grafana/pkg/generated/informers/externalversions/service" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" @@ -240,9 +241,14 @@ type SharedInformerFactory interface { // client. InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer + Provisioning() provisioning.Interface Service() service.Interface } +func (f *sharedInformerFactory) Provisioning() provisioning.Interface { + return provisioning.New(f, f.namespace, f.tweakListOptions) +} + func (f *sharedInformerFactory) Service() service.Interface { return service.New(f, f.namespace, f.tweakListOptions) } diff --git a/pkg/generated/informers/externalversions/generic.go b/pkg/generated/informers/externalversions/generic.go index 9731bd8cbf2..676e6b91f8d 100644 --- a/pkg/generated/informers/externalversions/generic.go +++ b/pkg/generated/informers/externalversions/generic.go @@ -7,7 +7,8 @@ package externalversions import ( fmt "fmt" - v0alpha1 "github.com/grafana/grafana/pkg/apis/service/v0alpha1" + v0alpha1 "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1" + servicev0alpha1 "github.com/grafana/grafana/pkg/apis/service/v0alpha1" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" ) @@ -38,8 +39,12 @@ func (f *genericInformer) Lister() cache.GenericLister { // TODO extend this to unknown resources with a client pool func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { switch resource { - // Group=service.grafana.app, Version=v0alpha1 - case v0alpha1.SchemeGroupVersion.WithResource("externalnames"): + // Group=provisioning.grafana.app, Version=v0alpha1 + case v0alpha1.SchemeGroupVersion.WithResource("repositories"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Provisioning().V0alpha1().Repositories().Informer()}, nil + + // Group=service.grafana.app, Version=v0alpha1 + case servicev0alpha1.SchemeGroupVersion.WithResource("externalnames"): return &genericInformer{resource: resource.GroupResource(), informer: f.Service().V0alpha1().ExternalNames().Informer()}, nil } diff --git a/pkg/generated/informers/externalversions/provisioning/interface.go b/pkg/generated/informers/externalversions/provisioning/interface.go new file mode 100644 index 00000000000..851568050e0 --- /dev/null +++ b/pkg/generated/informers/externalversions/provisioning/interface.go @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: AGPL-3.0-only + +// Code generated by informer-gen. DO NOT EDIT. + +package provisioning + +import ( + internalinterfaces "github.com/grafana/grafana/pkg/generated/informers/externalversions/internalinterfaces" + v0alpha1 "github.com/grafana/grafana/pkg/generated/informers/externalversions/provisioning/v0alpha1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V0alpha1 provides access to shared informers for resources in V0alpha1. + V0alpha1() v0alpha1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V0alpha1 returns a new v0alpha1.Interface. +func (g *group) V0alpha1() v0alpha1.Interface { + return v0alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/generated/informers/externalversions/provisioning/v0alpha1/interface.go b/pkg/generated/informers/externalversions/provisioning/v0alpha1/interface.go new file mode 100644 index 00000000000..51060296a02 --- /dev/null +++ b/pkg/generated/informers/externalversions/provisioning/v0alpha1/interface.go @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: AGPL-3.0-only + +// Code generated by informer-gen. DO NOT EDIT. + +package v0alpha1 + +import ( + internalinterfaces "github.com/grafana/grafana/pkg/generated/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Repositories returns a RepositoryInformer. + Repositories() RepositoryInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Repositories returns a RepositoryInformer. +func (v *version) Repositories() RepositoryInformer { + return &repositoryInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/generated/informers/externalversions/provisioning/v0alpha1/repository.go b/pkg/generated/informers/externalversions/provisioning/v0alpha1/repository.go new file mode 100644 index 00000000000..33396626e33 --- /dev/null +++ b/pkg/generated/informers/externalversions/provisioning/v0alpha1/repository.go @@ -0,0 +1,76 @@ +// SPDX-License-Identifier: AGPL-3.0-only + +// Code generated by informer-gen. DO NOT EDIT. + +package v0alpha1 + +import ( + context "context" + time "time" + + apisprovisioningv0alpha1 "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1" + versioned "github.com/grafana/grafana/pkg/generated/clientset/versioned" + internalinterfaces "github.com/grafana/grafana/pkg/generated/informers/externalversions/internalinterfaces" + provisioningv0alpha1 "github.com/grafana/grafana/pkg/generated/listers/provisioning/v0alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// RepositoryInformer provides access to a shared informer and lister for +// Repositories. +type RepositoryInformer interface { + Informer() cache.SharedIndexInformer + Lister() provisioningv0alpha1.RepositoryLister +} + +type repositoryInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewRepositoryInformer constructs a new informer for Repository type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRepositoryInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRepositoryInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredRepositoryInformer constructs a new informer for Repository type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredRepositoryInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ProvisioningV0alpha1().Repositories(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ProvisioningV0alpha1().Repositories(namespace).Watch(context.TODO(), options) + }, + }, + &apisprovisioningv0alpha1.Repository{}, + resyncPeriod, + indexers, + ) +} + +func (f *repositoryInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRepositoryInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *repositoryInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&apisprovisioningv0alpha1.Repository{}, f.defaultInformer) +} + +func (f *repositoryInformer) Lister() provisioningv0alpha1.RepositoryLister { + return provisioningv0alpha1.NewRepositoryLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/listers/provisioning/v0alpha1/expansion_generated.go b/pkg/generated/listers/provisioning/v0alpha1/expansion_generated.go new file mode 100644 index 00000000000..118fae5b629 --- /dev/null +++ b/pkg/generated/listers/provisioning/v0alpha1/expansion_generated.go @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: AGPL-3.0-only + +// Code generated by lister-gen. DO NOT EDIT. + +package v0alpha1 + +// RepositoryListerExpansion allows custom methods to be added to +// RepositoryLister. +type RepositoryListerExpansion interface{} + +// RepositoryNamespaceListerExpansion allows custom methods to be added to +// RepositoryNamespaceLister. +type RepositoryNamespaceListerExpansion interface{} diff --git a/pkg/generated/listers/provisioning/v0alpha1/repository.go b/pkg/generated/listers/provisioning/v0alpha1/repository.go new file mode 100644 index 00000000000..969cb034e88 --- /dev/null +++ b/pkg/generated/listers/provisioning/v0alpha1/repository.go @@ -0,0 +1,56 @@ +// SPDX-License-Identifier: AGPL-3.0-only + +// Code generated by lister-gen. DO NOT EDIT. + +package v0alpha1 + +import ( + provisioningv0alpha1 "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" +) + +// RepositoryLister helps list Repositories. +// All objects returned here must be treated as read-only. +type RepositoryLister interface { + // List lists all Repositories in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*provisioningv0alpha1.Repository, err error) + // Repositories returns an object that can list and get Repositories. + Repositories(namespace string) RepositoryNamespaceLister + RepositoryListerExpansion +} + +// repositoryLister implements the RepositoryLister interface. +type repositoryLister struct { + listers.ResourceIndexer[*provisioningv0alpha1.Repository] +} + +// NewRepositoryLister returns a new RepositoryLister. +func NewRepositoryLister(indexer cache.Indexer) RepositoryLister { + return &repositoryLister{listers.New[*provisioningv0alpha1.Repository](indexer, provisioningv0alpha1.Resource("repository"))} +} + +// Repositories returns an object that can list and get Repositories. +func (s *repositoryLister) Repositories(namespace string) RepositoryNamespaceLister { + return repositoryNamespaceLister{listers.NewNamespaced[*provisioningv0alpha1.Repository](s.ResourceIndexer, namespace)} +} + +// RepositoryNamespaceLister helps list and get Repositories. +// All objects returned here must be treated as read-only. +type RepositoryNamespaceLister interface { + // List lists all Repositories in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*provisioningv0alpha1.Repository, err error) + // Get retrieves the Repository from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*provisioningv0alpha1.Repository, error) + RepositoryNamespaceListerExpansion +} + +// repositoryNamespaceLister implements the RepositoryNamespaceLister +// interface. +type repositoryNamespaceLister struct { + listers.ResourceIndexer[*provisioningv0alpha1.Repository] +} From 78fda78a5696262261bc4aaee5b1b055a9f83cbc Mon Sep 17 00:00:00 2001 From: Eric Leijonmarck Date: Thu, 9 Jan 2025 15:12:32 +0100 Subject: [PATCH 7/7] LBAC for datasources: Extend docs to direct to our terraform provider for provisioning of lbac rules (#98678) * update docs to direct to our terraform provider for provisioning * run prettier * Update _index.md --------- Co-authored-by: Irene Rodriguez --- .../administration/data-source-management/teamlbac/_index.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/sources/administration/data-source-management/teamlbac/_index.md b/docs/sources/administration/data-source-management/teamlbac/_index.md index 48681fd4511..ac801cf9d18 100644 --- a/docs/sources/administration/data-source-management/teamlbac/_index.md +++ b/docs/sources/administration/data-source-management/teamlbac/_index.md @@ -92,3 +92,7 @@ Query results include lines that match any of the rules. Only users with data source `Admin` permissions can edit LBAC for data sources rules in the **Data source permissions** tab because changing LBAC rules requires the same access level as editing data source permissions. To set up LBAC for data sources for a data source, refer to [Configure LBAC for data sources](https://grafana.com/docs/grafana//administration/data-source-management/teamlbac/configure-teamlbac-for-loki/). + +## Provisioning of LBAC rules + +We recommend using our Terraform provider to set up provisioning for [Resource data source config LBAC rules] (https://registry.terraform.io/providers/grafana/grafana/latest/docs/resources/data_source_config_lbac_rules). Refer to our provider documentation to learn how to configure rules for a data source.