Skip to content

Commit

Permalink
Update Quotas API (#157)
Browse files Browse the repository at this point in the history
Use the improved API that leads to cleaner client code.
  • Loading branch information
spjmurray authored Feb 4, 2025
1 parent 23e1c41 commit c093577
Show file tree
Hide file tree
Showing 14 changed files with 373 additions and 148 deletions.
4 changes: 2 additions & 2 deletions charts/ui/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ description: A Helm chart for deploying Unikorn UI

type: application

version: v0.3.5-rc4
appVersion: v0.3.5-rc4
version: v0.3.5-rc5
appVersion: v0.3.5-rc5

icon: https://assets.unikorn-cloud.org/assets/images/logos/dark-on-light/icon.png

Expand Down
6 changes: 3 additions & 3 deletions src/lib/openapi/identity/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ models/ProjectScopedResourceReadMetadata.ts
models/ProjectSpec.ts
models/ProjectWrite.ts
models/ProviderScope.ts
models/Quota.ts
models/QuotaDetailed.ts
models/QuotaMetadata.ts
models/QuotaRead.ts
models/QuotaWrite.ts
models/QuotasRead.ts
models/QuotasWrite.ts
models/ResourceAllocation.ts
models/ResourceMetadata.ts
models/ResourceProvisioningStatus.ts
models/ResourceReadMetadata.ts
Expand Down
34 changes: 0 additions & 34 deletions src/lib/openapi/identity/apis/DefaultApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import type {
OrganizationWrite,
ProjectRead,
ProjectWrite,
QuotaMetadata,
QuotasRead,
QuotasWrite,
RoleRead,
Expand Down Expand Up @@ -74,8 +73,6 @@ import {
ProjectReadToJSON,
ProjectWriteFromJSON,
ProjectWriteToJSON,
QuotaMetadataFromJSON,
QuotaMetadataToJSON,
QuotasReadFromJSON,
QuotasReadToJSON,
QuotasWriteFromJSON,
Expand Down Expand Up @@ -1776,37 +1773,6 @@ export class DefaultApi extends runtime.BaseAPI {
return await response.value();
}

/**
* Return a list of quotas and their metadata.
*/
async apiV1QuotasGetRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<QuotaMetadata>>> {
const queryParameters: any = {};

const headerParameters: runtime.HTTPHeaders = {};

if (this.configuration && this.configuration.accessToken) {
// oauth required
headerParameters["Authorization"] = await this.configuration.accessToken("oauth2Authentication", []);
}

const response = await this.request({
path: `/api/v1/quotas`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);

return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(QuotaMetadataFromJSON));
}

/**
* Return a list of quotas and their metadata.
*/
async apiV1QuotasGet(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<QuotaMetadata>> {
const response = await this.apiV1QuotasGetRaw(initOverrides);
return await response.value();
}

/**
* Complete the user signup process.
*/
Expand Down
18 changes: 9 additions & 9 deletions src/lib/openapi/identity/models/AllocationSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
*/

import { exists, mapValues } from '../runtime';
import type { QuotaDetailed } from './QuotaDetailed';
import type { ResourceAllocation } from './ResourceAllocation';
import {
QuotaDetailedFromJSON,
QuotaDetailedFromJSONTyped,
QuotaDetailedToJSON,
} from './QuotaDetailed';
ResourceAllocationFromJSON,
ResourceAllocationFromJSONTyped,
ResourceAllocationToJSON,
} from './ResourceAllocation';

/**
* A set of resource allocations.
Expand All @@ -40,10 +40,10 @@ export interface AllocationSpec {
id: string;
/**
* A list of quotas.
* @type {Array<QuotaDetailed>}
* @type {Array<ResourceAllocation>}
* @memberof AllocationSpec
*/
allocations: Array<QuotaDetailed>;
allocations: Array<ResourceAllocation>;
}

/**
Expand All @@ -70,7 +70,7 @@ export function AllocationSpecFromJSONTyped(json: any, ignoreDiscriminator: bool

'kind': json['kind'],
'id': json['id'],
'allocations': ((json['allocations'] as Array<any>).map(QuotaDetailedFromJSON)),
'allocations': ((json['allocations'] as Array<any>).map(ResourceAllocationFromJSON)),
};
}

Expand All @@ -85,7 +85,7 @@ export function AllocationSpecToJSON(value?: AllocationSpec | null): any {

'kind': value.kind,
'id': value.id,
'allocations': ((value.allocations as Array<any>).map(QuotaDetailedToJSON)),
'allocations': ((value.allocations as Array<any>).map(ResourceAllocationToJSON)),
};
}

138 changes: 138 additions & 0 deletions src/lib/openapi/identity/models/QuotaRead.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
/* tslint:disable */
/* eslint-disable */
/**
* Unikorn Identity API
* The Unikorn Identity API provides an OIDC compliant interface for use with all Unikorn services and proxies. As it\'s intended use is for multi-tenant cloud deployments it acts as an aggregation layer for other 3rd party OIDC services, dispatching login requests to the required OIDC backend.
*
* The version of the OpenAPI document: 0.1.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

import { exists, mapValues } from '../runtime';
/**
* A single quota.
* @export
* @interface QuotaRead
*/
export interface QuotaRead {
/**
* The kind of resource.
* @type {string}
* @memberof QuotaRead
*/
kind: string;
/**
* Tha maximum amount of that resource.
* @type {number}
* @memberof QuotaRead
*/
quantity: number;
/**
* The amount of that resource that is used.
* @type {number}
* @memberof QuotaRead
*/
used: number;
/**
* The amount of that resource that is free.
* @type {number}
* @memberof QuotaRead
*/
free: number;
/**
* Tha amount of that resource always in use.
* @type {number}
* @memberof QuotaRead
*/
committed: number;
/**
* The amount of that resource that may be used e.g. autoscaled.
* @type {number}
* @memberof QuotaRead
*/
reserved: number;
/**
* The name that should be displayed to end users.
* @type {string}
* @memberof QuotaRead
*/
displayName: string;
/**
* A verbose explanation of what the quota limits.
* @type {string}
* @memberof QuotaRead
*/
description: string;
/**
* The default value of the quota.
* @type {number}
* @memberof QuotaRead
*/
_default: number;
}

/**
* Check if a given object implements the QuotaRead interface.
*/
export function instanceOfQuotaRead(value: object): boolean {
let isInstance = true;
isInstance = isInstance && "kind" in value;
isInstance = isInstance && "quantity" in value;
isInstance = isInstance && "used" in value;
isInstance = isInstance && "free" in value;
isInstance = isInstance && "committed" in value;
isInstance = isInstance && "reserved" in value;
isInstance = isInstance && "displayName" in value;
isInstance = isInstance && "description" in value;
isInstance = isInstance && "_default" in value;

return isInstance;
}

export function QuotaReadFromJSON(json: any): QuotaRead {
return QuotaReadFromJSONTyped(json, false);
}

export function QuotaReadFromJSONTyped(json: any, ignoreDiscriminator: boolean): QuotaRead {
if ((json === undefined) || (json === null)) {
return json;
}
return {

'kind': json['kind'],
'quantity': json['quantity'],
'used': json['used'],
'free': json['free'],
'committed': json['committed'],
'reserved': json['reserved'],
'displayName': json['displayName'],
'description': json['description'],
'_default': json['default'],
};
}

export function QuotaReadToJSON(value?: QuotaRead | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {

'kind': value.kind,
'quantity': value.quantity,
'used': value.used,
'free': value.free,
'committed': value.committed,
'reserved': value.reserved,
'displayName': value.displayName,
'description': value.description,
'default': value._default,
};
}

75 changes: 75 additions & 0 deletions src/lib/openapi/identity/models/QuotaWrite.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/* tslint:disable */
/* eslint-disable */
/**
* Unikorn Identity API
* The Unikorn Identity API provides an OIDC compliant interface for use with all Unikorn services and proxies. As it\'s intended use is for multi-tenant cloud deployments it acts as an aggregation layer for other 3rd party OIDC services, dispatching login requests to the required OIDC backend.
*
* The version of the OpenAPI document: 0.1.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

import { exists, mapValues } from '../runtime';
/**
* A single quota.
* @export
* @interface QuotaWrite
*/
export interface QuotaWrite {
/**
* The kind of resource.
* @type {string}
* @memberof QuotaWrite
*/
kind: string;
/**
* Tha maximum amount of that resource.
* @type {number}
* @memberof QuotaWrite
*/
quantity: number;
}

/**
* Check if a given object implements the QuotaWrite interface.
*/
export function instanceOfQuotaWrite(value: object): boolean {
let isInstance = true;
isInstance = isInstance && "kind" in value;
isInstance = isInstance && "quantity" in value;

return isInstance;
}

export function QuotaWriteFromJSON(json: any): QuotaWrite {
return QuotaWriteFromJSONTyped(json, false);
}

export function QuotaWriteFromJSONTyped(json: any, ignoreDiscriminator: boolean): QuotaWrite {
if ((json === undefined) || (json === null)) {
return json;
}
return {

'kind': json['kind'],
'quantity': json['quantity'],
};
}

export function QuotaWriteToJSON(value?: QuotaWrite | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {

'kind': value.kind,
'quantity': value.quantity,
};
}

Loading

0 comments on commit c093577

Please sign in to comment.