@kyverno/backstage-plugin-policy-reporter-common 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @kyverno/backstage-plugin-policy-reporter-common
2
2
 
3
+ ## 2.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 93bf028: Added namespace filtering to the `PolicyReportsPage`. Users can now filter the list of policy reports by selecting one or more namespaces from the selected cluster.
8
+
3
9
  ## 2.1.0
4
10
 
5
11
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -123,6 +123,17 @@ type GetNamespacedResults = {
123
123
  direction?: Direction;
124
124
  };
125
125
  };
126
+ /**
127
+ * @public
128
+ */
129
+ type GetNamespaces = {
130
+ query: {
131
+ environment: string;
132
+ sources?: Array<string>;
133
+ categories?: Array<string>;
134
+ policies?: Array<string>;
135
+ };
136
+ };
126
137
  /**
127
138
  * @public
128
139
  */
@@ -156,6 +167,15 @@ declare class DefaultApiClient {
156
167
  * @param direction - Sort direction for results
157
168
  */
158
169
  getNamespacedResults(request: GetNamespacedResults, options?: RequestOptions): Promise<TypedResponse<ResultList>>;
170
+ /**
171
+ * Retrieves a list of namespaces from the policies
172
+ * Get namespaces
173
+ * @param environment - The environment entity reference (URL encoded)
174
+ * @param sources - Filter by a list of sources
175
+ * @param categories - Filter by a list of categories
176
+ * @param policies - Filter by a list of policies
177
+ */
178
+ getNamespaces(request: GetNamespaces, options?: RequestOptions): Promise<TypedResponse<Array<string>>>;
159
179
  }
160
180
 
161
181
  /**
@@ -235,4 +255,4 @@ interface RequestError {
235
255
  error: string;
236
256
  }
237
257
 
238
- export { DefaultApiClient, type Direction, type Environment, type Filter, type GetNamespacedResults, KUBERNETES_NAMESPACE_ANNOTATION, KYVERNO_ENDPOINT_ANNOTATION, KYVERNO_KIND_ANNOTATION, KYVERNO_NAMESPACE_ANNOTATION, KYVERNO_RESOURCE_NAME_ANNOTATION, type ListResult, type Pagination, type RequestError, type RequestOptions, type ResultList, type Severity, type Status, type TypedResponse };
258
+ export { DefaultApiClient, type Direction, type Environment, type Filter, type GetNamespacedResults, type GetNamespaces, KUBERNETES_NAMESPACE_ANNOTATION, KYVERNO_ENDPOINT_ANNOTATION, KYVERNO_KIND_ANNOTATION, KYVERNO_NAMESPACE_ANNOTATION, KYVERNO_RESOURCE_NAME_ANNOTATION, type ListResult, type Pagination, type RequestError, type RequestOptions, type ResultList, type Severity, type Status, type TypedResponse };
@@ -66,6 +66,28 @@ class DefaultApiClient {
66
66
  method: "GET"
67
67
  });
68
68
  }
69
+ /**
70
+ * Retrieves a list of namespaces from the policies
71
+ * Get namespaces
72
+ * @param environment - The environment entity reference (URL encoded)
73
+ * @param sources - Filter by a list of sources
74
+ * @param categories - Filter by a list of categories
75
+ * @param policies - Filter by a list of policies
76
+ */
77
+ async getNamespaces(request, options) {
78
+ const baseUrl = await this.discoveryApi.getBaseUrl(pluginId.pluginId);
79
+ const uriTemplate = `/v1/namespaces{?environment,sources*,categories*,policies*}`;
80
+ const uri = parser__namespace.parse(uriTemplate).expand({
81
+ ...request.query
82
+ });
83
+ return await this.fetchApi.fetch(`${baseUrl}${uri}`, {
84
+ headers: {
85
+ "Content-Type": "application/json",
86
+ ...options?.token && { Authorization: `Bearer ${options?.token}` }
87
+ },
88
+ method: "GET"
89
+ });
90
+ }
69
91
  }
70
92
 
71
93
  exports.DefaultApiClient = DefaultApiClient;
@@ -1 +1 @@
1
- {"version":3,"file":"Api.client.cjs.js","sources":["../../../../../src/schema/openapi/generated/apis/Api.client.ts"],"sourcesContent":["//\n\n// ******************************************************************\n// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. *\n// ******************************************************************\nimport { DiscoveryApi } from '../types/discovery';\nimport { FetchApi } from '../types/fetch';\nimport crossFetch from 'cross-fetch';\nimport { pluginId } from '../pluginId';\nimport * as parser from 'uri-template';\nimport { Direction } from '../models/Direction.model';\nimport { ResultList } from '../models/ResultList.model';\nimport { Severity } from '../models/Severity.model';\nimport { Status } from '../models/Status.model';\n\n/**\n * Wraps the Response type to convey a type on the json call.\n *\n * @public\n */\nexport type TypedResponse<T> = Omit<Response, 'json'> & {\n json: () => Promise<T>;\n};\n\n/**\n * Options you can pass into a request for additional information.\n *\n * @public\n */\nexport interface RequestOptions {\n token?: string;\n}\n/**\n * @public\n */\nexport type GetNamespacedResults = {\n query: {\n environment: string;\n sources?: Array<string>;\n namespaces?: Array<string>;\n kinds?: Array<string>;\n resources?: Array<string>;\n categories?: Array<string>;\n policies?: Array<string>;\n status?: Array<Status>;\n severities?: Array<Severity>;\n search?: string;\n labels?: Array<string>;\n page?: number;\n offset?: number;\n direction?: Direction;\n };\n};\n\n/**\n * @public\n */\nexport class DefaultApiClient {\n private readonly discoveryApi: DiscoveryApi;\n private readonly fetchApi: FetchApi;\n\n constructor(options: {\n discoveryApi: { getBaseUrl(pluginId: string): Promise<string> };\n fetchApi?: { fetch: typeof fetch };\n }) {\n this.discoveryApi = options.discoveryApi;\n this.fetchApi = options.fetchApi || { fetch: crossFetch };\n }\n\n /**\n * Retrieves policy results for a specific environment with optional filtering and pagination\n * Get namespaced policy results\n * @param environment - The environment entity reference (URL encoded)\n * @param sources - Filter by a list of sources\n * @param namespaces - Filter by a list of namespaces\n * @param kinds - Filter by a list of Kubernetes resource kinds\n * @param resources - Filter by a list of resources\n * @param categories - Filter by a list of categories\n * @param policies - Filter by a list of policies\n * @param status - Filter by policy result status\n * @param severities - Filter by severity levels\n * @param search - Search string to filter results\n * @param labels - Filter by label-value pairs\n * @param page - Requested list page number\n * @param offset - Number of results per page\n * @param direction - Sort direction for results\n */\n public async getNamespacedResults(\n // @ts-ignore\n request: GetNamespacedResults,\n options?: RequestOptions,\n ): Promise<TypedResponse<ResultList>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/namespaced-resources/results{?environment,sources*,namespaces*,kinds*,resources*,categories*,policies*,status*,severities*,search,labels*,page,offset,direction}`;\n\n const uri = parser.parse(uriTemplate).expand({\n ...request.query,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n}\n"],"names":["crossFetch","pluginId","parser"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDO,MAAM,gBAAiB,CAAA;AAAA,EACX,YAAA;AAAA,EACA,QAAA;AAAA,EAEjB,YAAY,OAGT,EAAA;AACD,IAAA,IAAA,CAAK,eAAe,OAAQ,CAAA,YAAA;AAC5B,IAAA,IAAA,CAAK,QAAW,GAAA,OAAA,CAAQ,QAAY,IAAA,EAAE,OAAOA,2BAAW,EAAA;AAAA;AAC1D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoBA,MAAa,oBAEX,CAAA,OAAA,EACA,OACoC,EAAA;AACpC,IAAA,MAAM,OAAU,GAAA,MAAM,IAAK,CAAA,YAAA,CAAa,WAAWC,iBAAQ,CAAA;AAE3D,IAAA,MAAM,WAAc,GAAA,CAAA,iKAAA,CAAA;AAEpB,IAAA,MAAM,GAAM,GAAAC,iBAAA,CAAO,KAAM,CAAA,WAAW,EAAE,MAAO,CAAA;AAAA,MAC3C,GAAG,OAAQ,CAAA;AAAA,KACZ,CAAA;AAED,IAAO,OAAA,MAAM,KAAK,QAAS,CAAA,KAAA,CAAM,GAAG,OAAO,CAAA,EAAG,GAAG,CAAI,CAAA,EAAA;AAAA,MACnD,OAAS,EAAA;AAAA,QACP,cAAgB,EAAA,kBAAA;AAAA,QAChB,GAAI,SAAS,KAAS,IAAA,EAAE,eAAe,CAAU,OAAA,EAAA,OAAA,EAAS,KAAK,CAAG,CAAA;AAAA,OACpE;AAAA,MACA,MAAQ,EAAA;AAAA,KACT,CAAA;AAAA;AAEL;;;;"}
1
+ {"version":3,"file":"Api.client.cjs.js","sources":["../../../../../src/schema/openapi/generated/apis/Api.client.ts"],"sourcesContent":["//\n\n// ******************************************************************\n// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. *\n// ******************************************************************\nimport { DiscoveryApi } from '../types/discovery';\nimport { FetchApi } from '../types/fetch';\nimport crossFetch from 'cross-fetch';\nimport { pluginId } from '../pluginId';\nimport * as parser from 'uri-template';\nimport { Direction } from '../models/Direction.model';\nimport { ResultList } from '../models/ResultList.model';\nimport { Severity } from '../models/Severity.model';\nimport { Status } from '../models/Status.model';\n\n/**\n * Wraps the Response type to convey a type on the json call.\n *\n * @public\n */\nexport type TypedResponse<T> = Omit<Response, 'json'> & {\n json: () => Promise<T>;\n};\n\n/**\n * Options you can pass into a request for additional information.\n *\n * @public\n */\nexport interface RequestOptions {\n token?: string;\n}\n/**\n * @public\n */\nexport type GetNamespacedResults = {\n query: {\n environment: string;\n sources?: Array<string>;\n namespaces?: Array<string>;\n kinds?: Array<string>;\n resources?: Array<string>;\n categories?: Array<string>;\n policies?: Array<string>;\n status?: Array<Status>;\n severities?: Array<Severity>;\n search?: string;\n labels?: Array<string>;\n page?: number;\n offset?: number;\n direction?: Direction;\n };\n};\n/**\n * @public\n */\nexport type GetNamespaces = {\n query: {\n environment: string;\n sources?: Array<string>;\n categories?: Array<string>;\n policies?: Array<string>;\n };\n};\n\n/**\n * @public\n */\nexport class DefaultApiClient {\n private readonly discoveryApi: DiscoveryApi;\n private readonly fetchApi: FetchApi;\n\n constructor(options: {\n discoveryApi: { getBaseUrl(pluginId: string): Promise<string> };\n fetchApi?: { fetch: typeof fetch };\n }) {\n this.discoveryApi = options.discoveryApi;\n this.fetchApi = options.fetchApi || { fetch: crossFetch };\n }\n\n /**\n * Retrieves policy results for a specific environment with optional filtering and pagination\n * Get namespaced policy results\n * @param environment - The environment entity reference (URL encoded)\n * @param sources - Filter by a list of sources\n * @param namespaces - Filter by a list of namespaces\n * @param kinds - Filter by a list of Kubernetes resource kinds\n * @param resources - Filter by a list of resources\n * @param categories - Filter by a list of categories\n * @param policies - Filter by a list of policies\n * @param status - Filter by policy result status\n * @param severities - Filter by severity levels\n * @param search - Search string to filter results\n * @param labels - Filter by label-value pairs\n * @param page - Requested list page number\n * @param offset - Number of results per page\n * @param direction - Sort direction for results\n */\n public async getNamespacedResults(\n // @ts-ignore\n request: GetNamespacedResults,\n options?: RequestOptions,\n ): Promise<TypedResponse<ResultList>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/namespaced-resources/results{?environment,sources*,namespaces*,kinds*,resources*,categories*,policies*,status*,severities*,search,labels*,page,offset,direction}`;\n\n const uri = parser.parse(uriTemplate).expand({\n ...request.query,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Retrieves a list of namespaces from the policies\n * Get namespaces\n * @param environment - The environment entity reference (URL encoded)\n * @param sources - Filter by a list of sources\n * @param categories - Filter by a list of categories\n * @param policies - Filter by a list of policies\n */\n public async getNamespaces(\n // @ts-ignore\n request: GetNamespaces,\n options?: RequestOptions,\n ): Promise<TypedResponse<Array<string>>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/v1/namespaces{?environment,sources*,categories*,policies*}`;\n\n const uri = parser.parse(uriTemplate).expand({\n ...request.query,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n}\n"],"names":["crossFetch","pluginId","parser"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoEO,MAAM,gBAAiB,CAAA;AAAA,EACX,YAAA;AA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MAAO,CAAA;AAAA,MAC3C,GAAG,OAAQ,CAAA;AAAA,KACZ,CAAA;AAED,IAAO,OAAA,MAAM,KAAK,QAAS,CAAA,KAAA,CAAM,GAAG,OAAO,CAAA,EAAG,GAAG,CAAI,CAAA,EAAA;AAAA,MACnD,OAAS,EAAA;AAAA,QACP,cAAgB,EAAA,kBAAA;AAAA,QAChB,GAAI,SAAS,KAAS,IAAA,EAAE,eAAe,CAAU,OAAA,EAAA,OAAA,EAAS,KAAK,CAAG,CAAA;AAAA,OACpE;AAAA,MACA,MAAQ,EAAA;AAAA,KACT,CAAA;AAAA;AAEL;;;;"}
@@ -41,6 +41,28 @@ class DefaultApiClient {
41
41
  method: "GET"
42
42
  });
43
43
  }
44
+ /**
45
+ * Retrieves a list of namespaces from the policies
46
+ * Get namespaces
47
+ * @param environment - The environment entity reference (URL encoded)
48
+ * @param sources - Filter by a list of sources
49
+ * @param categories - Filter by a list of categories
50
+ * @param policies - Filter by a list of policies
51
+ */
52
+ async getNamespaces(request, options) {
53
+ const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);
54
+ const uriTemplate = `/v1/namespaces{?environment,sources*,categories*,policies*}`;
55
+ const uri = parser.parse(uriTemplate).expand({
56
+ ...request.query
57
+ });
58
+ return await this.fetchApi.fetch(`${baseUrl}${uri}`, {
59
+ headers: {
60
+ "Content-Type": "application/json",
61
+ ...options?.token && { Authorization: `Bearer ${options?.token}` }
62
+ },
63
+ method: "GET"
64
+ });
65
+ }
44
66
  }
45
67
 
46
68
  export { DefaultApiClient };
@@ -1 +1 @@
1
- {"version":3,"file":"Api.client.esm.js","sources":["../../../../../src/schema/openapi/generated/apis/Api.client.ts"],"sourcesContent":["//\n\n// ******************************************************************\n// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. *\n// ******************************************************************\nimport { DiscoveryApi } from '../types/discovery';\nimport { FetchApi } from '../types/fetch';\nimport crossFetch from 'cross-fetch';\nimport { pluginId } from '../pluginId';\nimport * as parser from 'uri-template';\nimport { Direction } from '../models/Direction.model';\nimport { ResultList } from '../models/ResultList.model';\nimport { Severity } from '../models/Severity.model';\nimport { Status } from '../models/Status.model';\n\n/**\n * Wraps the Response type to convey a type on the json call.\n *\n * @public\n */\nexport type TypedResponse<T> = Omit<Response, 'json'> & {\n json: () => Promise<T>;\n};\n\n/**\n * Options you can pass into a request for additional information.\n *\n * @public\n */\nexport interface RequestOptions {\n token?: string;\n}\n/**\n * @public\n */\nexport type GetNamespacedResults = {\n query: {\n environment: string;\n sources?: Array<string>;\n namespaces?: Array<string>;\n kinds?: Array<string>;\n resources?: Array<string>;\n categories?: Array<string>;\n policies?: Array<string>;\n status?: Array<Status>;\n severities?: Array<Severity>;\n search?: string;\n labels?: Array<string>;\n page?: number;\n offset?: number;\n direction?: Direction;\n };\n};\n\n/**\n * @public\n */\nexport class DefaultApiClient {\n private readonly discoveryApi: DiscoveryApi;\n private readonly fetchApi: FetchApi;\n\n constructor(options: {\n discoveryApi: { getBaseUrl(pluginId: string): Promise<string> };\n fetchApi?: { fetch: typeof fetch };\n }) {\n this.discoveryApi = options.discoveryApi;\n this.fetchApi = options.fetchApi || { fetch: crossFetch };\n }\n\n /**\n * Retrieves policy results for a specific environment with optional filtering and pagination\n * Get namespaced policy results\n * @param environment - The environment entity reference (URL encoded)\n * @param sources - Filter by a list of sources\n * @param namespaces - Filter by a list of namespaces\n * @param kinds - Filter by a list of Kubernetes resource kinds\n * @param resources - Filter by a list of resources\n * @param categories - Filter by a list of categories\n * @param policies - Filter by a list of policies\n * @param status - Filter by policy result status\n * @param severities - Filter by severity levels\n * @param search - Search string to filter results\n * @param labels - Filter by label-value pairs\n * @param page - Requested list page number\n * @param offset - Number of results per page\n * @param direction - Sort direction for results\n */\n public async getNamespacedResults(\n // @ts-ignore\n request: GetNamespacedResults,\n options?: RequestOptions,\n ): Promise<TypedResponse<ResultList>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/namespaced-resources/results{?environment,sources*,namespaces*,kinds*,resources*,categories*,policies*,status*,severities*,search,labels*,page,offset,direction}`;\n\n const uri = parser.parse(uriTemplate).expand({\n ...request.query,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n}\n"],"names":[],"mappings":";;;;AAyDO,MAAM,gBAAiB,CAAA;AAAA,EACX,YAAA;AAAA,EACA,QAAA;AAAA,EAEjB,YAAY,OAGT,EAAA;AACD,IAAA,IAAA,CAAK,eAAe,OAAQ,CAAA,YAAA;AAC5B,IAAA,IAAA,CAAK,QAAW,GAAA,OAAA,CAAQ,QAAY,IAAA,EAAE,OAAO,UAAW,EAAA;AAAA;AAC1D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoBA,MAAa,oBAEX,CAAA,OAAA,EACA,OACoC,EAAA;AACpC,IAAA,MAAM,OAAU,GAAA,MAAM,IAAK,CAAA,YAAA,CAAa,WAAW,QAAQ,CAAA;AAE3D,IAAA,MAAM,WAAc,GAAA,CAAA,iKAAA,CAAA;AAEpB,IAAA,MAAM,GAAM,GAAA,MAAA,CAAO,KAAM,CAAA,WAAW,EAAE,MAAO,CAAA;AAAA,MAC3C,GAAG,OAAQ,CAAA;AAAA,KACZ,CAAA;AAED,IAAO,OAAA,MAAM,KAAK,QAAS,CAAA,KAAA,CAAM,GAAG,OAAO,CAAA,EAAG,GAAG,CAAI,CAAA,EAAA;AAAA,MACnD,OAAS,EAAA;AAAA,QACP,cAAgB,EAAA,kBAAA;AAAA,QAChB,GAAI,SAAS,KAAS,IAAA,EAAE,eAAe,CAAU,OAAA,EAAA,OAAA,EAAS,KAAK,CAAG,CAAA;AAAA,OACpE;AAAA,MACA,MAAQ,EAAA;AAAA,KACT,CAAA;AAAA;AAEL;;;;"}
1
+ {"version":3,"file":"Api.client.esm.js","sources":["../../../../../src/schema/openapi/generated/apis/Api.client.ts"],"sourcesContent":["//\n\n// ******************************************************************\n// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. *\n// ******************************************************************\nimport { DiscoveryApi } from '../types/discovery';\nimport { FetchApi } from '../types/fetch';\nimport crossFetch from 'cross-fetch';\nimport { pluginId } from '../pluginId';\nimport * as parser from 'uri-template';\nimport { Direction } from '../models/Direction.model';\nimport { ResultList } from '../models/ResultList.model';\nimport { Severity } from '../models/Severity.model';\nimport { Status } from '../models/Status.model';\n\n/**\n * Wraps the Response type to convey a type on the json call.\n *\n * @public\n */\nexport type TypedResponse<T> = Omit<Response, 'json'> & {\n json: () => Promise<T>;\n};\n\n/**\n * Options you can pass into a request for additional information.\n *\n * @public\n */\nexport interface RequestOptions {\n token?: string;\n}\n/**\n * @public\n */\nexport type GetNamespacedResults = {\n query: {\n environment: string;\n sources?: Array<string>;\n namespaces?: Array<string>;\n kinds?: Array<string>;\n resources?: Array<string>;\n categories?: Array<string>;\n policies?: Array<string>;\n status?: Array<Status>;\n severities?: Array<Severity>;\n search?: string;\n labels?: Array<string>;\n page?: number;\n offset?: number;\n direction?: Direction;\n };\n};\n/**\n * @public\n */\nexport type GetNamespaces = {\n query: {\n environment: string;\n sources?: Array<string>;\n categories?: Array<string>;\n policies?: Array<string>;\n };\n};\n\n/**\n * @public\n */\nexport class DefaultApiClient {\n private readonly discoveryApi: DiscoveryApi;\n private readonly fetchApi: FetchApi;\n\n constructor(options: {\n discoveryApi: { getBaseUrl(pluginId: string): Promise<string> };\n fetchApi?: { fetch: typeof fetch };\n }) {\n this.discoveryApi = options.discoveryApi;\n this.fetchApi = options.fetchApi || { fetch: crossFetch };\n }\n\n /**\n * Retrieves policy results for a specific environment with optional filtering and pagination\n * Get namespaced policy results\n * @param environment - The environment entity reference (URL encoded)\n * @param sources - Filter by a list of sources\n * @param namespaces - Filter by a list of namespaces\n * @param kinds - Filter by a list of Kubernetes resource kinds\n * @param resources - Filter by a list of resources\n * @param categories - Filter by a list of categories\n * @param policies - Filter by a list of policies\n * @param status - Filter by policy result status\n * @param severities - Filter by severity levels\n * @param search - Search string to filter results\n * @param labels - Filter by label-value pairs\n * @param page - Requested list page number\n * @param offset - Number of results per page\n * @param direction - Sort direction for results\n */\n public async getNamespacedResults(\n // @ts-ignore\n request: GetNamespacedResults,\n options?: RequestOptions,\n ): Promise<TypedResponse<ResultList>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/namespaced-resources/results{?environment,sources*,namespaces*,kinds*,resources*,categories*,policies*,status*,severities*,search,labels*,page,offset,direction}`;\n\n const uri = parser.parse(uriTemplate).expand({\n ...request.query,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Retrieves a list of namespaces from the policies\n * Get namespaces\n * @param environment - The environment entity reference (URL encoded)\n * @param sources - Filter by a list of sources\n * @param categories - Filter by a list of categories\n * @param policies - Filter by a list of policies\n */\n public async getNamespaces(\n // @ts-ignore\n request: GetNamespaces,\n options?: RequestOptions,\n ): Promise<TypedResponse<Array<string>>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/v1/namespaces{?environment,sources*,categories*,policies*}`;\n\n const uri = parser.parse(uriTemplate).expand({\n ...request.query,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n}\n"],"names":[],"mappings":";;;;AAoEO,MAAM,gBAAiB,CAAA;AAAA,EACX,YAAA;AAAA,EACA,QAAA;AAAA,EAEjB,YAAY,OAGT,EAAA;AACD,IAAA,IAAA,CAAK,eAAe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KAAK,QAAS,CAAA,KAAA,CAAM,GAAG,OAAO,CAAA,EAAG,GAAG,CAAI,CAAA,EAAA;AAAA,MACnD,OAAS,EAAA;AAAA,QACP,cAAgB,EAAA,kBAAA;AAAA,QAChB,GAAI,SAAS,KAAS,IAAA,EAAE,eAAe,CAAU,OAAA,EAAA,OAAA,EAAS,KAAK,CAAG,CAAA;AAAA,OACpE;AAAA,MACA,MAAQ,EAAA;AAAA,KACT,CAAA;AAAA;AAEL;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kyverno/backstage-plugin-policy-reporter-common",
3
3
  "description": "Common functionalities for the policy-reporter plugin",
4
- "version": "2.1.0",
4
+ "version": "2.2.0",
5
5
  "main": "dist/index.cjs.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "license": "Apache-2.0",