Skip to content

Commit

Permalink
Merge branch 'main' into dbaas-kafka-create-topic-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dweinshenker authored Oct 26, 2023
2 parents b303a92 + 352faf3 commit b6f04e7
Show file tree
Hide file tree
Showing 44 changed files with 1,071 additions and 418 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/validate-client-generation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Install Poetry
uses: snok/install-poetry@v1.3.1
with:
version: 1.1.13
version: 1.6.1
virtualenvs-path: .venv
virtualenvs-create: true
virtualenvs-in-project: true
Expand Down
1,072 changes: 689 additions & 383 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"@redocly/cli": "^1.0.0-beta.104",
"@stoplight/spectral-cli": "6.4.1",
"autorest": "^3.6.1",
"newman": "^5.3.2",
"newman": "^6.0.0",
"openapi-to-postmanv2": "^4.0.0"
},
"scripts": {
Expand Down
12 changes: 12 additions & 0 deletions specification/DigitalOcean-public.v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1271,6 +1271,18 @@ paths:
get:
$ref: 'resources/monitoring/monitoring_get_dropletMemoryAvailableMetrics.yml'

/v2/monitoring/metrics/apps/memory_percentage:
get:
$ref: 'resources/monitoring/monitoring_get_appMemoryPercentageMetrics.yml'

/v2/monitoring/metrics/apps/cpu_percentage:
get:
$ref: 'resources/monitoring/monitoring_get_appCPUPercentageMetrics.yml'

/v2/monitoring/metrics/apps/restart_count:
get:
$ref: 'resources/monitoring/monitoring_get_appRestartCountMetrics.yml'

/v2/projects:
get:
$ref: 'resources/projects/projects_list.yml'
Expand Down
9 changes: 7 additions & 2 deletions specification/resources/apps/models/app_functions_spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@

type: object
properties:

cors:
$ref: apps_cors_policy.yml
allOf:
- $ref: apps_cors_policy.yml
- description: (Deprecated - Use Ingress Rules instead).
- deprecated: true

routes:
type: array
description: A list of HTTP routes that should be routed to this component.
description: (Deprecated - Use Ingress Rules instead). A list of HTTP routes that should be routed to this component.
deprecated: true
items:
$ref: app_route_spec.yml

Expand Down
2 changes: 1 addition & 1 deletion specification/resources/apps/models/app_route_spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ title: A criterion for routing HTTP traffic to a component.
type: object
properties:
path:
description: An HTTP path prefix. Paths must start with / and must be unique across
description: (Deprecated - Use Ingress Rules instead). An HTTP path prefix. Paths must start with / and must be unique across
all components within an app.
type: string
example: /api
Expand Down
8 changes: 6 additions & 2 deletions specification/resources/apps/models/app_service_spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ allOf:
- type: object
properties:
cors:
$ref: apps_cors_policy.yml
allOf:
- $ref: apps_cors_policy.yml
- description: (Deprecated - Use Ingress Rules instead).
- deprecated: true

health_check:
$ref: app_service_spec_health_check.yml
Expand All @@ -32,7 +35,8 @@ allOf:

routes:
type: array
description: A list of HTTP routes that should be routed to this component.
description: (Deprecated - Use Ingress Rules instead). A list of HTTP routes that should be routed to this component.
deprecated: true
items:
$ref: app_route_spec.yml

Expand Down
8 changes: 6 additions & 2 deletions specification/resources/apps/models/app_static_site_spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,17 @@ allOf:
example: dist/

cors:
$ref: apps_cors_policy.yml
allOf:
- $ref: apps_cors_policy.yml
- description: (Deprecated - Use Ingress Rules instead).
- deprecated: true

routes:
type: array
items:
$ref: app_route_spec.yml
description: A list of HTTP routes that should be routed to this component.
description: (Deprecated - Use Ingress Rules instead). A list of HTTP routes that should be routed to this component.
deprecated: true

required:
- name
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ requestBody:
version: "14"
region: nyc3
size: db-s-2vcpu-4gb
storage_size_mib: 61440
num_nodes: 2
tags:
- production
Expand All @@ -57,6 +58,7 @@ requestBody:
region: nyc3
size: db-s-2vcpu-4gb
num_nodes: 2
storage_size_mib: 61440
tags:
- production
rules:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ responses:

x-codeSamples:
- $ref: 'examples/curl/databases_create_topic.yml'
- $ref: 'examples/go/databases_create_topic.yml'

security:
- bearer_auth:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ responses:

x-codeSamples:
- $ref: 'examples/curl/databases_delete_topic.yml'
- $ref: 'examples/go/databases_delete_topic.yml'

security:
- bearer_auth:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ responses:

x-codeSamples:
- $ref: 'examples/curl/databases_get_topic.yml'
- $ref: 'examples/go/databases_get_topic.yml'

security:
- bearer_auth:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ responses:

x-codeSamples:
- $ref: 'examples/curl/databases_list_topics.yml'
- $ref: 'examples/go/databases_list_topics.yml'

security:
- bearer_auth:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ requestBody:
example:
size: db-s-4vcpu-8gb
num_nodes: 3
storage_size_mib: 163840

responses:
'202':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,12 @@ requestBody:
schema:
allOf:
- $ref: 'models/kafka_topic_update.yml'
required:
- topic
example:
topic:
name: customer-events
partitions: 3
replication: 2
config:
retention_bytes: -1
retention_ms: 100000
partitions: 3
replication: 2
config:
retention_bytes: -1
retention_ms: 100000

responses:
'200':
Expand All @@ -53,6 +49,7 @@ responses:

x-codeSamples:
- $ref: 'examples/curl/databases_update_topic.yml'
- $ref: 'examples/go/databases_update_topic.yml'

security:
- bearer_auth:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ source: |-
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
-d '{"name": "backend", "engine": "pg", "version": "14", "region": "nyc3", "size": "db-s-2vcpu-4gb", "num_nodes": 2, "tags": ["production"]}' \
-d '{"name": "backend", "engine": "pg", "version": "14", "region": "nyc3", "size": "db-s-2vcpu-4gb", "num_nodes": 2, "storage_size_mib": 61440, "tags": ["production"]}' \
"https://api.digitalocean.com/v2/databases"
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ source: |-
curl -X PUT \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
-d '{"size":"db-s-4vcpu-8gb", "num_nodes":3}' \
-d '{"size":"db-s-4vcpu-8gb", "num_nodes":3, "storage_size_mib":163840}' \
"https://api.digitalocean.com/v2/databases/9cc10173-e9ea-4176-9dbc-a4cee4c4ff30/resize"
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ source: |-
curl -X PUT \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
-d '{"topic":{"name":"customer-events", "partition_count":3, "replication_factor": 3, "config": {"retentionMS": 1000000}}}' \
-d '{"partition_count":3, "replication_factor": 3, "config": {"retentionMS": 1000000}}' \
"https://api.digitalocean.com/v2/databases/9cc10173-e9ea-4176-9dbc-a4cee4c4ff30/topics/customer-events"
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ source: |-
Region: "nyc3",
SizeSlug: "db-s-2vcpu-4gb",
NumNodes: 2,
StorageSizeMiB : 61440,
}
cluster, _, err := client.Databases.Create(ctx, createRequest)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
lang: Go
source: |-
import (
"context"
"os"
"github.com/digitalocean/godo"
)
func main() {
token := os.Getenv("DIGITALOCEAN_TOKEN")
client := godo.NewFromToken(token)
ctx := context.TODO()
createRequest := &DatabaseCreateTopicRequest{
Name: "events",
PartitionCount: 3,
ReplicationFactor: 2,
Config: &TopicConfig{
RetentionMS: 60000,
}
},
cluster, _, err := client.Databases.CreateTopic(ctx, "9cc10173-e9ea-4176-9dbc-a4cee4c4ff30", createRequest)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
lang: Go
source: |-
import (
"context"
"os"
"github.com/digitalocean/godo"
)
func main() {
token := os.Getenv("DIGITALOCEAN_TOKEN")
client := godo.NewFromToken(token)
ctx := context.TODO()
topicName := "events"
_, err := client.Databases.DeleteTopic(ctx, "9cc10173-e9ea-4176-9dbc-a4cee4c4ff30", topicName)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
lang: Go
source: |-
import (
"context"
"os"
"github.com/digitalocean/godo"
)
func main() {
token := os.Getenv("DIGITALOCEAN_TOKEN")
client := godo.NewFromToken(token)
ctx := context.TODO()
topicName := "events"
user, _, err := client.Databases.GetTopic(ctx, "9cc10173-e9ea-4176-9dbc-a4cee4c4ff30", topicName)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
lang: Go
source: |-
import (
"context"
"os"
"github.com/digitalocean/godo"
)
func main() {
token := os.Getenv("DIGITALOCEAN_TOKEN")
client := godo.NewFromToken(token)
ctx := context.TODO()
replicas, _, err := client.Databases.ListTopics(ctx, "9cc10173-e9ea-4176-9dbc-a4cee4c4ff30", nil)
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ source: |-
resizeRequest := &godo.DatabaseResizeRequest{
SizeSlug: "db-s-4vcpu-8gb",
NumNodes: 3,
StorageSizeMib: 163840,
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
lang: Go
source: |-
import (
"context"
"os"
"github.com/digitalocean/godo"
)
func main() {
token := os.Getenv("DIGITALOCEAN_TOKEN")
client := godo.NewFromToken(token)
ctx := context.TODO()
topicName := "events"
updateRequest := &DatabaseUpdateTopicRequest{
PartitionCount: 3,
ReplicationFactor: 2,
Config: &TopicConfig{
RetentionMS: 60000,
},
}
_, err := client.Databases.UpdateTopic(ctx, "9cc10173-e9ea-4176-9dbc-a4cee4c4ff30", topicName, updateRequest)
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ source: |-
"region": "nyc3",
"size": "db-s-2vcpu-4gb",
"num_nodes": 2,
"storage_size_mib": 61440,
"tags": [
"production"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ source: |-
req = {
"size": "db-s-4vcpu-8gb",
"num_nodes": 3
"num_nodes": 3,
"storage_size_mib": 163840
}
update_resp = client.databases.update_cluster_size(database_cluster_uuid="a7a8bas", body=req)
6 changes: 6 additions & 0 deletions specification/resources/databases/models/database_cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ properties:
description: >-
A timestamp referring to the date when the particular version will no longer be available for creating new
clusters. If null, the version does not have an end of availability timeline.
storage_size_mib:
type: integer
example: 61440
description: >-
Additional storage added to the cluster, in MiB. If null, no additional storage is added to the cluster, beyond
what is provided as a base amount from the 'size' and any previously added additional storage.
required:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ properties:
The number of nodes in the database cluster. Valid values are are 1-3.
In addition to the primary node, up to two standby nodes may be added for
highly available configurations.
storage_size_mib:
type: integer
example: 61440
description: >-
Additional storage added to the cluster, in MiB. If null, no additional storage is added to the cluster, beyond
what is provided as a base amount from the 'size' and any previously added additional storage.
required:
- size
Expand Down
Loading

0 comments on commit b6f04e7

Please sign in to comment.