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 // GetViewRequest wrapper for the GetView operation
16 //
17 // # See also
18 //
19 // Click https://docs.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/dns/GetView.go.html to see an example of how to use GetViewRequest.
20 type GetViewRequest struct {
21 22 // The OCID of the target view.
23 ViewId *string `mandatory:"true" contributesTo:"path" name:"viewId"`
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 GetViewScopeEnum `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 GetViewRequest) String() string {
51 return common.PointerString(request)
52 }
53 54 // HTTPRequest implements the OCIRequest interface
55 func (request GetViewRequest) 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 GetViewRequest) 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 GetViewRequest) 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 GetViewRequest) ValidateEnumValue() (bool, error) {
80 errMessage := []string{}
81 if _, ok := GetMappingGetViewScopeEnum(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(GetGetViewScopeEnumStringValues(), ",")))
83 }
84 if len(errMessage) > 0 {
85 return true, fmt.Errorf("%s", strings.Join(errMessage, "\n"))
86 }
87 return false, nil
88 }
89 90 // GetViewResponse wrapper for the GetView operation
91 type GetViewResponse struct {
92 93 // The underlying http response
94 RawResponse *http.Response
95 96 // The View instance
97 View `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 GetViewResponse) String() string {
116 return common.PointerString(response)
117 }
118 119 // HTTPResponse implements the OCIResponse interface
120 func (response GetViewResponse) HTTPResponse() *http.Response {
121 return response.RawResponse
122 }
123 124 // GetViewScopeEnum Enum with underlying type: string
125 type GetViewScopeEnum string
126 127 // Set of constants representing the allowable values for GetViewScopeEnum
128 const (
129 GetViewScopeGlobal GetViewScopeEnum = "GLOBAL"
130 GetViewScopePrivate GetViewScopeEnum = "PRIVATE"
131 )
132 133 var mappingGetViewScopeEnum = map[string]GetViewScopeEnum{
134 "GLOBAL": GetViewScopeGlobal,
135 "PRIVATE": GetViewScopePrivate,
136 }
137 138 var mappingGetViewScopeEnumLowerCase = map[string]GetViewScopeEnum{
139 "global": GetViewScopeGlobal,
140 "private": GetViewScopePrivate,
141 }
142 143 // GetGetViewScopeEnumValues Enumerates the set of values for GetViewScopeEnum
144 func GetGetViewScopeEnumValues() []GetViewScopeEnum {
145 values := make([]GetViewScopeEnum, 0)
146 for _, v := range mappingGetViewScopeEnum {
147 values = append(values, v)
148 }
149 return values
150 }
151 152 // GetGetViewScopeEnumStringValues Enumerates the set of values in String for GetViewScopeEnum
153 func GetGetViewScopeEnumStringValues() []string {
154 return []string{
155 "GLOBAL",
156 "PRIVATE",
157 }
158 }
159 160 // GetMappingGetViewScopeEnum performs case Insensitive comparison on enum value and return the desired enum
161 func GetMappingGetViewScopeEnum(val string) (GetViewScopeEnum, bool) {
162 enum, ok := mappingGetViewScopeEnumLowerCase[strings.ToLower(val)]
163 return enum, ok
164 }
165