-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert host-inventory-client to new generator (#310)
* feat: convert host-inventory-client to new generator * chore: update package-lock
- Loading branch information
Showing
46 changed files
with
6,454 additions
and
7,276 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
wwwroot/*.js | ||
node_modules | ||
typings | ||
dist | ||
dist |
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 |
---|---|---|
@@ -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 |
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,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 |
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 |
---|---|---|
@@ -1 +1 @@ | ||
4.3.1 | ||
7.0.0 |
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,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; |
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,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; |
64 changes: 64 additions & 0 deletions
64
packages/host-inventory/ApiGroupDeleteHostsFromDifferentGroups/index.ts
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,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; |
Oops, something went wrong.