mirror of
https://github.com/jdalrymple/gitbeaker.git
synced 2026-01-25 16:04:01 +00:00
Add creation for service accounts on selfhosted instances (#3458)
This commit is contained in:
parent
c39ac08b2f
commit
29c2b3970b
@ -1645,6 +1645,15 @@ import { Gitlab } from '@gitbeaker/core';
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>ServiceAccounts</th>
|
||||
<td>
|
||||
<a href="https://docs.gitlab.com/ee/api/users.html#create-service-account-user">🦊</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="./src/resources/ServiceAccounts.ts">⌨️</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>ServiceData</th>
|
||||
<td>
|
||||
<a href="https://docs.gitlab.com/16.4/ee/api/usage_data.html">🦊</a>
|
||||
|
||||
@ -46,6 +46,7 @@ import { PyPI } from './PyPI';
|
||||
import { RubyGems } from './RubyGems';
|
||||
import { Search } from './Search';
|
||||
import { SearchAdmin } from './SearchAdmin';
|
||||
import { ServiceAccounts } from './ServiceAccounts';
|
||||
import { ServiceData } from './ServiceData';
|
||||
import { SidekiqMetrics } from './SidekiqMetrics';
|
||||
import { SidekiqQueues } from './SidekiqQueues';
|
||||
@ -237,6 +238,7 @@ export interface Gitlab<C extends boolean = false> extends BaseResource<C> {
|
||||
RubyGems: RubyGems<C>;
|
||||
Search: Search<C>;
|
||||
SearchAdmin: SearchAdmin<C>;
|
||||
ServiceAccounts: ServiceAccounts<C>;
|
||||
ServiceData: ServiceData<C>;
|
||||
SidekiqMetrics: SidekiqMetrics<C>;
|
||||
SidekiqQueues: SidekiqQueues<C>;
|
||||
@ -426,6 +428,7 @@ const resources = {
|
||||
RubyGems,
|
||||
Search,
|
||||
SearchAdmin,
|
||||
ServiceAccounts,
|
||||
ServiceData,
|
||||
SidekiqMetrics,
|
||||
SidekiqQueues,
|
||||
|
||||
@ -3,7 +3,7 @@ import type { AccessTokenSchema } from '../templates/ResourceAccessTokens';
|
||||
import { RequestHelper, endpoint } from '../infrastructure';
|
||||
import type { GitlabAPIResponse, MappedOmit, ShowExpanded, Sudo } from '../infrastructure';
|
||||
|
||||
export interface ServiceAccountSchema extends Record<string, unknown> {
|
||||
export interface GroupServiceAccountSchema extends Record<string, unknown> {
|
||||
id: number;
|
||||
username: string;
|
||||
name: string;
|
||||
@ -15,8 +15,8 @@ export class GroupServiceAccounts<C extends boolean = false> extends BaseResourc
|
||||
create<E extends boolean = false>(
|
||||
groupId: string | number,
|
||||
options?: Sudo & ShowExpanded<E>,
|
||||
): Promise<GitlabAPIResponse<ServiceAccountSchema, C, E, void>> {
|
||||
return RequestHelper.post<ServiceAccountSchema>()(
|
||||
): Promise<GitlabAPIResponse<GroupServiceAccountSchema, C, E, void>> {
|
||||
return RequestHelper.post<GroupServiceAccountSchema>()(
|
||||
this,
|
||||
endpoint`groups/${groupId}/service_accounts`,
|
||||
options,
|
||||
|
||||
21
packages/core/src/resources/ServiceAccounts.ts
Normal file
21
packages/core/src/resources/ServiceAccounts.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { BaseResource } from '@gitbeaker/requester-utils';
|
||||
import { RequestHelper, endpoint } from '../infrastructure';
|
||||
import type { GitlabAPIResponse, ShowExpanded, Sudo } from '../infrastructure';
|
||||
|
||||
export interface ServiceAccountSchema extends Record<string, unknown> {
|
||||
id: number;
|
||||
name: string;
|
||||
username: string;
|
||||
state: string;
|
||||
locked: boolean;
|
||||
avatar_url: string;
|
||||
web_url: string;
|
||||
}
|
||||
|
||||
export class ServiceAccounts<C extends boolean = false> extends BaseResource<C> {
|
||||
create<E extends boolean = false>(
|
||||
options?: Sudo & ShowExpanded<E>,
|
||||
): Promise<GitlabAPIResponse<ServiceAccountSchema, C, E, void>> {
|
||||
return RequestHelper.post<ServiceAccountSchema>()(this, endpoint`service_accounts`, options);
|
||||
}
|
||||
}
|
||||
@ -43,6 +43,7 @@ export * from './PyPI';
|
||||
export * from './RubyGems';
|
||||
export * from './Search';
|
||||
export * from './SearchAdmin';
|
||||
export * from './ServiceAccounts';
|
||||
export * from './ServiceData';
|
||||
export * from './SidekiqMetrics';
|
||||
export * from './SidekiqQueues';
|
||||
|
||||
@ -53,6 +53,7 @@ export const {
|
||||
RubyGems,
|
||||
Search,
|
||||
SearchAdmin,
|
||||
ServiceAccounts,
|
||||
ServiceData,
|
||||
SidekiqMetrics,
|
||||
SidekiqQueues,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user