Skip to content

Commit

Permalink
Convert host-inventory-client to new generator (#310)
Browse files Browse the repository at this point in the history
* feat: convert host-inventory-client to new generator

* chore: update package-lock
  • Loading branch information
apinkert authored Nov 7, 2024
1 parent 2c004f2 commit c235a97
Show file tree
Hide file tree
Showing 46 changed files with 6,454 additions and 7,276 deletions.
50 changes: 42 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/host-inventory/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
wwwroot/*.js
node_modules
typings
dist
dist
7 changes: 6 additions & 1 deletion packages/host-inventory/.npmignore
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm
.openapi-generator
node_modules
.openapi-generator-ignore
package-lock.json
*.ts
!*.d.ts
40 changes: 40 additions & 0 deletions packages/host-inventory/.openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
.gitignore
.npmignore
ApiGroupCreateGroup/index.ts
ApiGroupDeleteGroups/index.ts
ApiGroupDeleteHostsFromDifferentGroups/index.ts
ApiGroupGetGroupList/index.ts
ApiGroupGetGroupsById/index.ts
ApiGroupPatchGroupById/index.ts
ApiHostDeleteAllHosts/index.ts
ApiHostDeleteHostById/index.ts
ApiHostDeleteHostsByFilter/index.ts
ApiHostGetHostById/index.ts
ApiHostGetHostExists/index.ts
ApiHostGetHostList/index.ts
ApiHostGetHostSystemProfileById/index.ts
ApiHostGetHostTagCount/index.ts
ApiHostGetHostTags/index.ts
ApiHostGroupAddHostListToGroup/index.ts
ApiHostGroupDeleteHostsFromGroup/index.ts
ApiHostHostCheckin/index.ts
ApiHostMergeFacts/index.ts
ApiHostPatchHostById/index.ts
ApiHostReplaceFacts/index.ts
ApiResourceTypeGetResourceTypeGroupsList/index.ts
ApiResourceTypeGetResourceTypeList/index.ts
ApiStalenessCreateStaleness/index.ts
ApiStalenessDeleteStaleness/index.ts
ApiStalenessGetDefaultStaleness/index.ts
ApiStalenessGetStaleness/index.ts
ApiStalenessUpdateStaleness/index.ts
ApiSystemProfileGetOperatingSystem/index.ts
ApiSystemProfileGetSapSids/index.ts
ApiSystemProfileGetSapSystem/index.ts
ApiSystemProfileValidateSchema/index.ts
ApiTagGetTags/index.ts
api.ts
git_push.sh
index.ts
index.ts
types/index.ts
2 changes: 1 addition & 1 deletion packages/host-inventory/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.3.1
7.0.0
71 changes: 71 additions & 0 deletions packages/host-inventory/ApiGroupCreateGroup/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// @ts-ignore
import type { AxiosPromise, AxiosInstance, AxiosRequestConfig, Method } from 'axios';
// @ts-ignore
import { COLLECTION_FORMATS, RequiredError, AuthTypeEnum, DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '@redhat-cloud-services/javascript-clients-shared/dist/common';
import type { RequestArgs } from '@redhat-cloud-services/javascript-clients-shared/dist/common';
// @ts-ignore
import { BaseAPI } from '@redhat-cloud-services/javascript-clients-shared/dist/base';
import { Configuration } from '@redhat-cloud-services/javascript-clients-shared/dist/configuration';

// @ts-ignore
import type { GroupIn, GroupOutWithHostCount } from '../types';


export type ApiGroupCreateGroupParams = {
/**
* Data required to create a record for a group.
* @type { GroupIn }
* @memberof ApiGroupCreateGroupApi
*/
groupIn: GroupIn,
options?: AxiosRequestConfig
}

const isApiGroupCreateGroupObjectParams = (params: [ApiGroupCreateGroupParams] | unknown[]): params is [ApiGroupCreateGroupParams] => {
return params.length === 1 && Object.prototype.hasOwnProperty.call(params, 'groupIn')
}
/**
* Creates a new group containing the hosts associated with the host IDs provided. <br /><br /> Required permissions: inventory:groups:write
* @summary Create a new group matching the provided name and list of hosts IDs
* @param {ApiGroupCreateGroupParams} config with all available params.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
export const apiGroupCreateGroupParamCreator = async (...config: ([ApiGroupCreateGroupParams] | [GroupIn, AxiosRequestConfig])): Promise<RequestArgs> => {
const params = isApiGroupCreateGroupObjectParams(config) ? config[0] : ['groupIn', 'options'].reduce((acc, curr, index) => ({ ...acc, [curr]: config[index] }), {}) as ApiGroupCreateGroupParams;
const { groupIn, options = {} } = params;
const localVarPath = `/groups`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
const localVarRequestOptions = { method: 'POST' as Method, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;



localVarHeaderParameter['Content-Type'] = 'application/json';

setSearchParams(localVarUrlObj, localVarQueryParameter);
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};

return {
urlObj: localVarUrlObj,
options: localVarRequestOptions,
serializeData: groupIn,
auth:[
{
// authentication ApiKeyAuth required
// in header with key required
authType: AuthTypeEnum.InHeader,
authKey: "x-rh-identity"
},
{
// authentication BearerAuth required
// bearer auth required
authType: AuthTypeEnum.Bearer,
}
]
};
}

export default apiGroupCreateGroupParamCreator;
64 changes: 64 additions & 0 deletions packages/host-inventory/ApiGroupDeleteGroups/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// @ts-ignore
import type { AxiosPromise, AxiosInstance, AxiosRequestConfig, Method } from 'axios';
// @ts-ignore
import { COLLECTION_FORMATS, RequiredError, AuthTypeEnum, DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '@redhat-cloud-services/javascript-clients-shared/dist/common';
import type { RequestArgs } from '@redhat-cloud-services/javascript-clients-shared/dist/common';
// @ts-ignore
import { BaseAPI } from '@redhat-cloud-services/javascript-clients-shared/dist/base';
import { Configuration } from '@redhat-cloud-services/javascript-clients-shared/dist/configuration';

// @ts-ignore
import type { } from '../types';


export type ApiGroupDeleteGroupsParams = {
/**
* A comma-separated list of group IDs.
* @type { Array<string> }
* @memberof ApiGroupDeleteGroupsApi
*/
groupIdList: Array<string>,
options?: AxiosRequestConfig
}

const isApiGroupDeleteGroupsObjectParams = (params: [ApiGroupDeleteGroupsParams] | unknown[]): params is [ApiGroupDeleteGroupsParams] => {
return params.length === 1 && Object.prototype.hasOwnProperty.call(params, 'groupIdList')
}
/**
* Delete a list of groups. <br /><br /> Required permissions: inventory:groups:write
* @summary Delete a list of groups
* @param {ApiGroupDeleteGroupsParams} config with all available params.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
export const apiGroupDeleteGroupsParamCreator = async (...config: ([ApiGroupDeleteGroupsParams] | [Array<string>, AxiosRequestConfig])): Promise<RequestArgs> => {
const params = isApiGroupDeleteGroupsObjectParams(config) ? config[0] : ['groupIdList', 'options'].reduce((acc, curr, index) => ({ ...acc, [curr]: config[index] }), {}) as ApiGroupDeleteGroupsParams;
const { groupIdList, options = {} } = params;
const localVarPath = `/groups/{group_id_list}`
.replace(`{${"group_id_list"}}`, encodeURIComponent(String(groupIdList)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
const localVarRequestOptions = { method: 'DELETE' as Method, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;



setSearchParams(localVarUrlObj, localVarQueryParameter);
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};

return {
urlObj: localVarUrlObj,
options: localVarRequestOptions,
auth:[
{
// authentication ApiKeyAuth required
// in header with key required
authType: AuthTypeEnum.InHeader,
authKey: "x-rh-identity"
}
]
};
}

export default apiGroupDeleteGroupsParamCreator;
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// @ts-ignore
import type { AxiosPromise, AxiosInstance, AxiosRequestConfig, Method } from 'axios';
// @ts-ignore
import { COLLECTION_FORMATS, RequiredError, AuthTypeEnum, DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '@redhat-cloud-services/javascript-clients-shared/dist/common';
import type { RequestArgs } from '@redhat-cloud-services/javascript-clients-shared/dist/common';
// @ts-ignore
import { BaseAPI } from '@redhat-cloud-services/javascript-clients-shared/dist/base';
import { Configuration } from '@redhat-cloud-services/javascript-clients-shared/dist/configuration';

// @ts-ignore
import type { } from '../types';


export type ApiGroupDeleteHostsFromDifferentGroupsParams = {
/**
* A comma-separated list of host IDs.
* @type { Array<string> }
* @memberof ApiGroupDeleteHostsFromDifferentGroupsApi
*/
hostIdList: Array<string>,
options?: AxiosRequestConfig
}

const isApiGroupDeleteHostsFromDifferentGroupsObjectParams = (params: [ApiGroupDeleteHostsFromDifferentGroupsParams] | unknown[]): params is [ApiGroupDeleteHostsFromDifferentGroupsParams] => {
return params.length === 1 && Object.prototype.hasOwnProperty.call(params, 'hostIdList')
}
/**
* Delete a list of hosts from the groups they are in. <br /><br /> Required permissions: inventory:groups:write
* @summary Delete a list of hosts from the groups they are in
* @param {ApiGroupDeleteHostsFromDifferentGroupsParams} config with all available params.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
export const apiGroupDeleteHostsFromDifferentGroupsParamCreator = async (...config: ([ApiGroupDeleteHostsFromDifferentGroupsParams] | [Array<string>, AxiosRequestConfig])): Promise<RequestArgs> => {
const params = isApiGroupDeleteHostsFromDifferentGroupsObjectParams(config) ? config[0] : ['hostIdList', 'options'].reduce((acc, curr, index) => ({ ...acc, [curr]: config[index] }), {}) as ApiGroupDeleteHostsFromDifferentGroupsParams;
const { hostIdList, options = {} } = params;
const localVarPath = `/groups/hosts/{host_id_list}`
.replace(`{${"host_id_list"}}`, encodeURIComponent(String(hostIdList)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
const localVarRequestOptions = { method: 'DELETE' as Method, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;



setSearchParams(localVarUrlObj, localVarQueryParameter);
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};

return {
urlObj: localVarUrlObj,
options: localVarRequestOptions,
auth:[
{
// authentication ApiKeyAuth required
// in header with key required
authType: AuthTypeEnum.InHeader,
authKey: "x-rh-identity"
}
]
};
}

export default apiGroupDeleteHostsFromDifferentGroupsParamCreator;
Loading

0 comments on commit c235a97

Please sign in to comment.