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