Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update python request example for tags, update tags description for f… #957

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions specification/resources/firewalls/firewalls_add_tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ tags:
- Firewalls

parameters:
- $ref: 'parameters.yml#/firewall_id'
- $ref: "parameters.yml#/firewall_id"

requestBody:
content:
Expand All @@ -24,7 +24,7 @@ requestBody:
properties:
tags:
allOf:
- $ref: '../../shared/attributes/tags_array.yml'
- $ref: "../../shared/attributes/existing_tags_array.yml"
- description: >-
An array containing the names of the Tags to be assigned to
the firewall.
Expand All @@ -37,33 +37,33 @@ requestBody:
- frontend

responses:
'204':
$ref: '../../shared/responses/no_content.yml'
"204":
$ref: "../../shared/responses/no_content.yml"

'400':
$ref: '../../shared/responses/bad_request.yml'
"400":
$ref: "../../shared/responses/bad_request.yml"

'401':
$ref: '../../shared/responses/unauthorized.yml'
"401":
$ref: "../../shared/responses/unauthorized.yml"

'404':
$ref: '../../shared/responses/not_found.yml'
"404":
$ref: "../../shared/responses/not_found.yml"

'429':
$ref: '../../shared/responses/too_many_requests.yml'
"429":
$ref: "../../shared/responses/too_many_requests.yml"

'500':
$ref: '../../shared/responses/server_error.yml'
"500":
$ref: "../../shared/responses/server_error.yml"

default:
$ref: '../../shared/responses/unexpected_error.yml'
$ref: "../../shared/responses/unexpected_error.yml"

x-codeSamples:
- $ref: 'examples/curl/firewalls_add_tags.yml'
- $ref: 'examples/go/firewalls_add_tags.yml'
- $ref: 'examples/ruby/firewalls_add_tags.yml'
- $ref: 'examples/python/firewalls_add_tags.yml'
- $ref: "examples/curl/firewalls_add_tags.yml"
- $ref: "examples/go/firewalls_add_tags.yml"
- $ref: "examples/ruby/firewalls_add_tags.yml"
- $ref: "examples/python/firewalls_add_tags.yml"

security:
- bearer_auth:
- 'firewall:update'
- "firewall:update"
40 changes: 20 additions & 20 deletions specification/resources/firewalls/firewalls_delete_tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ tags:
- Firewalls

parameters:
- $ref: 'parameters.yml#/firewall_id'
- $ref: "parameters.yml#/firewall_id"

requestBody:
content:
Expand All @@ -24,7 +24,7 @@ requestBody:
properties:
tags:
allOf:
- $ref: '../../shared/attributes/tags_array.yml'
- $ref: "../../shared/attributes/existing_tags_array.yml"
- description: >-
An array containing the names of the Tags to be removed from
the firewall.
Expand All @@ -37,33 +37,33 @@ requestBody:
- frontend

responses:
'204':
$ref: '../../shared/responses/no_content.yml'
"204":
$ref: "../../shared/responses/no_content.yml"

'400':
$ref: '../../shared/responses/bad_request.yml'
"400":
$ref: "../../shared/responses/bad_request.yml"

'401':
$ref: '../../shared/responses/unauthorized.yml'
"401":
$ref: "../../shared/responses/unauthorized.yml"

'404':
$ref: '../../shared/responses/not_found.yml'
"404":
$ref: "../../shared/responses/not_found.yml"

'429':
$ref: '../../shared/responses/too_many_requests.yml'
"429":
$ref: "../../shared/responses/too_many_requests.yml"

'500':
$ref: '../../shared/responses/server_error.yml'
"500":
$ref: "../../shared/responses/server_error.yml"

default:
$ref: '../../shared/responses/unexpected_error.yml'
$ref: "../../shared/responses/unexpected_error.yml"

x-codeSamples:
- $ref: 'examples/curl/firewalls_delete_tags.yml'
- $ref: 'examples/go/firewalls_delete_tags.yml'
- $ref: 'examples/ruby/firewalls_delete_tags.yml'
- $ref: 'examples/python/firewalls_delete_tags.yml'
- $ref: "examples/curl/firewalls_delete_tags.yml"
- $ref: "examples/go/firewalls_delete_tags.yml"
- $ref: "examples/ruby/firewalls_delete_tags.yml"
- $ref: "examples/python/firewalls_delete_tags.yml"

security:
- bearer_auth:
- 'firewall:update'
- "firewall:update"
6 changes: 3 additions & 3 deletions specification/resources/firewalls/models/firewall.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ allOf:
A time value given in ISO8601 combined date and time format that
represents when the firewall was created.
readOnly: true
example: '2020-05-23T21:24:00Z'
example: "2020-05-23T21:24:00Z"

pending_changes:
type: array
Expand Down Expand Up @@ -78,9 +78,9 @@ allOf:

tags:
allOf:
- $ref: '../../../shared/attributes/tags_array.yml'
- $ref: "../../../shared/attributes/existing_tags_array.yml"
- description: >-
An array containing the names of the Tags assigned to the firewall.
example: gateway

- $ref: 'firewall_rule.yml#/firewall_rules'
- $ref: "firewall_rule.yml#/firewall_rules"
16 changes: 8 additions & 8 deletions specification/resources/firewalls/models/firewall_rule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ firewall_rule_base:
containing a single port, a range (e.g. "8000-9000"), or "0" when all
ports are open for a protocol. For ICMP rules this parameter will always
return "0".
example: '8000'
example: "8000"

required:
- protocol
Expand All @@ -39,8 +39,8 @@ firewall_rule_target:
An array of strings containing the IPv4 addresses, IPv6 addresses, IPv4
CIDRs, and/or IPv6 CIDRs to which the firewall will allow traffic.
example:
- '1.2.3.4'
- '18.0.0.0/8'
- "1.2.3.4"
- "18.0.0.0/8"

droplet_ids:
type: array
Expand Down Expand Up @@ -74,7 +74,7 @@ firewall_rule_target:

tags:
allOf:
- $ref: '../../../shared/attributes/tags_array.yml'
- $ref: "../../../shared/attributes/existing_tags_array.yml"
- description: >-
An array containing the names of Tags corresponding to groups of
Droplets to which the firewall will allow traffic.
Expand All @@ -90,11 +90,11 @@ firewall_rules:
type: array
items:
allOf:
- $ref: '#/firewall_rule_base'
- $ref: "#/firewall_rule_base"
- properties:
sources:
allOf:
- $ref: '#/firewall_rule_target'
- $ref: "#/firewall_rule_target"
- description: >-
An object specifying locations from which inbound traffic
will be accepted.
Expand All @@ -106,11 +106,11 @@ firewall_rules:
type: array
items:
allOf:
- $ref: '#/firewall_rule_base'
- $ref: "#/firewall_rule_base"
- properties:
destinations:
allOf:
- $ref: '#/firewall_rule_target'
- $ref: "#/firewall_rule_target"
- description: >-
An object specifying locations to which outbound
traffic that will be allowed.
Expand Down
24 changes: 1 addition & 23 deletions specification/resources/tags/examples/python/tags_create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,6 @@ source: |-

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))

req = {
"tag": {
"name": "extra-awesome",
"resources": {
"count": 0,
"droplets": {
"count": 0
},
"images": {
"count": 0
},
"volumes": {
"count": 0
},
"volume_snapshots": {
"count": 0
},
"databases": {
"count": 0
}
}
}
}
req = {"name": "extra-awesome"}

resp = client.tags.create(body=req)
10 changes: 10 additions & 0 deletions specification/shared/attributes/existing_tags_array.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
type: array
items:
type: string
nullable: true
description: >-
A flat array of tag names as strings to be applied to the resource.
Tag names must exist in order to be referenced in a request.
example:
- base-image
- prod
2 changes: 1 addition & 1 deletion specification/shared/attributes/tags_array.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ description: >-
Tag names may be for either existing or new tags.
example:
- base-image
- prod
- prod
Loading