-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add corev1.ConfigMap client functions and types (#2348)
* Add corev1.ConfigMap client functions and types * Use generic map type for the createResource data
- Loading branch information
Showing
6 changed files
with
89 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { IOAuth2Provider } from 'lib/OAuth2/OAuth2'; | ||
import { IHttpClient } from 'model/clients/HttpClient'; | ||
import * as k8sUrl from 'model/services/mapi/k8sUrl'; | ||
|
||
import { createResource } from '../generic/createResource'; | ||
import { IConfigMap } from './types'; | ||
|
||
export function createConfigMap( | ||
client: IHttpClient, | ||
auth: IOAuth2Provider, | ||
configMap: IConfigMap | ||
) { | ||
const url = k8sUrl.create({ | ||
baseUrl: window.config.mapiEndpoint, | ||
isCore: true, | ||
kind: 'configmaps', | ||
namespace: configMap.metadata.namespace!, | ||
}); | ||
|
||
return createResource<IConfigMap>(client, auth, url.toString(), configMap); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { IOAuth2Provider } from 'lib/OAuth2/OAuth2'; | ||
import { IHttpClient } from 'model/clients/HttpClient'; | ||
import * as k8sUrl from 'model/services/mapi/k8sUrl'; | ||
|
||
import { deleteResource } from '../generic/deleteResource'; | ||
import { IConfigMap } from './types'; | ||
|
||
export function deleteConfigMap( | ||
client: IHttpClient, | ||
auth: IOAuth2Provider, | ||
configMap: IConfigMap | ||
) { | ||
const url = k8sUrl.create({ | ||
baseUrl: window.config.mapiEndpoint, | ||
isCore: true, | ||
kind: 'configmaps', | ||
name: configMap.metadata.name, | ||
namespace: configMap.metadata.namespace!, | ||
}); | ||
|
||
return deleteResource<IConfigMap>(client, auth, url.toString()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { IOAuth2Provider } from 'lib/OAuth2/OAuth2'; | ||
import { IHttpClient } from 'model/clients/HttpClient'; | ||
import * as k8sUrl from 'model/services/mapi/k8sUrl'; | ||
|
||
import { getResource } from '../generic/getResource'; | ||
import { IConfigMap } from './types'; | ||
|
||
export function getConfigMap( | ||
client: IHttpClient, | ||
auth: IOAuth2Provider, | ||
name: string, | ||
namespace: string | ||
) { | ||
const url = k8sUrl.create({ | ||
baseUrl: window.config.mapiEndpoint, | ||
isCore: true, | ||
kind: 'configmaps', | ||
name, | ||
namespace, | ||
}); | ||
|
||
return getResource<IConfigMap>(client, auth, url.toString()); | ||
} | ||
|
||
export function getConfigMapKey(name: string, namespace: string) { | ||
return `getConfigMap/${namespace}/${name}`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters