Skip to content

Commit

Permalink
US39140-Project machine size limits (#23)
Browse files Browse the repository at this point in the history
* US39140-Modified swagger definition to account for project machine size limits

* US39140-Removed unused files

* US39140-Fixed lint

* US39140-Implemented comments

* US39140-Regenerated code

* US39140-Fixed required limts fields

* Update v1/api/swagger/components/schemas/Limits.yaml

Co-authored-by: Mike Chuang <mchuang3@users.noreply.github.com>

* Update v1/api/swagger/components/schemas/ProjectResources.yml

Co-authored-by: Mike Chuang <mchuang3@users.noreply.github.com>

* US39140-Implemented comments

Co-authored-by: Mike Chuang <mchuang3@users.noreply.github.com>
  • Loading branch information
dbozzato81 and mchuang3 authored Aug 19, 2022
1 parent 8f94784 commit f2d287b
Show file tree
Hide file tree
Showing 16 changed files with 170 additions and 8 deletions.
12 changes: 12 additions & 0 deletions v1/api/swagger/components/schemas/Limits.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
type: object
required:
- Hosts
- Volumes
- VolumeCapacity
- PrivateNetworks
properties:
Hosts:
type: integer
Expand All @@ -17,3 +22,10 @@ properties:
type: integer
description: Maximum number of private networks to allow
minimum: 0
InstanceTypes:
type: object
additionalProperties:
type: integer
description: Map of instance type ID to maximum number of hosts that can be created with that instance type
example:
046b6c7f-0b8a-43b9-b35d-6489e6daee90: 1
8 changes: 8 additions & 0 deletions v1/api/swagger/components/schemas/MachineSizeInfo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,11 @@ properties:
type: integer
Available:
type: integer
ID:
type: string
format: uuid
Restricted:
type: boolean
description: >
True if the usage of this machine size is restricted
to selected projects, false if the machine size is available to anyone.
3 changes: 3 additions & 0 deletions v1/api/swagger/components/schemas/Project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ allOf:
Project Limits place general constraints on a project in terms of
server and storage
$ref: ./Limits.yaml
Resources:
description: Project resources provides resources currently utilized by the project
$ref: ./ProjectResources.yml
PermittedSites:
description: Array listing the permitted site IDs
type: array
Expand Down
26 changes: 26 additions & 0 deletions v1/api/swagger/components/schemas/ProjectResources.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
type: object
properties:
Hosts:
type: integer
description: Number of hosts in use
minimum: 0
Volumes:
type: integer
description: Number of volumes in use
minimum: 0
VolumeCapacity:
type: integer
format: int64
description: Volume capacity in use in TiB
minimum: 0
PrivateNetworks:
type: integer
description: Number of private networks in use
minimum: 0
InstanceTypes:
type: object
additionalProperties:
type: integer
description: Number of hosts with the instance type in use
example:
046b6c7f-0b8a-43b9-b35d-6489e6daee90: 1
1 change: 1 addition & 0 deletions v1/pkg/client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ Class | Method | HTTP request | Description
- [Project](docs/Project.md)
- [ProjectAllOf](docs/ProjectAllOf.md)
- [ProjectInfo](docs/ProjectInfo.md)
- [ProjectResources](docs/ProjectResources.md)
- [ProjectsInfo](docs/ProjectsInfo.md)
- [ProtocolKind](docs/ProtocolKind.md)
- [ProtocolParameters](docs/ProtocolParameters.md)
Expand Down
59 changes: 59 additions & 0 deletions v1/pkg/client/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2383,6 +2383,8 @@ components:
Hosts: 0
Volumes: 0
VolumeCapacity: 0
InstanceTypes:
"046b6c7f-0b8a-43b9-b35d-6489e6daee90": 1
PrivateNetworks: 0
PermittedSites:
- 046b6c7f-0b8a-43b9-b35d-6489e6daee91
Expand Down Expand Up @@ -2423,12 +2425,16 @@ components:
example:
MachineSizes:
- ProjectsUsed: 5
Restricted: true
Available: 7
OtherUsed: 2
ID: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
Name: Name
- ProjectsUsed: 5
Restricted: true
Available: 7
OtherUsed: 2
ID: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
Name: Name
VolumeFlavors:
- ProjectsUsed: 9
Expand Down Expand Up @@ -3177,6 +3183,8 @@ components:
Hosts: 0
Volumes: 0
VolumeCapacity: 0
InstanceTypes:
"046b6c7f-0b8a-43b9-b35d-6489e6daee90": 1
PrivateNetworks: 0
properties:
Hosts:
Expand All @@ -3196,6 +3204,46 @@ components:
description: Maximum number of private networks to allow
minimum: 0
type: integer
InstanceTypes:
additionalProperties:
type: integer
description: Map of instance type ID to maximum number of hosts that can
be created with that instance type
example:
"046b6c7f-0b8a-43b9-b35d-6489e6daee90": 1
type: object
required:
- Hosts
- PrivateNetworks
- VolumeCapacity
- Volumes
type: object
ProjectResources:
properties:
Hosts:
description: Number of hosts in use
minimum: 0
type: integer
Volumes:
description: Number of volumes in use
minimum: 0
type: integer
VolumeCapacity:
description: Volume capacity in use in TiB
format: int64
minimum: 0
type: integer
PrivateNetworks:
description: Number of private networks in use
minimum: 0
type: integer
InstanceTypes:
additionalProperties:
type: integer
description: Number of hosts with the instance type in use
example:
"046b6c7f-0b8a-43b9-b35d-6489e6daee90": 1
type: object
type: object
ProjectInfo:
example:
Expand Down Expand Up @@ -3246,8 +3294,10 @@ components:
MachineSizeInfo:
example:
ProjectsUsed: 5
Restricted: true
Available: 7
OtherUsed: 2
ID: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
Name: Name
properties:
Name:
Expand All @@ -3258,6 +3308,13 @@ components:
type: integer
Available:
type: integer
ID:
format: uuid
type: string
Restricted:
description: |
True if the usage of this machine size is restricted to selected projects, false if the machine size is available to anyone.
type: boolean
type: object
VolumeFlavorsInfo:
example:
Expand Down Expand Up @@ -4562,6 +4619,8 @@ components:
$ref: '#/components/schemas/Profile'
Limits:
$ref: '#/components/schemas/Limits'
Resources:
$ref: '#/components/schemas/ProjectResources'
PermittedSites:
description: Array listing the permitted site IDs
example:
Expand Down
9 changes: 5 additions & 4 deletions v1/pkg/client/docs/Limits.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Hosts** | **int32** | Maximum number of hosts to allow | [optional]
**Volumes** | **int32** | Maximum number of volumes to allow | [optional]
**VolumeCapacity** | **int64** | Maximum capacity to allow in TiB | [optional]
**PrivateNetworks** | **int32** | Maximum number of private networks to allow | [optional]
**Hosts** | **int32** | Maximum number of hosts to allow |
**Volumes** | **int32** | Maximum number of volumes to allow |
**VolumeCapacity** | **int64** | Maximum capacity to allow in TiB |
**PrivateNetworks** | **int32** | Maximum number of private networks to allow |
**InstanceTypes** | **map[string]int32** | Map of instance type ID to maximum number of hosts that can be created with that instance type | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Expand Down
2 changes: 2 additions & 0 deletions v1/pkg/client/docs/MachineSizeInfo.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Name | Type | Description | Notes
**ProjectsUsed** | **int32** | | [optional]
**OtherUsed** | **int32** | | [optional]
**Available** | **int32** | | [optional]
**ID** | **string** | | [optional]
**Restricted** | **bool** | True if the usage of this machine size is restricted to selected projects, false if the machine size is available to anyone. | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Expand Down
1 change: 1 addition & 0 deletions v1/pkg/client/docs/Project.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Name | Type | Description | Notes
**Modified** | [**time.Time**](time.Time.md) | Time when the resource was last modified in the database | [optional]
**Profile** | [**Profile**](Profile.md) | |
**Limits** | [**Limits**](Limits.md) | |
**Resources** | [**ProjectResources**](ProjectResources.md) | | [optional]
**PermittedSites** | **[]string** | Array listing the permitted site IDs | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
Expand Down
1 change: 1 addition & 0 deletions v1/pkg/client/docs/ProjectAllOf.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Profile** | [**Profile**](Profile.md) | |
**Limits** | [**Limits**](Limits.md) | |
**Resources** | [**ProjectResources**](ProjectResources.md) | | [optional]
**PermittedSites** | **[]string** | Array listing the permitted site IDs | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
Expand Down
15 changes: 15 additions & 0 deletions v1/pkg/client/docs/ProjectResources.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# ProjectResources

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Hosts** | **int32** | Number of hosts in use | [optional]
**Volumes** | **int32** | Number of volumes in use | [optional]
**VolumeCapacity** | **int64** | Volume capacity in use in TiB | [optional]
**PrivateNetworks** | **int32** | Number of private networks in use | [optional]
**InstanceTypes** | **map[string]int32** | Number of hosts with the instance type in use | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


10 changes: 6 additions & 4 deletions v1/pkg/client/model_limits.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ package client
// Limits struct for Limits
type Limits struct {
// Maximum number of hosts to allow
Hosts int32 `json:"Hosts,omitempty"`
Hosts int32 `json:"Hosts"`
// Maximum number of volumes to allow
Volumes int32 `json:"Volumes,omitempty"`
Volumes int32 `json:"Volumes"`
// Maximum capacity to allow in TiB
VolumeCapacity int64 `json:"VolumeCapacity,omitempty"`
VolumeCapacity int64 `json:"VolumeCapacity"`
// Maximum number of private networks to allow
PrivateNetworks int32 `json:"PrivateNetworks,omitempty"`
PrivateNetworks int32 `json:"PrivateNetworks"`
// Map of instance type ID to maximum number of hosts that can be created with that instance type
InstanceTypes map[string]int32 `json:"InstanceTypes,omitempty"`
}
3 changes: 3 additions & 0 deletions v1/pkg/client/model_machine_size_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@ type MachineSizeInfo struct {
ProjectsUsed int32 `json:"ProjectsUsed,omitempty"`
OtherUsed int32 `json:"OtherUsed,omitempty"`
Available int32 `json:"Available,omitempty"`
ID string `json:"ID,omitempty"`
// True if the usage of this machine size is restricted to selected projects, false if the machine size is available to anyone.
Restricted bool `json:"Restricted,omitempty"`
}
1 change: 1 addition & 0 deletions v1/pkg/client/model_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type Project struct {
Modified time.Time `json:"Modified,omitempty"`
Profile Profile `json:"Profile"`
Limits Limits `json:"Limits"`
Resources ProjectResources `json:"Resources,omitempty"`
// Array listing the permitted site IDs
PermittedSites []string `json:"PermittedSites,omitempty"`
}
1 change: 1 addition & 0 deletions v1/pkg/client/model_project_all_of.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ package client
type ProjectAllOf struct {
Profile Profile `json:"Profile"`
Limits Limits `json:"Limits"`
Resources ProjectResources `json:"Resources,omitempty"`
// Array listing the permitted site IDs
PermittedSites []string `json:"PermittedSites,omitempty"`
}
26 changes: 26 additions & 0 deletions v1/pkg/client/model_project_resources.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP

/*
* HPE GreenLake Metal Client API
*
* This Metal Client REST API provides access to bare metal as-a-service (BMaaS) within a single project context. Clients are able to create fully-provisioned hosts, storage volumes, and project-specific private networks in an isolated project environment. Project-owned resources that can be accessed via this API include... Host, Volume, VolumeAttachment, Network (project private), and SSH Key. Each API call is done within a single project context. The specific Project identifier must be provided within the header of each REST call. The server will validate that the provided authentication credentials (JWTs) are valid for the referenced project before any operation is performed. If a single credential is valid for multiple projects, the client must still reference a single project in the header each API call. Clients can also access information about available services and resources through the AvailableResources object. This object provides detailed information about the OS imaging options, the machine size options, the storage volume options, data center locations, and such that are needed when creating hosts and volumes. Note: All URIs are relative to metal_service_url/rest/v1
*
* API version: 1.3.8
* Contact: quake-core@hpe.com
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/

package client
// ProjectResources struct for ProjectResources
type ProjectResources struct {
// Number of hosts in use
Hosts int32 `json:"Hosts,omitempty"`
// Number of volumes in use
Volumes int32 `json:"Volumes,omitempty"`
// Volume capacity in use in TiB
VolumeCapacity int64 `json:"VolumeCapacity,omitempty"`
// Number of private networks in use
PrivateNetworks int32 `json:"PrivateNetworks,omitempty"`
// Number of hosts with the instance type in use
InstanceTypes map[string]int32 `json:"InstanceTypes,omitempty"`
}

0 comments on commit f2d287b

Please sign in to comment.