> For the complete documentation index, see [llms.txt](https://docs.ionos.com/cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ionos.com/cloud/go/ionos-cloud-object-storage/api/corsapi.md).

# CORSApi

All URIs are relative to *<https://s3.eu-central-3.ionoscloud.com>*

| Method                                    | HTTP request              | Description      |
| ----------------------------------------- | ------------------------- | ---------------- |
| [**DeleteBucketCors**](#DeleteBucketCors) | **Delete** /{Bucket}?cors | DeleteBucketCors |
| [**GetBucketCors**](#GetBucketCors)       | **Get** /{Bucket}?cors    | GetBucketCors    |
| [**PutBucketCors**](#PutBucketCors)       | **Put** /{Bucket}?cors    | PutBucketCors    |

## DeleteBucketCors

```go
var result  = DeleteBucketCors(ctx, bucket)
                      .Execute()
```

DeleteBucketCors

### Example

```go
package main

import (
    "context"
    "fmt"
    "os"

    ionoscloud "github.com/ionos-cloud/sdk-go-s3"
)

func main() {
    bucket := "bucket_example" // string | 

    configuration := ionoscloud.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
    apiClient := ionoscloud.NewAPIClient(configuration)
    resource, resp, err := apiClient.CORSApi.DeleteBucketCors(context.Background(), bucket).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `CORSApi.DeleteBucketCors``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp)
    }
}
```

### Path Parameters

| Name       | Type                | Description                                                                 | Notes |
| ---------- | ------------------- | --------------------------------------------------------------------------- | ----- |
| **ctx**    | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. |       |
| **bucket** | **string**          |                                                                             |       |

### Other Parameters

Other parameters are passed through a pointer to an apiDeleteBucketCorsRequest struct via the builder pattern

### Return type

(empty response body)

### HTTP request headers

* **Content-Type**: Not defined
* **Accept**: Not defined

### URLs Configuration per Operation

Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. An operation is uniquely identified by `"CORSApiService.DeleteBucketCors"` string. Similar rules for overriding default operation server index and variables apply by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps.

```golang
ctx := context.WithValue(context.Background(), {packageName}.ContextOperationServerIndices, map[string]int{
    "CORSApiService.DeleteBucketCors": 2,
})
ctx = context.WithValue(context.Background(), {packageName}.ContextOperationServerVariables, map[string]map[string]string{
    "CORSApiService.DeleteBucketCors": {
    "port": "8443",
},
})
```

## GetBucketCors

```go
var result GetBucketCorsOutput = GetBucketCors(ctx, bucket)
                      .Execute()
```

GetBucketCors

### Example

```go
package main

import (
    "context"
    "fmt"
    "os"

    ionoscloud "github.com/ionos-cloud/sdk-go-s3"
)

func main() {
    bucket := "bucket_example" // string | 

    configuration := ionoscloud.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
    apiClient := ionoscloud.NewAPIClient(configuration)
    resource, resp, err := apiClient.CORSApi.GetBucketCors(context.Background(), bucket).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `CORSApi.GetBucketCors``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp)
    }
    // response from `GetBucketCors`: GetBucketCorsOutput
    fmt.Fprintf(os.Stdout, "Response from `CORSApi.GetBucketCors`: %v\n", resource)
}
```

### Path Parameters

| Name       | Type                | Description                                                                 | Notes |
| ---------- | ------------------- | --------------------------------------------------------------------------- | ----- |
| **ctx**    | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. |       |
| **bucket** | **string**          |                                                                             |       |

### Other Parameters

Other parameters are passed through a pointer to an apiGetBucketCorsRequest struct via the builder pattern

### Return type

[**GetBucketCorsOutput**](/cloud/go/ionos-cloud-object-storage/models/getbucketcorsoutput.md)

### HTTP request headers

* **Content-Type**: Not defined
* **Accept**: application/xml

### URLs Configuration per Operation

Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. An operation is uniquely identified by `"CORSApiService.GetBucketCors"` string. Similar rules for overriding default operation server index and variables apply by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps.

```golang
ctx := context.WithValue(context.Background(), {packageName}.ContextOperationServerIndices, map[string]int{
    "CORSApiService.GetBucketCors": 2,
})
ctx = context.WithValue(context.Background(), {packageName}.ContextOperationServerVariables, map[string]map[string]string{
    "CORSApiService.GetBucketCors": {
    "port": "8443",
},
})
```

## PutBucketCors

```go
var result  = PutBucketCors(ctx, bucket)
                      .PutBucketCorsRequest(putBucketCorsRequest)
                      .ContentMD5(contentMD5)
                      .Execute()
```

PutBucketCors

### Example

```go
package main

import (
    "context"
    "fmt"
    "os"

    ionoscloud "github.com/ionos-cloud/sdk-go-s3"
)

func main() {
    bucket := "bucket_example" // string | 
    putBucketCorsRequest := *openapiclient.NewPutBucketCorsRequest() // PutBucketCorsRequest | 
    contentMD5 := "contentMD5_example" // string |  (optional)

    configuration := ionoscloud.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
    apiClient := ionoscloud.NewAPIClient(configuration)
    resource, resp, err := apiClient.CORSApi.PutBucketCors(context.Background(), bucket).PutBucketCorsRequest(putBucketCorsRequest).ContentMD5(contentMD5).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `CORSApi.PutBucketCors``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp)
    }
}
```

### Path Parameters

| Name       | Type                | Description                                                                 | Notes |
| ---------- | ------------------- | --------------------------------------------------------------------------- | ----- |
| **ctx**    | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. |       |
| **bucket** | **string**          |                                                                             |       |

### Other Parameters

Other parameters are passed through a pointer to an apiPutBucketCorsRequest struct via the builder pattern

| Name                     | Type                                                                                            | Description | Notes |
| ------------------------ | ----------------------------------------------------------------------------------------------- | ----------- | ----- |
| **putBucketCorsRequest** | [**PutBucketCorsRequest**](/cloud/go/ionos-cloud-object-storage/models/putbucketcorsrequest.md) |             |       |
| **contentMD5**           | **string**                                                                                      |             |       |

### Return type

(empty response body)

### HTTP request headers

* **Content-Type**: application/xml
* **Accept**: Not defined

### URLs Configuration per Operation

Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. An operation is uniquely identified by `"CORSApiService.PutBucketCors"` string. Similar rules for overriding default operation server index and variables apply by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps.

```golang
ctx := context.WithValue(context.Background(), {packageName}.ContextOperationServerIndices, map[string]int{
    "CORSApiService.PutBucketCors": 2,
})
ctx = context.WithValue(context.Background(), {packageName}.ContextOperationServerVariables, map[string]map[string]string{
    "CORSApiService.PutBucketCors": {
    "port": "8443",
},
})
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.ionos.com/cloud/go/ionos-cloud-object-storage/api/corsapi.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
