Deleting a DIS Notification Policy
Function
You can call this API to clear the DIS notification policy configured for an OBS bucket. This operation will remove all DIS notification rules configured for the bucket. This API is idempotent. If no DIS notification policy is configured for the bucket, the API call will still succeed and status code 204 will be returned.
DIS notification policies are not available for fusion buckets.
Authorization Information
To call this API, you must be the bucket owner or have the Tenant Administrator permission. To configure the Tenant Administrator permission, you need to use role/policy-based authorization (IAM v3 APIs in the old IAM version). For details, see Using IAM for Authorization.
Restrictions
- The mapping between OBS regions and endpoints must comply with what is listed in Regions and Endpoints.
- Before calling APIs related to DIS policies, you need to call obs.WithSignature(obs.SignatureObs) to specify the protocol type when initializing the obsClient.
Method
func (obsClient ObsClient) DeleteDisPolicy(bucketName string, extensions ...extensionOptions) (output *BaseModel, err error)
Request Parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| bucketName | string | Yes | Explanation: Bucket name. |
Response Parameter Description
| Parameter | Type | Description |
|---|---|---|
| StatusCode | int | Explanation: HTTP status code Restrictions: None Value range: A status code is a group of digits that can be 2xx (indicating successes) or 4xx or 5xx (indicating errors). It indicates the status of a response. For more information, see Status Code. Default value: None |
| RequestId | string | Explanation: Request ID returned by the OBS server Restrictions: None Value range: None Default value: None |
| ResponseHeaders | map[string][]string | Explanation: HTTP response headers Restrictions: None Value range: None Default value: None |
Sample Code
This example deletes the DIS notification policy configured for bucket examplebucket.
package main
import (
"fmt"
"log"
obs "github.com/huaweicloud/huaweicloud-sdk-go-obs/obs"
)
func main() {
// Obtain an AK/SK pair using environment variables or import an AK/SK pair in other ways. Using hard coding may result in leakage.
// Obtain an AK/SK pair on the management console. For details, see https://support.huaweicloud.com/intl/en-us/usermanual-ca/ca_01_0003.html.
ak := os.Getenv("AccessKeyID")
sk := os.Getenv("SecretAccessKey")
// (Optional) If you use a temporary AK/SK pair and a security token to access OBS, you are not advised to use hard coding, which may result in information leakage. You can obtain an AK/SK pair using environment variables or import an AK/SK pair in other ways.
securityToken := os.Getenv("SecurityToken")
// Enter the endpoint corresponding to the bucket. CN-Hong Kong is used here as an example. Replace it with the one currently in use.
endPoint := "https://obs.ap-southeast-1.myhuaweicloud.com"
// Create a client.
obsClient, err := obs.New(ak, sk, endPoint, obs.WithSecurityToken(securityToken))
if err != nil {
fmt.Printf("Create obsClient error, errMsg: %s", err.Error())
}
// Delete the DIS policy.
output, err := client.DeleteDisPolicy("my-bucket")
if err != nil {
log.Fatalf("Failed to delete DIS policy: %v", err)
}
fmt.Printf("Request ID: %s\n", output.RequestId)
fmt.Println("DIS policy deleted successfully")
} Helpful Links
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot