# PolicyApi

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

| Method                                              | HTTP request                   | Description           |
| --------------------------------------------------- | ------------------------------ | --------------------- |
| [**DeleteBucketPolicy**](#DeleteBucketPolicy)       | **Delete** /{Bucket}?policy    | DeleteBucketPolicy    |
| [**GetBucketPolicy**](#GetBucketPolicy)             | **Get** /{Bucket}?policy       | GetBucketPolicy       |
| [**GetBucketPolicyStatus**](#GetBucketPolicyStatus) | **Get** /{Bucket}?policyStatus | GetBucketPolicyStatus |
| [**PutBucketPolicy**](#PutBucketPolicy)             | **Put** /{Bucket}?policy       | PutBucketPolicy       |

## DeleteBucketPolicy

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

DeleteBucketPolicy

### Example

```go
package main

import (
    "context"
    "fmt"
    "os"

    objectstorage "github.com/ionos-cloud/sdk-go-bundle/objectstorage"
    "github.com/ionos-cloud/sdk-go-bundle/shared"
)

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

    configuration := shared.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
    apiClient := objectstorage.NewAPIClient(configuration)
    resource, resp, err := apiClient.PolicyApi.DeleteBucketPolicy(context.Background(), bucket).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `PolicyApi.DeleteBucketPolicy``: %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 apiDeleteBucketPolicyRequest struct via the builder pattern

| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |

### Return type

(empty response body)

### 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 `"PolicyApiService.DeleteBucketPolicy"` 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(), shared.ContextOperationServerIndices, map[string]int{
    "PolicyApiService.DeleteBucketPolicy": 2,
})
ctx = context.WithValue(context.Background(), shared.ContextOperationServerVariables, map[string]map[string]string{
    "PolicyApiService.DeleteBucketPolicy": {
    "port": "8443",
},
})
```

## GetBucketPolicy

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

GetBucketPolicy

### Example

```go
package main

import (
    "context"
    "fmt"
    "os"

    objectstorage "github.com/ionos-cloud/sdk-go-bundle/objectstorage"
    "github.com/ionos-cloud/sdk-go-bundle/shared"
)

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

    configuration := shared.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
    apiClient := objectstorage.NewAPIClient(configuration)
    resource, resp, err := apiClient.PolicyApi.GetBucketPolicy(context.Background(), bucket).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `PolicyApi.GetBucketPolicy``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp)
    }
    // response from `GetBucketPolicy`: BucketPolicy
    fmt.Fprintf(os.Stdout, "Response from `PolicyApi.GetBucketPolicy`: %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 apiGetBucketPolicyRequest struct via the builder pattern

| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |

### Return type

[**BucketPolicy**](https://docs.ionos.com/sections-test/go-sdk/sdk-go-bundle/sdks/objectstorage/models/bucketpolicy)

### HTTP request headers

* **Content-Type**: Not defined
* **Accept**: application/jsonapplication/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 `"PolicyApiService.GetBucketPolicy"` 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(), shared.ContextOperationServerIndices, map[string]int{
    "PolicyApiService.GetBucketPolicy": 2,
})
ctx = context.WithValue(context.Background(), shared.ContextOperationServerVariables, map[string]map[string]string{
    "PolicyApiService.GetBucketPolicy": {
    "port": "8443",
},
})
```

## GetBucketPolicyStatus

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

GetBucketPolicyStatus

### Example

```go
package main

import (
    "context"
    "fmt"
    "os"

    objectstorage "github.com/ionos-cloud/sdk-go-bundle/objectstorage"
    "github.com/ionos-cloud/sdk-go-bundle/shared"
)

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

    configuration := shared.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
    apiClient := objectstorage.NewAPIClient(configuration)
    resource, resp, err := apiClient.PolicyApi.GetBucketPolicyStatus(context.Background(), bucket).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `PolicyApi.GetBucketPolicyStatus``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp)
    }
    // response from `GetBucketPolicyStatus`: PolicyStatus
    fmt.Fprintf(os.Stdout, "Response from `PolicyApi.GetBucketPolicyStatus`: %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 apiGetBucketPolicyStatusRequest struct via the builder pattern

| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |

### Return type

[**PolicyStatus**](https://docs.ionos.com/sections-test/go-sdk/sdk-go-bundle/sdks/objectstorage/models/policystatus)

### 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 `"PolicyApiService.GetBucketPolicyStatus"` 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(), shared.ContextOperationServerIndices, map[string]int{
    "PolicyApiService.GetBucketPolicyStatus": 2,
})
ctx = context.WithValue(context.Background(), shared.ContextOperationServerVariables, map[string]map[string]string{
    "PolicyApiService.GetBucketPolicyStatus": {
    "port": "8443",
},
})
```

## PutBucketPolicy

```go
var result  = PutBucketPolicy(ctx, bucket)
                      .BucketPolicy(bucketPolicy)
                      .ContentMD5(contentMD5)
                      .Execute()
```

PutBucketPolicy

### Example

```go
package main

import (
    "context"
    "fmt"
    "os"

    objectstorage "github.com/ionos-cloud/sdk-go-bundle/objectstorage"
    "github.com/ionos-cloud/sdk-go-bundle/shared"
)

func main() {
    bucket := "bucket_example" // string | 
    bucketPolicy := *openapiclient.NewBucketPolicy([]openapiclient.BucketPolicyStatement{*openapiclient.NewBucketPolicyStatement([]string{"Action_example"}, "Effect_example", []string{"Resource_example"})}) // BucketPolicy | 
    contentMD5 := "contentMD5_example" // string |  (optional)

    configuration := shared.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
    apiClient := objectstorage.NewAPIClient(configuration)
    resource, resp, err := apiClient.PolicyApi.PutBucketPolicy(context.Background(), bucket).BucketPolicy(bucketPolicy).ContentMD5(contentMD5).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `PolicyApi.PutBucketPolicy``: %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 apiPutBucketPolicyRequest struct via the builder pattern

| Name             | Type                                                                                                                 | Description | Notes |
| ---------------- | -------------------------------------------------------------------------------------------------------------------- | ----------- | ----- |
| **bucketPolicy** | [**BucketPolicy**](https://docs.ionos.com/sections-test/go-sdk/sdk-go-bundle/sdks/objectstorage/models/bucketpolicy) |             |       |
| **contentMD5**   | **string**                                                                                                           |             |       |

### Return type

(empty response body)

### HTTP request headers

* **Content-Type**: application/json
* **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 `"PolicyApiService.PutBucketPolicy"` 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(), shared.ContextOperationServerIndices, map[string]int{
    "PolicyApiService.PutBucketPolicy": 2,
})
ctx = context.WithValue(context.Background(), shared.ContextOperationServerVariables, map[string]map[string]string{
    "PolicyApiService.PutBucketPolicy": {
    "port": "8443",
},
})
```
