diff --git a/api/openapi.gen.json b/api/openapi.gen.json index 26980782..fd3d4027 100644 --- a/api/openapi.gen.json +++ b/api/openapi.gen.json @@ -95,6 +95,7 @@ "poweroff": false, "pubkey_id": 42, "reservation_id": 1310, + "resource_group": "myCustom Azure RG", "source_id": "654321" } }, @@ -109,6 +110,7 @@ "poweroff": false, "pubkey_id": 42, "reservation_id": 1310, + "resource_group": "myCustom Azure RG", "source_id": "654321" } }, @@ -757,6 +759,9 @@ "format": "int64", "type": "integer" }, + "resource_group": { + "type": "string" + }, "source_id": { "type": "string" } diff --git a/api/openapi.gen.yaml b/api/openapi.gen.yaml index d7974bf7..48bb4f20 100644 --- a/api/openapi.gen.yaml +++ b/api/openapi.gen.yaml @@ -147,6 +147,8 @@ components: reservation_id: type: integer format: int64 + resource_group: + type: string source_id: type: string v1.GCPReservationRequest: @@ -685,6 +687,7 @@ components: poweroff: false pubkey_id: 42 reservation_id: 1310 + resource_group: myCustom Azure RG source_id: "654321" v1.AzureReservationResponsePayloadPendingExample: value: @@ -697,6 +700,7 @@ components: poweroff: false pubkey_id: 42 reservation_id: 1310 + resource_group: myCustom Azure RG source_id: "654321" v1.GCPReservationRequestPayloadExample: value: diff --git a/cmd/spec/example_reservation.go b/cmd/spec/example_reservation.go index bbc8db45..11e97a60 100644 --- a/cmd/spec/example_reservation.go +++ b/cmd/spec/example_reservation.go @@ -132,28 +132,30 @@ var AzureReservationRequestPayloadExample = payloads.AzureReservationRequest{ } var AzureReservationResponsePayloadPendingExample = payloads.AzureReservationResponse{ - ID: 1310, - PubkeyID: 42, - SourceID: "654321", - Location: "useast", - InstanceSize: "Basic_A0", - Amount: 1, - ImageID: "composer-api-081fc867-838f-44a5-af03-8b8def808431", - Name: "my-instance", - PowerOff: false, - Instances: nil, + ID: 1310, + PubkeyID: 42, + SourceID: "654321", + ResourceGroup: "myCustom Azure RG", + Location: "useast", + InstanceSize: "Basic_A0", + Amount: 1, + ImageID: "composer-api-081fc867-838f-44a5-af03-8b8def808431", + Name: "my-instance", + PowerOff: false, + Instances: nil, } var AzureReservationResponsePayloadDoneExample = payloads.AzureReservationResponse{ - ID: 1310, - PubkeyID: 42, - SourceID: "654321", - Location: "useast", - InstanceSize: "Basic_A0", - Amount: 1, - ImageID: "composer-api-081fc867-838f-44a5-af03-8b8def808431", - Name: "my-instance", - PowerOff: false, + ID: 1310, + PubkeyID: 42, + SourceID: "654321", + ResourceGroup: "myCustom Azure RG", + Location: "useast", + InstanceSize: "Basic_A0", + Amount: 1, + ImageID: "composer-api-081fc867-838f-44a5-af03-8b8def808431", + Name: "my-instance", + PowerOff: false, Instances: []payloads.InstanceResponse{{ InstanceID: "/subscriptions/4b9d213f-712f-4d17-a483-8a10bbe9df3a/resourceGroups/redhat-deployed/providers/Microsoft.Compute/images/composer-api-92ea98f8-7697-472e-80b1-7454fa0e7fa7", Detail: models.ReservationInstanceDetail{ diff --git a/internal/payloads/reservation_payload.go b/internal/payloads/reservation_payload.go index d0878122..e2ff8415 100644 --- a/internal/payloads/reservation_payload.go +++ b/internal/payloads/reservation_payload.go @@ -95,6 +95,8 @@ type AzureReservationResponse struct { SourceID string `json:"source_id" yaml:"source_id"` + ResourceGroup string `json:"resource_group" yaml:"resource_group"` + // Azure Location. Location string `json:"location" yaml:"location"` @@ -320,16 +322,17 @@ func NewAzureReservationResponse(reservation *models.AzureReservation, instances } response := AzureReservationResponse{ - PubkeyID: reservation.PubkeyID, - ImageID: reservation.ImageID, - SourceID: reservation.SourceID, - Location: reservation.Detail.Location, - Amount: reservation.Detail.Amount, - InstanceSize: reservation.Detail.InstanceSize, - ID: reservation.ID, - Name: reservation.Detail.Name, - PowerOff: reservation.Detail.PowerOff, - Instances: instanceIds, + PubkeyID: reservation.PubkeyID, + ImageID: reservation.ImageID, + SourceID: reservation.SourceID, + ResourceGroup: reservation.Detail.ResourceGroup, + Location: reservation.Detail.Location, + Amount: reservation.Detail.Amount, + InstanceSize: reservation.Detail.InstanceSize, + ID: reservation.ID, + Name: reservation.Detail.Name, + PowerOff: reservation.Detail.PowerOff, + Instances: instanceIds, } return &response }