delete_zone_request_response.go raw

   1  // Copyright (c) 2016, 2018, 2025, Oracle and/or its affiliates.  All rights reserved.
   2  // This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
   3  // Code generated. DO NOT EDIT.
   4  
   5  package dns
   6  
   7  import (
   8  	"fmt"
   9  	"net/http"
  10  	"strings"
  11  
  12  	"github.com/nrdcg/oci-go-sdk/common/v1065"
  13  )
  14  
  15  // DeleteZoneRequest wrapper for the DeleteZone operation
  16  //
  17  // # See also
  18  //
  19  // Click https://docs.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/dns/DeleteZone.go.html to see an example of how to use DeleteZoneRequest.
  20  type DeleteZoneRequest struct {
  21  
  22  	// The name or OCID of the target zone.
  23  	ZoneNameOrId *string `mandatory:"true" contributesTo:"path" name:"zoneNameOrId"`
  24  
  25  	// The `If-Match` header field makes the request method conditional on the
  26  	// existence of at least one current representation of the target resource,
  27  	// when the field-value is `*`, or having a current representation of the
  28  	// target resource that has an entity-tag matching a member of the list of
  29  	// entity-tags provided in the field-value.
  30  	IfMatch *string `mandatory:"false" contributesTo:"header" name:"If-Match"`
  31  
  32  	// The `If-Unmodified-Since` header field makes the request method
  33  	// conditional on the selected representation's last modification date being
  34  	// earlier than or equal to the date provided in the field-value.  This
  35  	// field accomplishes the same purpose as If-Match for cases where the user
  36  	// agent does not have an entity-tag for the representation.
  37  	IfUnmodifiedSince *string `mandatory:"false" contributesTo:"header" name:"If-Unmodified-Since"`
  38  
  39  	// Unique Oracle-assigned identifier for the request. If you need
  40  	// to contact Oracle about a particular request, please provide
  41  	// the request ID.
  42  	OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"`
  43  
  44  	// Specifies to operate only on resources that have a matching DNS scope.
  45  	Scope DeleteZoneScopeEnum `mandatory:"false" contributesTo:"query" name:"scope" omitEmpty:"true"`
  46  
  47  	// The OCID of the view the zone is associated with. Required when accessing a private zone by name.
  48  	ViewId *string `mandatory:"false" contributesTo:"query" name:"viewId"`
  49  
  50  	// The OCID of the compartment the zone belongs to.
  51  	// This parameter is deprecated and should be omitted.
  52  	CompartmentId *string `mandatory:"false" contributesTo:"query" name:"compartmentId"`
  53  
  54  	// Metadata about the request. This information will not be transmitted to the service, but
  55  	// represents information that the SDK will consume to drive retry behavior.
  56  	RequestMetadata common.RequestMetadata
  57  }
  58  
  59  func (request DeleteZoneRequest) String() string {
  60  	return common.PointerString(request)
  61  }
  62  
  63  // HTTPRequest implements the OCIRequest interface
  64  func (request DeleteZoneRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) {
  65  
  66  	_, err := request.ValidateEnumValue()
  67  	if err != nil {
  68  		return http.Request{}, err
  69  	}
  70  	return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders)
  71  }
  72  
  73  // BinaryRequestBody implements the OCIRequest interface
  74  func (request DeleteZoneRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) {
  75  
  76  	return nil, false
  77  
  78  }
  79  
  80  // RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy.
  81  func (request DeleteZoneRequest) RetryPolicy() *common.RetryPolicy {
  82  	return request.RequestMetadata.RetryPolicy
  83  }
  84  
  85  // ValidateEnumValue returns an error when providing an unsupported enum value
  86  // This function is being called during constructing API request process
  87  // Not recommended for calling this function directly
  88  func (request DeleteZoneRequest) ValidateEnumValue() (bool, error) {
  89  	errMessage := []string{}
  90  	if _, ok := GetMappingDeleteZoneScopeEnum(string(request.Scope)); !ok && request.Scope != "" {
  91  		errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Scope: %s. Supported values are: %s.", request.Scope, strings.Join(GetDeleteZoneScopeEnumStringValues(), ",")))
  92  	}
  93  	if len(errMessage) > 0 {
  94  		return true, fmt.Errorf("%s", strings.Join(errMessage, "\n"))
  95  	}
  96  	return false, nil
  97  }
  98  
  99  // DeleteZoneResponse wrapper for the DeleteZone operation
 100  type DeleteZoneResponse struct {
 101  
 102  	// The underlying http response
 103  	RawResponse *http.Response
 104  
 105  	// Unique Oracle-assigned identifier for the request. If you need to
 106  	// contact Oracle about a particular request, please provide the request ID.
 107  	OpcRequestId *string `presentIn:"header" name:"opc-request-id"`
 108  
 109  	// Unique Oracle-assigned identifier for the asynchronous request.
 110  	// You can use this to query status of the asynchronous operation.
 111  	OpcWorkRequestId *string `presentIn:"header" name:"opc-work-request-id"`
 112  }
 113  
 114  func (response DeleteZoneResponse) String() string {
 115  	return common.PointerString(response)
 116  }
 117  
 118  // HTTPResponse implements the OCIResponse interface
 119  func (response DeleteZoneResponse) HTTPResponse() *http.Response {
 120  	return response.RawResponse
 121  }
 122  
 123  // DeleteZoneScopeEnum Enum with underlying type: string
 124  type DeleteZoneScopeEnum string
 125  
 126  // Set of constants representing the allowable values for DeleteZoneScopeEnum
 127  const (
 128  	DeleteZoneScopeGlobal  DeleteZoneScopeEnum = "GLOBAL"
 129  	DeleteZoneScopePrivate DeleteZoneScopeEnum = "PRIVATE"
 130  )
 131  
 132  var mappingDeleteZoneScopeEnum = map[string]DeleteZoneScopeEnum{
 133  	"GLOBAL":  DeleteZoneScopeGlobal,
 134  	"PRIVATE": DeleteZoneScopePrivate,
 135  }
 136  
 137  var mappingDeleteZoneScopeEnumLowerCase = map[string]DeleteZoneScopeEnum{
 138  	"global":  DeleteZoneScopeGlobal,
 139  	"private": DeleteZoneScopePrivate,
 140  }
 141  
 142  // GetDeleteZoneScopeEnumValues Enumerates the set of values for DeleteZoneScopeEnum
 143  func GetDeleteZoneScopeEnumValues() []DeleteZoneScopeEnum {
 144  	values := make([]DeleteZoneScopeEnum, 0)
 145  	for _, v := range mappingDeleteZoneScopeEnum {
 146  		values = append(values, v)
 147  	}
 148  	return values
 149  }
 150  
 151  // GetDeleteZoneScopeEnumStringValues Enumerates the set of values in String for DeleteZoneScopeEnum
 152  func GetDeleteZoneScopeEnumStringValues() []string {
 153  	return []string{
 154  		"GLOBAL",
 155  		"PRIVATE",
 156  	}
 157  }
 158  
 159  // GetMappingDeleteZoneScopeEnum performs case Insensitive comparison on enum value and return the desired enum
 160  func GetMappingDeleteZoneScopeEnum(val string) (DeleteZoneScopeEnum, bool) {
 161  	enum, ok := mappingDeleteZoneScopeEnumLowerCase[strings.ToLower(val)]
 162  	return enum, ok
 163  }
 164