From 57004cdd10bef93e4751e82ec5845be9509dbb3b Mon Sep 17 00:00:00 2001 From: Dmitry Kisler Date: Tue, 1 Oct 2024 08:49:57 +0200 Subject: [PATCH] update spec as of 2024-10-01 6:44AM UTC Signed-off-by: Dmitry Kisler --- CHANGELOG.md | 17 ++++++++ generator/generator.go | 5 ++- generator/generator_test.go | 2 +- mockhttp.go | 2 +- openAPIDefinition.json | 82 ++++++++++++++++++++----------------- sdk.go | 25 +++++++---- 6 files changed, 84 insertions(+), 49 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32578fa..af74e93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,23 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [v0.6.1] - 2024-10-01 + +The release incorporates the up-to-date [API contract](openAPIDefinition.json) as of 2024-09-28 06:44:00 GMT. + +### Added + +- Added "azure_mp" as a `BillingPaymentMethod` enum value. + +### Changed + +- Changed the response type of the method `ListProjects`, `ListProjectsRespObj`. It includes the map + `ProjectsApplicationsMapResponse` which contains all applications available in the project. + +### Deprecated + +- Deprecated `Login` field in the types `CurrentUserAuthAccount` and `CurrentUserInfoResponse`. + ## [v0.6.0] - 2024-09-28 The release incorporates the up-to-date [API contract](openAPIDefinition.json) as of 2024-09-28 21:53:00 GMT. diff --git a/generator/generator.go b/generator/generator.go index f8ab5b5..5a7aa11 100644 --- a/generator/generator.go +++ b/generator/generator.go @@ -1288,8 +1288,9 @@ func (m model) generateCode() string { } tmp += objNameGoConventionExport(fieldName) + " " + field.argType(pointerFlag) + " `json:\"" + field.k + omitEmpty + "\"" + - " pulumi:\"" + field.k + "\"`" + - "\n" + // TODO: add pulumi tags (?) + // " pulumi:\"" + field.k + pulumiOptional + "\"`" + + "`\n" } if len(m.fields) == 0 { diff --git a/generator/generator_test.go b/generator/generator_test.go index 870e6fe..c85d899 100644 --- a/generator/generator_test.go +++ b/generator/generator_test.go @@ -1280,7 +1280,7 @@ FooResponse }, }, want: []string{ - "type FooResponse struct {\nFoo Foo `json:\"foo\" pulumi:\"foo\"`\n}", + "type FooResponse struct {\nFoo Foo `json:\"foo\"`\n}", }, }, { diff --git a/mockhttp.go b/mockhttp.go index 7c142b2..fdb2d33 100644 --- a/mockhttp.go +++ b/mockhttp.go @@ -50,7 +50,7 @@ var endpointResponseExamples = map[string]map[string]mockResponse{ "/projects": { "GET": mockResponse{ - Content: `{"projects":[{"active_time":100,"branch_logical_size_limit":0,"branch_logical_size_limit_bytes":10800,"cpu_used_sec":0,"created_at":"2022-11-23T17:42:25Z","creation_source":"console","id":"shiny-wind-028834","name":"shiny-wind-028834","owner_id":"1232111","pg_version":15,"platform_id":"aws","provisioner":"k8s-pod","proxy_host":"us-east-2.aws.neon.tech","region_id":"aws-us-east-2","store_passwords":true,"updated_at":"2022-11-23T17:42:25Z"},{"active_time":100,"branch_logical_size_limit":0,"branch_logical_size_limit_bytes":10800,"cpu_used_sec":0,"created_at":"2022-11-23T17:52:25Z","creation_source":"console","id":"winter-boat-259881","name":"winter-boat-259881","org_id":"org-morning-bread-81040908","owner_id":"1232111","pg_version":15,"platform_id":"aws","provisioner":"k8s-pod","proxy_host":"us-east-2.aws.neon.tech","region_id":"aws-us-east-2","store_passwords":true,"updated_at":"2022-11-23T17:52:25Z"}]}`, + Content: `{"applications":{"winter-boat-259881":["vercel","github"]},"projects":[{"active_time":100,"branch_logical_size_limit":0,"branch_logical_size_limit_bytes":10800,"cpu_used_sec":0,"created_at":"2022-11-23T17:42:25Z","creation_source":"console","id":"shiny-wind-028834","name":"shiny-wind-028834","owner_id":"1232111","pg_version":15,"platform_id":"aws","provisioner":"k8s-pod","proxy_host":"us-east-2.aws.neon.tech","region_id":"aws-us-east-2","store_passwords":true,"updated_at":"2022-11-23T17:42:25Z"},{"active_time":100,"branch_logical_size_limit":0,"branch_logical_size_limit_bytes":10800,"cpu_used_sec":0,"created_at":"2022-11-23T17:52:25Z","creation_source":"console","id":"winter-boat-259881","name":"winter-boat-259881","org_id":"org-morning-bread-81040908","owner_id":"1232111","pg_version":15,"platform_id":"aws","provisioner":"k8s-pod","proxy_host":"us-east-2.aws.neon.tech","region_id":"aws-us-east-2","store_passwords":true,"updated_at":"2022-11-23T17:52:25Z"}]}`, Code: 200, }, "POST": mockResponse{ diff --git a/openAPIDefinition.json b/openAPIDefinition.json index 2a1d2da..0e7ed3d 100644 --- a/openAPIDefinition.json +++ b/openAPIDefinition.json @@ -309,6 +309,9 @@ }, { "$ref": "#/components/schemas/PaginationResponse" + }, + { + "$ref": "#/components/schemas/ProjectsApplicationsMapResponse" } ] }, @@ -351,7 +354,13 @@ "active_time": 100, "org_id": "org-morning-bread-81040908" } - ] + ], + "applications": { + "winter-boat-259881": [ + "vercel", + "github" + ] + } } } } @@ -5814,41 +5823,6 @@ } } }, - "NotificationMetricType": { - "type": "string", - "description": "The metric type for a given notification\n", - "enum": [ - "database_size", - "connections", - "cpu", - "ram", - "compute_over_limit" - ] - }, - "NotificationCategoryType": { - "type": "string", - "description": "The category type for a given notification\n", - "enum": [ - "usage", - "performance" - ] - }, - "NotificationType": { - "type": "string", - "description": "The type of the notification\n", - "enum": [ - "info", - "warning" - ] - }, - "NotificationActionType": { - "type": "string", - "description": "The action type for a given notification\n", - "enum": [ - "upgrade_plan", - "upgrade_cu" - ] - }, "Role": { "type": "object", "required": [ @@ -6115,6 +6089,7 @@ "stripe", "direct_payment", "aws_mp", + "azure_mp", "vercel_mp", "staff", "trial", @@ -6655,7 +6630,9 @@ "type": "string" }, "login": { - "type": "string" + "type": "string", + "deprecated": true, + "description": "DEPRECATED. Use `email` field.\n" }, "name": { "type": "string" @@ -6756,7 +6733,9 @@ "type": "string" }, "login": { - "type": "string" + "type": "string", + "deprecated": true, + "description": "DEPRECATED. Use `email` field.\n" }, "name": { "type": "string" @@ -7260,6 +7239,33 @@ } } } + }, + "ProjectsApplicationsMapResponse": { + "type": "object", + "x-tags": [ + "Project" + ], + "description": "A map where key is a project ID and a value is a list of available applications.\n", + "required": [ + "applications" + ], + "properties": { + "applications": { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "example": { + "winter-boat-259881": [ + "vercel", + "github" + ] + } } } } diff --git a/sdk.go b/sdk.go index 4e40e2d..34fb051 100644 --- a/sdk.go +++ b/sdk.go @@ -1015,6 +1015,7 @@ type BillingPaymentMethod string const ( BillingPaymentMethodUNKNOWN BillingPaymentMethod = "UNKNOWN" BillingPaymentMethodAwsMp BillingPaymentMethod = "aws_mp" + BillingPaymentMethodAzureMp BillingPaymentMethod = "azure_mp" BillingPaymentMethodDirectPayment BillingPaymentMethod = "direct_payment" BillingPaymentMethodNone BillingPaymentMethod = "none" BillingPaymentMethodSponsorship BillingPaymentMethod = "sponsorship" @@ -1263,8 +1264,9 @@ type CreatedProject struct { } type CurrentUserAuthAccount struct { - Email string `json:"email"` - Image string `json:"image"` + Email string `json:"email"` + Image string `json:"image"` + // Login DEPRECATED. Use `email` field. Login string `json:"login"` Name string `json:"name"` Provider IdentityProviderId `json:"provider"` @@ -1281,11 +1283,12 @@ type CurrentUserInfoResponse struct { ID string `json:"id"` Image string `json:"image"` LastName string `json:"last_name"` - Login string `json:"login"` - MaxAutoscalingLimit ComputeUnit `json:"max_autoscaling_limit"` - Name string `json:"name"` - Plan string `json:"plan"` - ProjectsLimit int64 `json:"projects_limit"` + // Login DEPRECATED. Use `email` field. + Login string `json:"login"` + MaxAutoscalingLimit ComputeUnit `json:"max_autoscaling_limit"` + Name string `json:"name"` + Plan string `json:"plan"` + ProjectsLimit int64 `json:"projects_limit"` } type Database struct { @@ -1533,6 +1536,7 @@ type ListProjectsConsumptionRespObj struct { type ListProjectsRespObj struct { PaginationResponse + ProjectsApplicationsMapResponse ProjectsResponse } @@ -1940,6 +1944,13 @@ type ProjectUpdateRequestProject struct { Settings *ProjectSettingsData `json:"settings,omitempty"` } +// ProjectsApplicationsMapResponse A map where key is a project ID and a value is a list of available applications. +type ProjectsApplicationsMapResponse struct { + Applications ProjectsApplicationsMapResponseApplications `json:"applications"` +} + +type ProjectsApplicationsMapResponseApplications map[string]interface{} + type ProjectsConsumptionResponse struct { PeriodsInResponse int64 `json:"periods_in_response"` Projects []ProjectConsumption `json:"projects"`