Skip to content

Commit

Permalink
[pfs] Hide x-remote-user in promptflow service (microsoft#1191)
Browse files Browse the repository at this point in the history
# Description

Please add an informative description that covers that changes made by
the pull request and link all relevant issues.

# All Promptflow Contribution checklist:
- [ ] **The pull request does not introduce [breaking changes].**
- [ ] **CHANGELOG is updated for new features, bug fixes or other
significant changes.**
- [ ] **I have read the [contribution guidelines](../CONTRIBUTING.md).**
- [ ] **Create an issue and link to the pull request to get dedicated
review from promptflow team. Learn more: [suggested
workflow](../CONTRIBUTING.md#suggested-workflow).**

## General Guidelines and Best Practices
- [ ] Title of the pull request is clear and informative.
- [ ] There are a small number of commits, each of which have an
informative message. This means that previously merged commits do not
appear in the history of the PR. For more information on cleaning up the
commits in your PR, [see this
page](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md).

### Testing Guidelines
- [ ] Pull request includes test coverage for the included changes.
  • Loading branch information
lalala123123 authored Nov 20, 2023
1 parent eef6c1d commit e033e82
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 64 deletions.
12 changes: 4 additions & 8 deletions src/promptflow/promptflow/_sdk/_service/apis/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,8 @@

api = Namespace("Connections", description="Connections Management")

# Define base connection request parsing
remote_parser = api.parser()
remote_parser.add_argument("X-Remote-User", location="headers", required=True)

# Define create or update connection request parsing
create_or_update_parser = remote_parser.copy()
create_or_update_parser = api.parser()
create_or_update_parser.add_argument("connection_dict", type=str, location="args", required=True)

# Response model of list connections
Expand All @@ -46,7 +42,7 @@ def handle_connection_not_found_exception(error):

@api.route("/")
class ConnectionList(Resource):
@api.doc(parser=remote_parser, description="List all connection")
@api.doc(description="List all connection")
@api.marshal_with(list_connection_field, skip_none=True, as_list=True)
@local_user_only
def get(self):
Expand All @@ -63,7 +59,7 @@ def get(self):
@api.route("/<string:name>")
@api.param("name", "The connection name.")
class Connection(Resource):
@api.doc(parser=remote_parser, description="Get connection")
@api.doc(description="Get connection")
@api.response(code=200, description="Connection details", model=dict_field)
@local_user_only
def get(self, name: str):
Expand Down Expand Up @@ -101,7 +97,7 @@ def put(self, name: str):
connection = connection_op.create_or_update(connection)
return jsonify(connection._to_dict())

@api.doc(parser=remote_parser, description="Delete connection")
@api.doc(description="Delete connection")
@local_user_only
def delete(self, name: str):
connection_op = ConnectionOperations()
Expand Down
76 changes: 20 additions & 56 deletions src/promptflow/promptflow/_sdk/_service/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@
},
"description": "List all connection",
"operationId": "get_connection_list",
"parameters": [
{
"name": "X-Remote-User",
"in": "header",
"type": "string",
"required": true
}
],
"tags": [
"Connections"
]
Expand All @@ -40,7 +32,7 @@
"type": "string"
}
],
"post": {
"get": {
"responses": {
"200": {
"description": "Connection details",
Expand All @@ -49,47 +41,13 @@
}
}
},
"description": "Create connection",
"operationId": "post_connection",
"parameters": [
{
"name": "X-Remote-User",
"in": "header",
"type": "string",
"required": true
},
{
"name": "connection_dict",
"in": "query",
"type": "string",
"required": true
}
],
"tags": [
"Connections"
]
},
"delete": {
"responses": {
"200": {
"description": "Success"
}
},
"description": "Delete connection",
"operationId": "delete_connection",
"parameters": [
{
"name": "X-Remote-User",
"in": "header",
"type": "string",
"required": true
}
],
"description": "Get connection",
"operationId": "get_connection",
"tags": [
"Connections"
]
},
"get": {
"post": {
"responses": {
"200": {
"description": "Connection details",
Expand All @@ -98,12 +56,12 @@
}
}
},
"description": "Get connection",
"operationId": "get_connection",
"description": "Create connection",
"operationId": "post_connection",
"parameters": [
{
"name": "X-Remote-User",
"in": "header",
"name": "connection_dict",
"in": "query",
"type": "string",
"required": true
}
Expand All @@ -124,12 +82,6 @@
"description": "Update connection",
"operationId": "put_connection",
"parameters": [
{
"name": "X-Remote-User",
"in": "header",
"type": "string",
"required": true
},
{
"name": "connection_dict",
"in": "query",
Expand All @@ -140,6 +92,18 @@
"tags": [
"Connections"
]
},
"delete": {
"responses": {
"200": {
"description": "Success"
}
},
"description": "Delete connection",
"operationId": "delete_connection",
"tags": [
"Connections"
]
}
},
"/Runs/": {
Expand Down

0 comments on commit e033e82

Please sign in to comment.