{
    "openapi": "3.0.1",
    "info": {
        "title": "Nami Cloud Storage API",
        "description": "S3 compatible storage service API documentation",
        "version": "1.0.0"
    },
    "servers": [
        {
            "url": "https://{bucketName}.storage.nami.cloud",
            "variables": {
                "bucketName": {
                    "default": "mybucket",
                    "description": "The name of the bucket"
                }
            }
        }
    ],
    "security": [
        {
            "awsV4": []
        }
    ],
    "paths": {
        "/": {
            "put": {
                "tags": [
                    "Bucket Operations"
                ],
                "summary": "Create Bucket",
                "description": "Creates a new bucket",
                "parameters": [
                    {
                        "name": "x-amz-acl",
                        "in": "header",
                        "description": "The canned ACL to apply to the bucket",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "private",
                                "public-read",
                                "public-read-write",
                                "authenticated-read"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Bucket created successfully"
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "application/xml": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "tags": [
                    "Bucket Operations"
                ],
                "summary": "Delete Bucket",
                "description": "Deletes an empty bucket",
                "responses": {
                    "204": {
                        "description": "Bucket deleted successfully"
                    },
                    "404": {
                        "description": "Bucket not found",
                        "content": {
                            "application/xml": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "get": {
                "tags": [
                    "Object Operations"
                ],
                "summary": "List Objects",
                "description": "Lists objects in a bucket",
                "parameters": [
                    {
                        "name": "prefix",
                        "in": "query",
                        "description": "Limits the response to keys that begin with the specified prefix",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "max-keys",
                        "in": "query",
                        "description": "Sets the maximum number of keys returned in the response",
                        "schema": {
                            "type": "integer",
                            "default": 1000
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/xml": {
                                "schema": {
                                    "$ref": "#/components/schemas/ListBucketResult"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/{objectKey}": {
            "put": {
                "tags": [
                    "Object Operations"
                ],
                "summary": "Put Object",
                "description": "Adds an object to a bucket",
                "parameters": [
                    {
                        "name": "objectKey",
                        "in": "path",
                        "required": true,
                        "description": "Key of the object",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/octet-stream": {
                            "schema": {
                                "type": "string",
                                "format": "binary"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Object uploaded successfully",
                        "headers": {
                            "ETag": {
                                "description": "Entity tag for the uploaded object",
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    }
                }
            },
            "get": {
                "tags": [
                    "Object Operations"
                ],
                "summary": "Get Object",
                "description": "Retrieves objects from a bucket",
                "parameters": [
                    {
                        "name": "objectKey",
                        "in": "path",
                        "required": true,
                        "description": "Key of the object",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Object retrieved successfully",
                        "content": {
                            "application/octet-stream": {
                                "schema": {
                                    "type": "string",
                                    "format": "binary"
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "tags": [
                    "Object Operations"
                ],
                "summary": "Delete Object",
                "description": "Removes an object from a bucket",
                "parameters": [
                    {
                        "name": "objectKey",
                        "in": "path",
                        "required": true,
                        "description": "Key of the object to delete",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "204": {
                        "description": "Object deleted successfully"
                    }
                }
            },
            "head": {
                "tags": [
                    "Object Operations"
                ],
                "summary": "Head Object",
                "description": "Retrieves metadata from an object without returning the object itself",
                "parameters": [
                    {
                        "name": "objectKey",
                        "in": "path",
                        "required": true,
                        "description": "Key of the object",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Object metadata retrieved successfully",
                        "headers": {
                            "Content-Length": {
                                "schema": {
                                    "type": "integer"
                                }
                            },
                            "ETag": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "Error": {
                "type": "object",
                "properties": {
                    "Code": {
                        "type": "string"
                    },
                    "Message": {
                        "type": "string"
                    },
                    "RequestId": {
                        "type": "string"
                    }
                }
            },
            "ListBucketResult": {
                "type": "object",
                "properties": {
                    "Name": {
                        "type": "string"
                    },
                    "Prefix": {
                        "type": "string"
                    },
                    "MaxKeys": {
                        "type": "integer"
                    },
                    "IsTruncated": {
                        "type": "boolean"
                    },
                    "Contents": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Object"
                        }
                    }
                }
            },
            "Object": {
                "type": "object",
                "properties": {
                    "Key": {
                        "type": "string"
                    },
                    "LastModified": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "ETag": {
                        "type": "string"
                    },
                    "Size": {
                        "type": "integer"
                    },
                    "StorageClass": {
                        "type": "string"
                    }
                }
            }
        },
        "securitySchemes": {
            "awsV4": {
                "type": "apiKey",
                "name": "Authorization",
                "in": "header",
                "description": "AWS Signature Version 4"
            }
        }
    }
}