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