update_resolver_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  // UpdateResolverRequest wrapper for the UpdateResolver operation
  16  //
  17  // # See also
  18  //
  19  // Click https://docs.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/dns/UpdateResolver.go.html to see an example of how to use UpdateResolverRequest.
  20  type UpdateResolverRequest struct {
  21  
  22  	// The OCID of the target resolver.
  23  	ResolverId *string `mandatory:"true" contributesTo:"path" name:"resolverId"`
  24  
  25  	// New data for the resolver.
  26  	UpdateResolverDetails `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 UpdateResolverScopeEnum `mandatory:"false" contributesTo:"query" name:"scope" omitEmpty:"true"`
  49  
  50  	// Metadata about the request. This information will not be transmitted to the service, but
  51  	// represents information that the SDK will consume to drive retry behavior.
  52  	RequestMetadata common.RequestMetadata
  53  }
  54  
  55  func (request UpdateResolverRequest) String() string {
  56  	return common.PointerString(request)
  57  }
  58  
  59  // HTTPRequest implements the OCIRequest interface
  60  func (request UpdateResolverRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) {
  61  
  62  	_, err := request.ValidateEnumValue()
  63  	if err != nil {
  64  		return http.Request{}, err
  65  	}
  66  	return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders)
  67  }
  68  
  69  // BinaryRequestBody implements the OCIRequest interface
  70  func (request UpdateResolverRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) {
  71  
  72  	return nil, false
  73  
  74  }
  75  
  76  // RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy.
  77  func (request UpdateResolverRequest) RetryPolicy() *common.RetryPolicy {
  78  	return request.RequestMetadata.RetryPolicy
  79  }
  80  
  81  // ValidateEnumValue returns an error when providing an unsupported enum value
  82  // This function is being called during constructing API request process
  83  // Not recommended for calling this function directly
  84  func (request UpdateResolverRequest) ValidateEnumValue() (bool, error) {
  85  	errMessage := []string{}
  86  	if _, ok := GetMappingUpdateResolverScopeEnum(string(request.Scope)); !ok && request.Scope != "" {
  87  		errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Scope: %s. Supported values are: %s.", request.Scope, strings.Join(GetUpdateResolverScopeEnumStringValues(), ",")))
  88  	}
  89  	if len(errMessage) > 0 {
  90  		return true, fmt.Errorf("%s", strings.Join(errMessage, "\n"))
  91  	}
  92  	return false, nil
  93  }
  94  
  95  // UpdateResolverResponse wrapper for the UpdateResolver operation
  96  type UpdateResolverResponse struct {
  97  
  98  	// The underlying http response
  99  	RawResponse *http.Response
 100  
 101  	// The Resolver instance
 102  	Resolver `presentIn:"body"`
 103  
 104  	// The current version of the resource, ending with a
 105  	// representation-specific suffix. This value may be used in If-Match
 106  	// and If-None-Match headers for later requests of the same resource.
 107  	Etag *string `presentIn:"header" name:"etag"`
 108  
 109  	// Unique Oracle-assigned identifier for the request. If you need to
 110  	// contact Oracle about a particular request, please provide the request ID.
 111  	OpcRequestId *string `presentIn:"header" name:"opc-request-id"`
 112  
 113  	// Unique Oracle-assigned identifier for the asynchronous request.
 114  	// You can use this to query status of the asynchronous operation.
 115  	OpcWorkRequestId *string `presentIn:"header" name:"opc-work-request-id"`
 116  }
 117  
 118  func (response UpdateResolverResponse) String() string {
 119  	return common.PointerString(response)
 120  }
 121  
 122  // HTTPResponse implements the OCIResponse interface
 123  func (response UpdateResolverResponse) HTTPResponse() *http.Response {
 124  	return response.RawResponse
 125  }
 126  
 127  // UpdateResolverScopeEnum Enum with underlying type: string
 128  type UpdateResolverScopeEnum string
 129  
 130  // Set of constants representing the allowable values for UpdateResolverScopeEnum
 131  const (
 132  	UpdateResolverScopeGlobal  UpdateResolverScopeEnum = "GLOBAL"
 133  	UpdateResolverScopePrivate UpdateResolverScopeEnum = "PRIVATE"
 134  )
 135  
 136  var mappingUpdateResolverScopeEnum = map[string]UpdateResolverScopeEnum{
 137  	"GLOBAL":  UpdateResolverScopeGlobal,
 138  	"PRIVATE": UpdateResolverScopePrivate,
 139  }
 140  
 141  var mappingUpdateResolverScopeEnumLowerCase = map[string]UpdateResolverScopeEnum{
 142  	"global":  UpdateResolverScopeGlobal,
 143  	"private": UpdateResolverScopePrivate,
 144  }
 145  
 146  // GetUpdateResolverScopeEnumValues Enumerates the set of values for UpdateResolverScopeEnum
 147  func GetUpdateResolverScopeEnumValues() []UpdateResolverScopeEnum {
 148  	values := make([]UpdateResolverScopeEnum, 0)
 149  	for _, v := range mappingUpdateResolverScopeEnum {
 150  		values = append(values, v)
 151  	}
 152  	return values
 153  }
 154  
 155  // GetUpdateResolverScopeEnumStringValues Enumerates the set of values in String for UpdateResolverScopeEnum
 156  func GetUpdateResolverScopeEnumStringValues() []string {
 157  	return []string{
 158  		"GLOBAL",
 159  		"PRIVATE",
 160  	}
 161  }
 162  
 163  // GetMappingUpdateResolverScopeEnum performs case Insensitive comparison on enum value and return the desired enum
 164  func GetMappingUpdateResolverScopeEnum(val string) (UpdateResolverScopeEnum, bool) {
 165  	enum, ok := mappingUpdateResolverScopeEnumLowerCase[strings.ToLower(val)]
 166  	return enum, ok
 167  }
 168