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 // CreateZoneRequest wrapper for the CreateZone operation
16 //
17 // # See also
18 //
19 // Click https://docs.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/dns/CreateZone.go.html to see an example of how to use CreateZoneRequest.
20 type CreateZoneRequest struct {
21 22 // Details for creating a new zone.
23 CreateZoneDetails CreateZoneBaseDetails `contributesTo:"body"`
24 25 // Unique Oracle-assigned identifier for the request. If you need
26 // to contact Oracle about a particular request, please provide
27 // the request ID.
28 OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"`
29 30 // The OCID of the compartment the zone belongs to.
31 // This parameter is deprecated and should be omitted.
32 CompartmentId *string `mandatory:"false" contributesTo:"query" name:"compartmentId"`
33 34 // Specifies to operate only on resources that have a matching DNS scope.
35 Scope CreateZoneScopeEnum `mandatory:"false" contributesTo:"query" name:"scope" omitEmpty:"true"`
36 37 // The OCID of the view the resource is associated with.
38 ViewId *string `mandatory:"false" contributesTo:"query" name:"viewId"`
39 40 // Metadata about the request. This information will not be transmitted to the service, but
41 // represents information that the SDK will consume to drive retry behavior.
42 RequestMetadata common.RequestMetadata
43 }
44 45 func (request CreateZoneRequest) String() string {
46 return common.PointerString(request)
47 }
48 49 // HTTPRequest implements the OCIRequest interface
50 func (request CreateZoneRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) {
51 52 _, err := request.ValidateEnumValue()
53 if err != nil {
54 return http.Request{}, err
55 }
56 return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders)
57 }
58 59 // BinaryRequestBody implements the OCIRequest interface
60 func (request CreateZoneRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) {
61 62 return nil, false
63 64 }
65 66 // RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy.
67 func (request CreateZoneRequest) RetryPolicy() *common.RetryPolicy {
68 return request.RequestMetadata.RetryPolicy
69 }
70 71 // ValidateEnumValue returns an error when providing an unsupported enum value
72 // This function is being called during constructing API request process
73 // Not recommended for calling this function directly
74 func (request CreateZoneRequest) ValidateEnumValue() (bool, error) {
75 errMessage := []string{}
76 if _, ok := GetMappingCreateZoneScopeEnum(string(request.Scope)); !ok && request.Scope != "" {
77 errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Scope: %s. Supported values are: %s.", request.Scope, strings.Join(GetCreateZoneScopeEnumStringValues(), ",")))
78 }
79 if len(errMessage) > 0 {
80 return true, fmt.Errorf("%s", strings.Join(errMessage, "\n"))
81 }
82 return false, nil
83 }
84 85 // CreateZoneResponse wrapper for the CreateZone operation
86 type CreateZoneResponse struct {
87 88 // The underlying http response
89 RawResponse *http.Response
90 91 // The Zone instance
92 Zone `presentIn:"body"`
93 94 // The current version of the resource, ending with a
95 // representation-specific suffix. This value may be used in If-Match
96 // and If-None-Match headers for later requests of the same resource.
97 ETag *string `presentIn:"header" name:"etag"`
98 99 // The full URI of the resource related to the request.
100 Location *string `presentIn:"header" name:"location"`
101 102 // Unique Oracle-assigned identifier for the request. If you need to
103 // contact Oracle about a particular request, please provide the request ID.
104 OpcRequestId *string `presentIn:"header" name:"opc-request-id"`
105 106 // Unique Oracle-assigned identifier for the asynchronous request.
107 // You can use this to query status of the asynchronous operation.
108 OpcWorkRequestId *string `presentIn:"header" name:"opc-work-request-id"`
109 }
110 111 func (response CreateZoneResponse) String() string {
112 return common.PointerString(response)
113 }
114 115 // HTTPResponse implements the OCIResponse interface
116 func (response CreateZoneResponse) HTTPResponse() *http.Response {
117 return response.RawResponse
118 }
119 120 // CreateZoneScopeEnum Enum with underlying type: string
121 type CreateZoneScopeEnum string
122 123 // Set of constants representing the allowable values for CreateZoneScopeEnum
124 const (
125 CreateZoneScopeGlobal CreateZoneScopeEnum = "GLOBAL"
126 CreateZoneScopePrivate CreateZoneScopeEnum = "PRIVATE"
127 )
128 129 var mappingCreateZoneScopeEnum = map[string]CreateZoneScopeEnum{
130 "GLOBAL": CreateZoneScopeGlobal,
131 "PRIVATE": CreateZoneScopePrivate,
132 }
133 134 var mappingCreateZoneScopeEnumLowerCase = map[string]CreateZoneScopeEnum{
135 "global": CreateZoneScopeGlobal,
136 "private": CreateZoneScopePrivate,
137 }
138 139 // GetCreateZoneScopeEnumValues Enumerates the set of values for CreateZoneScopeEnum
140 func GetCreateZoneScopeEnumValues() []CreateZoneScopeEnum {
141 values := make([]CreateZoneScopeEnum, 0)
142 for _, v := range mappingCreateZoneScopeEnum {
143 values = append(values, v)
144 }
145 return values
146 }
147 148 // GetCreateZoneScopeEnumStringValues Enumerates the set of values in String for CreateZoneScopeEnum
149 func GetCreateZoneScopeEnumStringValues() []string {
150 return []string{
151 "GLOBAL",
152 "PRIVATE",
153 }
154 }
155 156 // GetMappingCreateZoneScopeEnum performs case Insensitive comparison on enum value and return the desired enum
157 func GetMappingCreateZoneScopeEnum(val string) (CreateZoneScopeEnum, bool) {
158 enum, ok := mappingCreateZoneScopeEnumLowerCase[strings.ToLower(val)]
159 return enum, ok
160 }
161