get_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  // GetResolverRequest wrapper for the GetResolver operation
  16  //
  17  // # See also
  18  //
  19  // Click https://docs.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/dns/GetResolver.go.html to see an example of how to use GetResolverRequest.
  20  type GetResolverRequest struct {
  21  
  22  	// The OCID of the target resolver.
  23  	ResolverId *string `mandatory:"true" contributesTo:"path" name:"resolverId"`
  24  
  25  	// The `If-Modified-Since` header field makes a GET or HEAD request method
  26  	// conditional on the selected representation's modification date being more
  27  	// recent than the date provided in the field-value.  Transfer of the
  28  	// selected representation's data is avoided if that data has not changed.
  29  	IfModifiedSince *string `mandatory:"false" contributesTo:"header" name:"If-Modified-Since"`
  30  
  31  	// The `If-None-Match` header field makes the request method conditional on
  32  	// the absence of any current representation of the target resource, when
  33  	// the field-value is `*`, or having a selected representation with an
  34  	// entity-tag that does not match any of those listed in the field-value.
  35  	IfNoneMatch *string `mandatory:"false" contributesTo:"header" name:"If-None-Match"`
  36  
  37  	// Unique Oracle-assigned identifier for the request. If you need
  38  	// to contact Oracle about a particular request, please provide
  39  	// the request ID.
  40  	OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"`
  41  
  42  	// Specifies to operate only on resources that have a matching DNS scope.
  43  	Scope GetResolverScopeEnum `mandatory:"false" contributesTo:"query" name:"scope" omitEmpty:"true"`
  44  
  45  	// Metadata about the request. This information will not be transmitted to the service, but
  46  	// represents information that the SDK will consume to drive retry behavior.
  47  	RequestMetadata common.RequestMetadata
  48  }
  49  
  50  func (request GetResolverRequest) String() string {
  51  	return common.PointerString(request)
  52  }
  53  
  54  // HTTPRequest implements the OCIRequest interface
  55  func (request GetResolverRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) {
  56  
  57  	_, err := request.ValidateEnumValue()
  58  	if err != nil {
  59  		return http.Request{}, err
  60  	}
  61  	return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders)
  62  }
  63  
  64  // BinaryRequestBody implements the OCIRequest interface
  65  func (request GetResolverRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) {
  66  
  67  	return nil, false
  68  
  69  }
  70  
  71  // RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy.
  72  func (request GetResolverRequest) RetryPolicy() *common.RetryPolicy {
  73  	return request.RequestMetadata.RetryPolicy
  74  }
  75  
  76  // ValidateEnumValue returns an error when providing an unsupported enum value
  77  // This function is being called during constructing API request process
  78  // Not recommended for calling this function directly
  79  func (request GetResolverRequest) ValidateEnumValue() (bool, error) {
  80  	errMessage := []string{}
  81  	if _, ok := GetMappingGetResolverScopeEnum(string(request.Scope)); !ok && request.Scope != "" {
  82  		errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Scope: %s. Supported values are: %s.", request.Scope, strings.Join(GetGetResolverScopeEnumStringValues(), ",")))
  83  	}
  84  	if len(errMessage) > 0 {
  85  		return true, fmt.Errorf("%s", strings.Join(errMessage, "\n"))
  86  	}
  87  	return false, nil
  88  }
  89  
  90  // GetResolverResponse wrapper for the GetResolver operation
  91  type GetResolverResponse struct {
  92  
  93  	// The underlying http response
  94  	RawResponse *http.Response
  95  
  96  	// The Resolver instance
  97  	Resolver `presentIn:"body"`
  98  
  99  	// The current version of the resource, ending with a
 100  	// representation-specific suffix. This value may be used in If-Match
 101  	// and If-None-Match headers for later requests of the same resource.
 102  	Etag *string `presentIn:"header" name:"etag"`
 103  
 104  	// Unique Oracle-assigned identifier for the request. If you need to
 105  	// contact Oracle about a particular request, please provide the request ID.
 106  	OpcRequestId *string `presentIn:"header" name:"opc-request-id"`
 107  
 108  	// Flag to indicate whether or not the object was modified.  If this is true,
 109  	// the getter for the object itself will return null.  Callers should check this
 110  	// if they specified one of the request params that might result in a conditional
 111  	// response (like 'if-match'/'if-none-match').
 112  	IsNotModified bool
 113  }
 114  
 115  func (response GetResolverResponse) String() string {
 116  	return common.PointerString(response)
 117  }
 118  
 119  // HTTPResponse implements the OCIResponse interface
 120  func (response GetResolverResponse) HTTPResponse() *http.Response {
 121  	return response.RawResponse
 122  }
 123  
 124  // GetResolverScopeEnum Enum with underlying type: string
 125  type GetResolverScopeEnum string
 126  
 127  // Set of constants representing the allowable values for GetResolverScopeEnum
 128  const (
 129  	GetResolverScopeGlobal  GetResolverScopeEnum = "GLOBAL"
 130  	GetResolverScopePrivate GetResolverScopeEnum = "PRIVATE"
 131  )
 132  
 133  var mappingGetResolverScopeEnum = map[string]GetResolverScopeEnum{
 134  	"GLOBAL":  GetResolverScopeGlobal,
 135  	"PRIVATE": GetResolverScopePrivate,
 136  }
 137  
 138  var mappingGetResolverScopeEnumLowerCase = map[string]GetResolverScopeEnum{
 139  	"global":  GetResolverScopeGlobal,
 140  	"private": GetResolverScopePrivate,
 141  }
 142  
 143  // GetGetResolverScopeEnumValues Enumerates the set of values for GetResolverScopeEnum
 144  func GetGetResolverScopeEnumValues() []GetResolverScopeEnum {
 145  	values := make([]GetResolverScopeEnum, 0)
 146  	for _, v := range mappingGetResolverScopeEnum {
 147  		values = append(values, v)
 148  	}
 149  	return values
 150  }
 151  
 152  // GetGetResolverScopeEnumStringValues Enumerates the set of values in String for GetResolverScopeEnum
 153  func GetGetResolverScopeEnumStringValues() []string {
 154  	return []string{
 155  		"GLOBAL",
 156  		"PRIVATE",
 157  	}
 158  }
 159  
 160  // GetMappingGetResolverScopeEnum performs case Insensitive comparison on enum value and return the desired enum
 161  func GetMappingGetResolverScopeEnum(val string) (GetResolverScopeEnum, bool) {
 162  	enum, ok := mappingGetResolverScopeEnumLowerCase[strings.ToLower(val)]
 163  	return enum, ok
 164  }
 165