blob: ea10c61cbb654f9009f93e3c52184c6289074037 [file]
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
get:
summary: List All Protos
description: Retrieve all stored protobuf definitions.
tags:
- Protos
parameters:
- $ref: ../components/parameters/NameFilter.yaml
- $ref: ../components/parameters/LabelFilter.yaml
- $ref: ../components/parameters/Page.yaml
- $ref: ../components/parameters/PageSize.yaml
responses:
"200":
description: Successful response.
content:
application/json:
schema:
$ref: ../components/schemas/ProtoListEnvelope.yaml
examples:
"1":
summary: Successful Example
value:
list:
- value:
id: "1"
content: |-
syntax = "proto3";
package helloworld;
service Greeter {
rpc GetErrResp (HelloRequest) returns (HelloReply) {}
}
message HelloRequest {
string name = 1;
repeated string items = 2;
}
message HelloReply {
string message = 1;
repeated string items = 2;
}
message ErrorDetail {
int64 code = 1;
string message = 2;
string type = 3;
}
update_time: 1684752213
create_time: 1684752213
key: /apisix/protos/1
modifiedIndex: 292
createdIndex: 292
total: 1
"401":
$ref: ../components/responses/Unauthorized.yaml
"503":
$ref: ../components/responses/BadRequest.yaml
description: Storage access or write failed.
operationId: listProtos
post:
summary: Create a Proto
description: Upload a new protobuf definition with an auto-generated ID.
tags:
- Protos
parameters:
- $ref: ../components/parameters/Ttl.yaml
requestBody:
$ref: ../components/requestBodies/ProtoUpsertPostCollection.yaml
responses:
"201":
description: Created
content:
application/json:
schema:
$ref: ../components/schemas/ProtoEnvelope.yaml
examples:
"1":
summary: Successful Example
value:
key: /apisix/protos/00000000000000000293
value:
create_time: 1684752743
update_time: 1684752743
content: |-
syntax = "proto3";
package helloworld;
service Greeter {
rpc GetErrResp (HelloRequest) returns (HelloReply) {}
}
message HelloRequest {
string name = 1;
repeated string items = 2;
}
message HelloReply {
string message = 1;
repeated string items = 2;
}
message ErrorDetail {
int64 code = 1;
string message = 2;
string type = 3;
}
id: "00000000000000000293"
"400":
$ref: ../components/responses/BadRequest.yaml
description: Invalid configuration
"401":
$ref: ../components/responses/Unauthorized.yaml
"503":
$ref: ../components/responses/BadRequest.yaml
description: Storage access or write failed.
operationId: createProto
put:
summary: Create or replace protos using a body ID
description: Equivalent to PUT on the item URL, with id required in the request body. The resource handler injects and validates this ID before persistence.
tags:
- Protos
parameters:
- $ref: ../components/parameters/Ttl.yaml
requestBody:
description: "`Proto` configuration body for create / replace / patch."
required: true
content:
application/json:
schema:
allOf:
- allOf:
- $ref: ../components/schemas/Proto.yaml
- not:
anyOf:
- required:
- create_time
- required:
- update_time
description: Wire request body. APISIX injects timestamps and, where appropriate, the path or generated resource ID. A supplied ID must agree with the path.
- required:
- id
example:
content: |-
syntax = "proto3";
package helloworld;
service Greeter {
rpc SayHello (HelloRequest) returns (HelloReply) {}
}
message HelloRequest {
string name = 1;
}
message HelloReply {
string message = 1;
}
id: "1"
responses:
"201":
description: Created
content:
application/json:
schema:
$ref: ../components/schemas/ProtoEnvelope.yaml
examples:
"1":
summary: Successful Example
value:
key: /apisix/protos/1
value:
id: "1"
create_time: 1684752213
update_time: 1684752213
content: |-
syntax = "proto3";
package helloworld;
service Greeter {
rpc GetErrResp (HelloRequest) returns (HelloReply) {}
}
message HelloRequest {
string name = 1;
repeated string items = 2;
}
message HelloReply {
string message = 1;
repeated string items = 2;
}
message ErrorDetail {
int64 code = 1;
string message = 2;
string type = 3;
}
"400":
$ref: ../components/responses/BadRequest.yaml
description: Invalid configuration
"401":
$ref: ../components/responses/Unauthorized.yaml
"503":
$ref: ../components/responses/BadRequest.yaml
description: Storage access or write failed.
operationId: putProtoWithBodyId