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 // UpdateViewRequest wrapper for the UpdateView operation
16 //
17 // # See also
18 //
19 // Click https://docs.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/dns/UpdateView.go.html to see an example of how to use UpdateViewRequest.
20 type UpdateViewRequest struct {
21 22 // The OCID of the target view.
23 ViewId *string `mandatory:"true" contributesTo:"path" name:"viewId"`
24 25 // New data for the view.
26 UpdateViewDetails `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 UpdateViewScopeEnum `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 UpdateViewRequest) String() string {
56 return common.PointerString(request)
57 }
58 59 // HTTPRequest implements the OCIRequest interface
60 func (request UpdateViewRequest) 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 UpdateViewRequest) 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 UpdateViewRequest) 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 UpdateViewRequest) ValidateEnumValue() (bool, error) {
85 errMessage := []string{}
86 if _, ok := GetMappingUpdateViewScopeEnum(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(GetUpdateViewScopeEnumStringValues(), ",")))
88 }
89 if len(errMessage) > 0 {
90 return true, fmt.Errorf("%s", strings.Join(errMessage, "\n"))
91 }
92 return false, nil
93 }
94 95 // UpdateViewResponse wrapper for the UpdateView operation
96 type UpdateViewResponse struct {
97 98 // The underlying http response
99 RawResponse *http.Response
100 101 // The View instance
102 View `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 UpdateViewResponse) String() string {
119 return common.PointerString(response)
120 }
121 122 // HTTPResponse implements the OCIResponse interface
123 func (response UpdateViewResponse) HTTPResponse() *http.Response {
124 return response.RawResponse
125 }
126 127 // UpdateViewScopeEnum Enum with underlying type: string
128 type UpdateViewScopeEnum string
129 130 // Set of constants representing the allowable values for UpdateViewScopeEnum
131 const (
132 UpdateViewScopeGlobal UpdateViewScopeEnum = "GLOBAL"
133 UpdateViewScopePrivate UpdateViewScopeEnum = "PRIVATE"
134 )
135 136 var mappingUpdateViewScopeEnum = map[string]UpdateViewScopeEnum{
137 "GLOBAL": UpdateViewScopeGlobal,
138 "PRIVATE": UpdateViewScopePrivate,
139 }
140 141 var mappingUpdateViewScopeEnumLowerCase = map[string]UpdateViewScopeEnum{
142 "global": UpdateViewScopeGlobal,
143 "private": UpdateViewScopePrivate,
144 }
145 146 // GetUpdateViewScopeEnumValues Enumerates the set of values for UpdateViewScopeEnum
147 func GetUpdateViewScopeEnumValues() []UpdateViewScopeEnum {
148 values := make([]UpdateViewScopeEnum, 0)
149 for _, v := range mappingUpdateViewScopeEnum {
150 values = append(values, v)
151 }
152 return values
153 }
154 155 // GetUpdateViewScopeEnumStringValues Enumerates the set of values in String for UpdateViewScopeEnum
156 func GetUpdateViewScopeEnumStringValues() []string {
157 return []string{
158 "GLOBAL",
159 "PRIVATE",
160 }
161 }
162 163 // GetMappingUpdateViewScopeEnum performs case Insensitive comparison on enum value and return the desired enum
164 func GetMappingUpdateViewScopeEnum(val string) (UpdateViewScopeEnum, bool) {
165 enum, ok := mappingUpdateViewScopeEnumLowerCase[strings.ToLower(val)]
166 return enum, ok
167 }
168