update_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  // UpdateZoneRequest wrapper for the UpdateZone operation
  16  //
  17  // # See also
  18  //
  19  // Click https://docs.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/dns/UpdateZone.go.html to see an example of how to use UpdateZoneRequest.
  20  type UpdateZoneRequest struct {
  21  
  22  	// The name or OCID of the target zone.
  23  	ZoneNameOrId *string `mandatory:"true" contributesTo:"path" name:"zoneNameOrId"`
  24  
  25  	// New data for the zone.
  26  	UpdateZoneDetails `contributesTo:"body"`
  27  
  28  	// The `If-Match` header field makes the request method conditional on the
  29  	// existence of at least one current representation of the target resource,
  30  	// when the field-value is `*`, or having a current representation of the
  31  	// target resource that has an entity-tag matching a member of the list of
  32  	// entity-tags provided in the field-value.
  33  	IfMatch *string `mandatory:"false" contributesTo:"header" name:"If-Match"`
  34  
  35  	// The `If-Unmodified-Since` header field makes the request method
  36  	// conditional on the selected representation's last modification date being
  37  	// earlier than or equal to the date provided in the field-value.  This
  38  	// field accomplishes the same purpose as If-Match for cases where the user
  39  	// agent does not have an entity-tag for the representation.
  40  	IfUnmodifiedSince *string `mandatory:"false" contributesTo:"header" name:"If-Unmodified-Since"`
  41  
  42  	// Unique Oracle-assigned identifier for the request. If you need
  43  	// to contact Oracle about a particular request, please provide
  44  	// the request ID.
  45  	OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"`
  46  
  47  	// Specifies to operate only on resources that have a matching DNS scope.
  48  	Scope UpdateZoneScopeEnum `mandatory:"false" contributesTo:"query" name:"scope" omitEmpty:"true"`
  49  
  50  	// The OCID of the view the zone is associated with. Required when accessing a private zone by name.
  51  	ViewId *string `mandatory:"false" contributesTo:"query" name:"viewId"`
  52  
  53  	// The OCID of the compartment the zone belongs to.
  54  	// This parameter is deprecated and should be omitted.
  55  	CompartmentId *string `mandatory:"false" contributesTo:"query" name:"compartmentId"`
  56  
  57  	// Metadata about the request. This information will not be transmitted to the service, but
  58  	// represents information that the SDK will consume to drive retry behavior.
  59  	RequestMetadata common.RequestMetadata
  60  }
  61  
  62  func (request UpdateZoneRequest) String() string {
  63  	return common.PointerString(request)
  64  }
  65  
  66  // HTTPRequest implements the OCIRequest interface
  67  func (request UpdateZoneRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) {
  68  
  69  	_, err := request.ValidateEnumValue()
  70  	if err != nil {
  71  		return http.Request{}, err
  72  	}
  73  	return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders)
  74  }
  75  
  76  // BinaryRequestBody implements the OCIRequest interface
  77  func (request UpdateZoneRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) {
  78  
  79  	return nil, false
  80  
  81  }
  82  
  83  // RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy.
  84  func (request UpdateZoneRequest) RetryPolicy() *common.RetryPolicy {
  85  	return request.RequestMetadata.RetryPolicy
  86  }
  87  
  88  // ValidateEnumValue returns an error when providing an unsupported enum value
  89  // This function is being called during constructing API request process
  90  // Not recommended for calling this function directly
  91  func (request UpdateZoneRequest) ValidateEnumValue() (bool, error) {
  92  	errMessage := []string{}
  93  	if _, ok := GetMappingUpdateZoneScopeEnum(string(request.Scope)); !ok && request.Scope != "" {
  94  		errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Scope: %s. Supported values are: %s.", request.Scope, strings.Join(GetUpdateZoneScopeEnumStringValues(), ",")))
  95  	}
  96  	if len(errMessage) > 0 {
  97  		return true, fmt.Errorf("%s", strings.Join(errMessage, "\n"))
  98  	}
  99  	return false, nil
 100  }
 101  
 102  // UpdateZoneResponse wrapper for the UpdateZone operation
 103  type UpdateZoneResponse struct {
 104  
 105  	// The underlying http response
 106  	RawResponse *http.Response
 107  
 108  	// The Zone instance
 109  	Zone `presentIn:"body"`
 110  
 111  	// The current version of the resource, ending with a
 112  	// representation-specific suffix. This value may be used in If-Match
 113  	// and If-None-Match headers for later requests of the same resource.
 114  	ETag *string `presentIn:"header" name:"etag"`
 115  
 116  	// Unique Oracle-assigned identifier for the request. If you need to
 117  	// contact Oracle about a particular request, please provide the request ID.
 118  	OpcRequestId *string `presentIn:"header" name:"opc-request-id"`
 119  
 120  	// Unique Oracle-assigned identifier for the asynchronous request.
 121  	// You can use this to query status of the asynchronous operation.
 122  	OpcWorkRequestId *string `presentIn:"header" name:"opc-work-request-id"`
 123  }
 124  
 125  func (response UpdateZoneResponse) String() string {
 126  	return common.PointerString(response)
 127  }
 128  
 129  // HTTPResponse implements the OCIResponse interface
 130  func (response UpdateZoneResponse) HTTPResponse() *http.Response {
 131  	return response.RawResponse
 132  }
 133  
 134  // UpdateZoneScopeEnum Enum with underlying type: string
 135  type UpdateZoneScopeEnum string
 136  
 137  // Set of constants representing the allowable values for UpdateZoneScopeEnum
 138  const (
 139  	UpdateZoneScopeGlobal  UpdateZoneScopeEnum = "GLOBAL"
 140  	UpdateZoneScopePrivate UpdateZoneScopeEnum = "PRIVATE"
 141  )
 142  
 143  var mappingUpdateZoneScopeEnum = map[string]UpdateZoneScopeEnum{
 144  	"GLOBAL":  UpdateZoneScopeGlobal,
 145  	"PRIVATE": UpdateZoneScopePrivate,
 146  }
 147  
 148  var mappingUpdateZoneScopeEnumLowerCase = map[string]UpdateZoneScopeEnum{
 149  	"global":  UpdateZoneScopeGlobal,
 150  	"private": UpdateZoneScopePrivate,
 151  }
 152  
 153  // GetUpdateZoneScopeEnumValues Enumerates the set of values for UpdateZoneScopeEnum
 154  func GetUpdateZoneScopeEnumValues() []UpdateZoneScopeEnum {
 155  	values := make([]UpdateZoneScopeEnum, 0)
 156  	for _, v := range mappingUpdateZoneScopeEnum {
 157  		values = append(values, v)
 158  	}
 159  	return values
 160  }
 161  
 162  // GetUpdateZoneScopeEnumStringValues Enumerates the set of values in String for UpdateZoneScopeEnum
 163  func GetUpdateZoneScopeEnumStringValues() []string {
 164  	return []string{
 165  		"GLOBAL",
 166  		"PRIVATE",
 167  	}
 168  }
 169  
 170  // GetMappingUpdateZoneScopeEnum performs case Insensitive comparison on enum value and return the desired enum
 171  func GetMappingUpdateZoneScopeEnum(val string) (UpdateZoneScopeEnum, bool) {
 172  	enum, ok := mappingUpdateZoneScopeEnumLowerCase[strings.ToLower(val)]
 173  	return enum, ok
 174  }
 175