|
|
|
|
@@ -54,6 +54,9 @@ RECORDSET_STATUSES: list[str] = [
|
|
|
|
|
"SUCCESS",
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
PTR_ACTIONS: list[str] = ["UPDATE", "DELETE", "NONE"]
|
|
|
|
|
PTR_STATUSES: list[str] = ["ACTIVE", "PENDING", "DELETED", "ERROR", "SUCCESS"]
|
|
|
|
|
|
|
|
|
|
ZONE_SCHEMA: dict[str, Any] = {
|
|
|
|
|
"type": "object",
|
|
|
|
|
"description": "DNS Zone",
|
|
|
|
|
@@ -156,6 +159,11 @@ ZONE_SCHEMA: dict[str, Any] = {
|
|
|
|
|
"description": "True if the zone is shared with another project.",
|
|
|
|
|
"x-openstack": {"min-ver": "2.1"},
|
|
|
|
|
},
|
|
|
|
|
"links": {
|
|
|
|
|
"type": "object",
|
|
|
|
|
"readOnly": True,
|
|
|
|
|
"properties": {"self": {"type": "string", "format": "uri"}},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
"additionalProperties": False,
|
|
|
|
|
}
|
|
|
|
|
@@ -163,10 +171,108 @@ ZONE_SCHEMA: dict[str, Any] = {
|
|
|
|
|
|
|
|
|
|
ZONES_SCHEMA: dict[str, Any] = {
|
|
|
|
|
"type": "object",
|
|
|
|
|
"properties": {"zones": {"type": "array", "items": ZONE_SCHEMA}},
|
|
|
|
|
"properties": {
|
|
|
|
|
"zones": {"type": "array", "items": ZONE_SCHEMA},
|
|
|
|
|
"links": {
|
|
|
|
|
"type": "object",
|
|
|
|
|
"properties": {"self": {"type": "string", "format": "uri"}},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
"additionalProperties": False,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ZONE_SHARE_SCHEMA: dict[str, Any] = {
|
|
|
|
|
"type": "object",
|
|
|
|
|
"description": "Shared DNS Zone",
|
|
|
|
|
"properties": {
|
|
|
|
|
"id": {
|
|
|
|
|
"type": "string",
|
|
|
|
|
"format": "uuid",
|
|
|
|
|
"readOnly": True,
|
|
|
|
|
"description": "ID for the resource",
|
|
|
|
|
},
|
|
|
|
|
"project_id": {
|
|
|
|
|
"type": "string",
|
|
|
|
|
"format": "uuid",
|
|
|
|
|
"readOnly": True,
|
|
|
|
|
"description": "ID for the project that owns the resource",
|
|
|
|
|
},
|
|
|
|
|
"target_project_id": {
|
|
|
|
|
"type": "string",
|
|
|
|
|
"format": "uuid",
|
|
|
|
|
"description": "The project ID the zone will be shared with.",
|
|
|
|
|
},
|
|
|
|
|
"created_at": {
|
|
|
|
|
"type": "string",
|
|
|
|
|
"format": "date-time",
|
|
|
|
|
"readOnly": True,
|
|
|
|
|
"description": "Date / Time when resource was created.",
|
|
|
|
|
},
|
|
|
|
|
"updated_at": {
|
|
|
|
|
"type": ["string", "null"],
|
|
|
|
|
"format": "date-time",
|
|
|
|
|
"readOnly": True,
|
|
|
|
|
"description": "Date / Time when resource last updated.",
|
|
|
|
|
},
|
|
|
|
|
"links": {
|
|
|
|
|
"type": "object",
|
|
|
|
|
"readOnly": True,
|
|
|
|
|
"properties": {
|
|
|
|
|
"self": {"type": "string", "format": "uri"},
|
|
|
|
|
"zone": {"type": "string", "format": "uri"},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
"additionalProperties": False,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ZONE_SHARES_SCHEMA: dict[str, Any] = {
|
|
|
|
|
"type": "object",
|
|
|
|
|
"properties": {
|
|
|
|
|
"shared_zones": {"type": "array", "items": ZONE_SHARE_SCHEMA},
|
|
|
|
|
"links": {
|
|
|
|
|
"type": "object",
|
|
|
|
|
"readOnly": True,
|
|
|
|
|
"properties": {"self": {"type": "string", "format": "uri"}},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
"additionalProperties": False,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ZONE_SHARES_LIST_PARAMETERS: dict[str, Any] = {
|
|
|
|
|
"x-auth-all-projects": {
|
|
|
|
|
"in": "header",
|
|
|
|
|
"name": "x-auth-all-projects",
|
|
|
|
|
"description": "If enabled this will show results from all projects in Designate",
|
|
|
|
|
"schema": {"type": "bool"},
|
|
|
|
|
},
|
|
|
|
|
"x-auth-sudo-project-id": {
|
|
|
|
|
"in": "header",
|
|
|
|
|
"name": "x-auth-sudo-project-id",
|
|
|
|
|
"description": "This allows a user to impersonate another project",
|
|
|
|
|
"schema": {"type": "string"},
|
|
|
|
|
},
|
|
|
|
|
"limit": {
|
|
|
|
|
"in": "query",
|
|
|
|
|
"name": "limit",
|
|
|
|
|
"description": "Requests a page size of items. Returns a number of items up to a limit value. Use the limit parameter to make an initial limited request and use the ID of the last-seen item from the response as the marker parameter value in a subsequent limited request.",
|
|
|
|
|
"schema": {"type": "integer"},
|
|
|
|
|
},
|
|
|
|
|
"marker": {
|
|
|
|
|
"in": "query",
|
|
|
|
|
"name": "market",
|
|
|
|
|
"description": "The ID of the last-seen item. Use the limit parameter to make an initial limited request and use the ID of the last-seen item from the response as the marker parameter value in a subsequent limited request.",
|
|
|
|
|
"schema": {"type": "string", "format": "uuid"},
|
|
|
|
|
},
|
|
|
|
|
"target_project_id": {
|
|
|
|
|
"in": "query",
|
|
|
|
|
"name": "target_project_id",
|
|
|
|
|
"description": "Filter results to only show resources that have a matching target_project_id",
|
|
|
|
|
"schema": {"type": "string", "format": "uuid"},
|
|
|
|
|
"x-openstack": {"min-ver": "2.1"},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ZONES_LIST_PARAMETERS: dict[str, Any] = {
|
|
|
|
|
"x-auth-all-projects": {
|
|
|
|
|
"in": "header",
|
|
|
|
|
@@ -269,6 +375,15 @@ NAMESERVER_SCHEMA: dict[str, Any] = {
|
|
|
|
|
"readOnly": True,
|
|
|
|
|
"description": "The priority of the nameserver. This is used to determine the order of the the nameserver listings, and which server is used in the SOA record for the zone.",
|
|
|
|
|
},
|
|
|
|
|
"links": {
|
|
|
|
|
"type": "object",
|
|
|
|
|
"readOnly": True,
|
|
|
|
|
"properties": {"self": {"type": "string", "format": "uri"}},
|
|
|
|
|
},
|
|
|
|
|
"links": {
|
|
|
|
|
"type": "object",
|
|
|
|
|
"properties": {"self": {"type": "string", "format": "uri"}},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
"additionalProperties": False,
|
|
|
|
|
}
|
|
|
|
|
@@ -276,7 +391,12 @@ NAMESERVER_SCHEMA: dict[str, Any] = {
|
|
|
|
|
NAMESERVERS_SCHEMA: dict[str, Any] = {
|
|
|
|
|
"type": "object",
|
|
|
|
|
"properties": {
|
|
|
|
|
"nameservers": {"type": "array", "items": NAMESERVER_SCHEMA}
|
|
|
|
|
"nameservers": {"type": "array", "items": NAMESERVER_SCHEMA},
|
|
|
|
|
"links": {
|
|
|
|
|
"type": "object",
|
|
|
|
|
"readOnly": True,
|
|
|
|
|
"properties": {"self": {"type": "string", "format": "uri"}},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
"additionalProperties": False,
|
|
|
|
|
}
|
|
|
|
|
@@ -356,6 +476,11 @@ RECORDSET_SCHEMA: dict[str, Any] = {
|
|
|
|
|
"readOnly": True,
|
|
|
|
|
"description": "Date / Time when resource last updated.",
|
|
|
|
|
},
|
|
|
|
|
"links": {
|
|
|
|
|
"type": "object",
|
|
|
|
|
"readOnly": True,
|
|
|
|
|
"properties": {"self": {"type": "string", "format": "uri"}},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
"additionalProperties": False,
|
|
|
|
|
}
|
|
|
|
|
@@ -363,7 +488,18 @@ RECORDSET_SCHEMA: dict[str, Any] = {
|
|
|
|
|
|
|
|
|
|
RECORDSETS_SCHEMA: dict[str, Any] = {
|
|
|
|
|
"type": "object",
|
|
|
|
|
"properties": {"recordsets": {"type": "array", "items": RECORDSET_SCHEMA}},
|
|
|
|
|
"properties": {
|
|
|
|
|
"recordsets": {"type": "array", "items": RECORDSET_SCHEMA},
|
|
|
|
|
"links": {
|
|
|
|
|
"type": "object",
|
|
|
|
|
"readOnly": True,
|
|
|
|
|
"properties": {"self": {"type": "string", "format": "uri"}},
|
|
|
|
|
},
|
|
|
|
|
"links": {
|
|
|
|
|
"type": "object",
|
|
|
|
|
"properties": {"self": {"type": "string", "format": "uri"}},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
"additionalProperties": False,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -466,6 +602,128 @@ RECORDSETS_LIST_PARAMETERS: dict[str, Any] = {
|
|
|
|
|
**ZONE_RECORDSETS_LIST_PARAMETERS,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PTR_RECORD_SCHEMA: dict[str, Any] = {
|
|
|
|
|
"type": "object",
|
|
|
|
|
"properties": {
|
|
|
|
|
"id": {
|
|
|
|
|
"type": "string",
|
|
|
|
|
"format": "uuid",
|
|
|
|
|
"readOnly": True,
|
|
|
|
|
"description": "ID for PTR record in the format of <region>:<floatingip_id>",
|
|
|
|
|
},
|
|
|
|
|
"ptrdname": {
|
|
|
|
|
"type": ["string", "null"],
|
|
|
|
|
"description": "Domain name for this PTR record",
|
|
|
|
|
},
|
|
|
|
|
"description": {
|
|
|
|
|
"type": "string",
|
|
|
|
|
"description": "Description for this PTR record",
|
|
|
|
|
},
|
|
|
|
|
"ttl": {
|
|
|
|
|
"type": "integer",
|
|
|
|
|
"description": "Time to live for this PTR record",
|
|
|
|
|
},
|
|
|
|
|
"address": {
|
|
|
|
|
"type": "string",
|
|
|
|
|
"description": "The floatingip address for this PTR record.",
|
|
|
|
|
},
|
|
|
|
|
"status": {
|
|
|
|
|
"type": "string",
|
|
|
|
|
"enum": PTR_STATUSES,
|
|
|
|
|
"readOnly": True,
|
|
|
|
|
"description": "The status of the resource.",
|
|
|
|
|
},
|
|
|
|
|
"action": {
|
|
|
|
|
"type": "string",
|
|
|
|
|
"enum": PTR_ACTIONS,
|
|
|
|
|
"readOnly": True,
|
|
|
|
|
"description": "current action in progress on the resource",
|
|
|
|
|
},
|
|
|
|
|
"links": {
|
|
|
|
|
"type": "object",
|
|
|
|
|
"readOnly": True,
|
|
|
|
|
"properties": {"self": {"type": "string", "format": "uri"}},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PTR_RECORDS_SCHEMA: dict[str, Any] = {
|
|
|
|
|
"type": "object",
|
|
|
|
|
"properties": {
|
|
|
|
|
"floatingips": {"type": "array", "items": PTR_RECORD_SCHEMA},
|
|
|
|
|
"links": {
|
|
|
|
|
"type": "object",
|
|
|
|
|
"readOnly": True,
|
|
|
|
|
"properties": {"self": {"type": "string", "format": "uri"}},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
"additionalProperties": False,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PTR_RECORDS_LIST_PARAMETERS: dict[str, Any] = {
|
|
|
|
|
"x-auth-all-projects": {
|
|
|
|
|
"in": "header",
|
|
|
|
|
"name": "x-auth-all-projects",
|
|
|
|
|
"description": "If enabled this will show results from all projects in Designate",
|
|
|
|
|
"schema": {"type": "bool"},
|
|
|
|
|
},
|
|
|
|
|
"x-auth-sudo-project-id": {
|
|
|
|
|
"in": "header",
|
|
|
|
|
"name": "x-auth-sudo-project-id",
|
|
|
|
|
"description": "This allows a user to impersonate another project",
|
|
|
|
|
"schema": {"type": "string"},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LIMITS_SCHEMA: dict[str, Any] = {
|
|
|
|
|
"type": "object",
|
|
|
|
|
"properties": {
|
|
|
|
|
"max_page_limit": {
|
|
|
|
|
"type": "integer",
|
|
|
|
|
"description": "The max amount of items allowed per page.",
|
|
|
|
|
},
|
|
|
|
|
"max_recordset_name_length": {
|
|
|
|
|
"type": "integer",
|
|
|
|
|
"description": "The max length of a recordset name.",
|
|
|
|
|
},
|
|
|
|
|
"max_recordset_records": {
|
|
|
|
|
"type": "integer",
|
|
|
|
|
"description": "The max amount of records contained in a recordset.",
|
|
|
|
|
},
|
|
|
|
|
"max_zone_name_length": {
|
|
|
|
|
"type": "integer",
|
|
|
|
|
"description": "The max length of a zone name.",
|
|
|
|
|
},
|
|
|
|
|
"max_zone_records": {
|
|
|
|
|
"type": "integer",
|
|
|
|
|
"description": "The max amount of records in a zone.",
|
|
|
|
|
},
|
|
|
|
|
"max_zone_recordsets": {
|
|
|
|
|
"type": "integer",
|
|
|
|
|
"description": "The max amount of recordsets per zone.",
|
|
|
|
|
},
|
|
|
|
|
"max_zones": {
|
|
|
|
|
"type": "integer",
|
|
|
|
|
"description": "The max amount of zones for this project.",
|
|
|
|
|
},
|
|
|
|
|
"min_ttl": {
|
|
|
|
|
"type": "integer",
|
|
|
|
|
"description": "The lowest ttl allowed on this system.",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QUOTAS_SCHEMA: dict[str, Any] = {
|
|
|
|
|
"type": "object",
|
|
|
|
|
"properties": {
|
|
|
|
|
"api_export_size": {"type": "integer"},
|
|
|
|
|
"recordset_records": {"type": "integer"},
|
|
|
|
|
"zone_records": {"type": "integer"},
|
|
|
|
|
"zone_recorsets": {"type": "integer"},
|
|
|
|
|
"zones": {"type": "integer"},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _post_process_operation_hook(
|
|
|
|
|
openapi_spec, operation_spec, path: str | None = None
|
|
|
|
|
@@ -496,6 +754,22 @@ def _post_process_operation_hook(
|
|
|
|
|
ref = f"#/components/parameters/{key}"
|
|
|
|
|
if ref not in [x.ref for x in operation_spec.parameters]:
|
|
|
|
|
operation_spec.parameters.append(ParameterSchema(ref=ref))
|
|
|
|
|
elif operationId == "zones/zone_id/shares:get":
|
|
|
|
|
for key, val in ZONE_SHARES_LIST_PARAMETERS.items():
|
|
|
|
|
openapi_spec.components.parameters.setdefault(
|
|
|
|
|
key, ParameterSchema(**val)
|
|
|
|
|
)
|
|
|
|
|
ref = f"#/components/parameters/{key}"
|
|
|
|
|
if ref not in [x.ref for x in operation_spec.parameters]:
|
|
|
|
|
operation_spec.parameters.append(ParameterSchema(ref=ref))
|
|
|
|
|
elif operationId == "reverse/floatingips:get":
|
|
|
|
|
for key, val in PTR_RECORDS_LIST_PARAMETERS.items():
|
|
|
|
|
openapi_spec.components.parameters.setdefault(
|
|
|
|
|
key, ParameterSchema(**val)
|
|
|
|
|
)
|
|
|
|
|
ref = f"#/components/parameters/{key}"
|
|
|
|
|
if ref not in [x.ref for x in operation_spec.parameters]:
|
|
|
|
|
operation_spec.parameters.append(ParameterSchema(ref=ref))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _get_schema_ref(
|
|
|
|
|
@@ -532,6 +806,41 @@ def _get_schema_ref(
|
|
|
|
|
**NAMESERVERS_SCHEMA
|
|
|
|
|
)
|
|
|
|
|
ref = f"#/components/schemas/{name}"
|
|
|
|
|
if name in [
|
|
|
|
|
"ZonesShareShowResponse",
|
|
|
|
|
"ZonesSharesCreateRequest",
|
|
|
|
|
"ZonesSharesCreateResponse",
|
|
|
|
|
]:
|
|
|
|
|
openapi_spec.components.schemas[name] = TypeSchema(**ZONE_SHARE_SCHEMA)
|
|
|
|
|
ref = f"#/components/schemas/{name}"
|
|
|
|
|
elif name in ["ZonesSharesListResponse"]:
|
|
|
|
|
openapi_spec.components.schemas[name] = TypeSchema(
|
|
|
|
|
**ZONE_SHARES_SCHEMA
|
|
|
|
|
)
|
|
|
|
|
ref = f"#/components/schemas/{name}"
|
|
|
|
|
elif name in ["ReverseFloatingipsListResponse"]:
|
|
|
|
|
openapi_spec.components.schemas[name] = TypeSchema(
|
|
|
|
|
**PTR_RECORDS_SCHEMA
|
|
|
|
|
)
|
|
|
|
|
ref = f"#/components/schemas/{name}"
|
|
|
|
|
elif name in [
|
|
|
|
|
"ReverseFloatingipShowResponse",
|
|
|
|
|
"ReverseFloatingipUpdateRequest",
|
|
|
|
|
"ReverseFloatingipUpdateResponse",
|
|
|
|
|
]:
|
|
|
|
|
openapi_spec.components.schemas[name] = TypeSchema(**PTR_RECORD_SCHEMA)
|
|
|
|
|
ref = f"#/components/schemas/{name}"
|
|
|
|
|
elif name in ["LimitsListResponse"]:
|
|
|
|
|
openapi_spec.components.schemas[name] = TypeSchema(**LIMITS_SCHEMA)
|
|
|
|
|
ref = f"#/components/schemas/{name}"
|
|
|
|
|
elif name in [
|
|
|
|
|
"QuotasListResponse",
|
|
|
|
|
"QuotaShowResponse",
|
|
|
|
|
"QuotaUpdateRequest",
|
|
|
|
|
"QuotaUpdateResponse",
|
|
|
|
|
]:
|
|
|
|
|
openapi_spec.components.schemas[name] = TypeSchema(**QUOTAS_SCHEMA)
|
|
|
|
|
ref = f"#/components/schemas/{name}"
|
|
|
|
|
else:
|
|
|
|
|
return (None, None, False)
|
|
|
|
|
|
|
|
|
|
|