update_resolver_endpoint_details.go raw

   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  // DNS API
   6  //
   7  // API for the DNS service. Use this API to manage DNS zones, records, and other DNS resources.
   8  // For more information, see Overview of the DNS Service (https://docs.oracle.com/iaas/Content/DNS/Concepts/dnszonemanagement.htm).
   9  //
  10  
  11  package dns
  12  
  13  import (
  14  	"encoding/json"
  15  	"fmt"
  16  	"strings"
  17  
  18  	"github.com/nrdcg/oci-go-sdk/common/v1065"
  19  )
  20  
  21  // UpdateResolverEndpointDetails The body for updating an existing resolver endpoint.
  22  // **Warning:** Oracle recommends that you avoid using any confidential information when you supply string values using the API.
  23  type UpdateResolverEndpointDetails interface {
  24  }
  25  
  26  type updateresolverendpointdetails struct {
  27  	JsonData     []byte
  28  	EndpointType string `json:"endpointType"`
  29  }
  30  
  31  // UnmarshalJSON unmarshals json
  32  func (m *updateresolverendpointdetails) UnmarshalJSON(data []byte) error {
  33  	m.JsonData = data
  34  	type Unmarshalerupdateresolverendpointdetails updateresolverendpointdetails
  35  	s := struct {
  36  		Model Unmarshalerupdateresolverendpointdetails
  37  	}{}
  38  	err := json.Unmarshal(data, &s.Model)
  39  	if err != nil {
  40  		return err
  41  	}
  42  	m.EndpointType = s.Model.EndpointType
  43  
  44  	return err
  45  }
  46  
  47  // UnmarshalPolymorphicJSON unmarshals polymorphic json
  48  func (m *updateresolverendpointdetails) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) {
  49  
  50  	if data == nil || string(data) == "null" {
  51  		return nil, nil
  52  	}
  53  
  54  	var err error
  55  	switch m.EndpointType {
  56  	case "VNIC":
  57  		mm := UpdateResolverVnicEndpointDetails{}
  58  		err = json.Unmarshal(data, &mm)
  59  		return mm, err
  60  	default:
  61  		common.Logf("Received unsupported enum value for UpdateResolverEndpointDetails: %s.", m.EndpointType)
  62  		return *m, nil
  63  	}
  64  }
  65  
  66  func (m updateresolverendpointdetails) String() string {
  67  	return common.PointerString(m)
  68  }
  69  
  70  // ValidateEnumValue returns an error when providing an unsupported enum value
  71  // This function is being called during constructing API request process
  72  // Not recommended for calling this function directly
  73  func (m updateresolverendpointdetails) ValidateEnumValue() (bool, error) {
  74  	errMessage := []string{}
  75  
  76  	if len(errMessage) > 0 {
  77  		return true, fmt.Errorf("%s", strings.Join(errMessage, "\n"))
  78  	}
  79  	return false, nil
  80  }
  81  
  82  // UpdateResolverEndpointDetailsEndpointTypeEnum Enum with underlying type: string
  83  type UpdateResolverEndpointDetailsEndpointTypeEnum string
  84  
  85  // Set of constants representing the allowable values for UpdateResolverEndpointDetailsEndpointTypeEnum
  86  const (
  87  	UpdateResolverEndpointDetailsEndpointTypeVnic UpdateResolverEndpointDetailsEndpointTypeEnum = "VNIC"
  88  )
  89  
  90  var mappingUpdateResolverEndpointDetailsEndpointTypeEnum = map[string]UpdateResolverEndpointDetailsEndpointTypeEnum{
  91  	"VNIC": UpdateResolverEndpointDetailsEndpointTypeVnic,
  92  }
  93  
  94  var mappingUpdateResolverEndpointDetailsEndpointTypeEnumLowerCase = map[string]UpdateResolverEndpointDetailsEndpointTypeEnum{
  95  	"vnic": UpdateResolverEndpointDetailsEndpointTypeVnic,
  96  }
  97  
  98  // GetUpdateResolverEndpointDetailsEndpointTypeEnumValues Enumerates the set of values for UpdateResolverEndpointDetailsEndpointTypeEnum
  99  func GetUpdateResolverEndpointDetailsEndpointTypeEnumValues() []UpdateResolverEndpointDetailsEndpointTypeEnum {
 100  	values := make([]UpdateResolverEndpointDetailsEndpointTypeEnum, 0)
 101  	for _, v := range mappingUpdateResolverEndpointDetailsEndpointTypeEnum {
 102  		values = append(values, v)
 103  	}
 104  	return values
 105  }
 106  
 107  // GetUpdateResolverEndpointDetailsEndpointTypeEnumStringValues Enumerates the set of values in String for UpdateResolverEndpointDetailsEndpointTypeEnum
 108  func GetUpdateResolverEndpointDetailsEndpointTypeEnumStringValues() []string {
 109  	return []string{
 110  		"VNIC",
 111  	}
 112  }
 113  
 114  // GetMappingUpdateResolverEndpointDetailsEndpointTypeEnum performs case Insensitive comparison on enum value and return the desired enum
 115  func GetMappingUpdateResolverEndpointDetailsEndpointTypeEnum(val string) (UpdateResolverEndpointDetailsEndpointTypeEnum, bool) {
 116  	enum, ok := mappingUpdateResolverEndpointDetailsEndpointTypeEnumLowerCase[strings.ToLower(val)]
 117  	return enum, ok
 118  }
 119