tsig_key.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  	"fmt"
  15  	"strings"
  16  
  17  	"github.com/nrdcg/oci-go-sdk/common/v1065"
  18  )
  19  
  20  // TsigKey A TSIG key.
  21  // **Warning:** Oracle recommends that you avoid using any confidential information when you supply string values using the API.
  22  type TsigKey struct {
  23  
  24  	// TSIG key algorithms are encoded as domain names, but most consist of only one
  25  	// non-empty label, which is not required to be explicitly absolute.
  26  	// Applicable algorithms include: hmac-sha1, hmac-sha224, hmac-sha256,
  27  	// hmac-sha512. For more information on these algorithms, see RFC 4635 (https://tools.ietf.org/html/rfc4635#section-2).
  28  	Algorithm *string `mandatory:"true" json:"algorithm"`
  29  
  30  	// A globally unique domain name identifying the key for a given pair of hosts.
  31  	Name *string `mandatory:"true" json:"name"`
  32  
  33  	// The OCID of the compartment containing the TSIG key.
  34  	CompartmentId *string `mandatory:"true" json:"compartmentId"`
  35  
  36  	// A base64 string encoding the binary shared secret.
  37  	Secret *string `mandatory:"true" json:"secret"`
  38  
  39  	// Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace.
  40  	// For more information, see Resource Tags (https://docs.oracle.com/iaas/Content/General/Concepts/resourcetags.htm).
  41  	//
  42  	// **Example:** `{"Department": "Finance"}`
  43  	FreeformTags map[string]string `mandatory:"true" json:"freeformTags"`
  44  
  45  	// Defined tags for this resource. Each key is predefined and scoped to a namespace.
  46  	// For more information, see Resource Tags (https://docs.oracle.com/iaas/Content/General/Concepts/resourcetags.htm).
  47  	//
  48  	// **Example:** `{"Operations": {"CostCenter": "42"}}`
  49  	DefinedTags map[string]map[string]interface{} `mandatory:"true" json:"definedTags"`
  50  
  51  	// The OCID of the resource.
  52  	Id *string `mandatory:"true" json:"id"`
  53  
  54  	// The canonical absolute URL of the resource.
  55  	Self *string `mandatory:"true" json:"self"`
  56  
  57  	// The date and time the resource was created, expressed in RFC 3339 timestamp format.
  58  	// **Example:** `2016-07-22T17:23:59:60Z`
  59  	TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"`
  60  
  61  	// The current state of the resource.
  62  	LifecycleState TsigKeyLifecycleStateEnum `mandatory:"true" json:"lifecycleState"`
  63  
  64  	// The date and time the resource was last updated, expressed in RFC 3339 timestamp format.
  65  	// **Example:** `2016-07-22T17:23:59:60Z`
  66  	TimeUpdated *common.SDKTime `mandatory:"false" json:"timeUpdated"`
  67  }
  68  
  69  func (m TsigKey) String() string {
  70  	return common.PointerString(m)
  71  }
  72  
  73  // ValidateEnumValue returns an error when providing an unsupported enum value
  74  // This function is being called during constructing API request process
  75  // Not recommended for calling this function directly
  76  func (m TsigKey) ValidateEnumValue() (bool, error) {
  77  	errMessage := []string{}
  78  	if _, ok := GetMappingTsigKeyLifecycleStateEnum(string(m.LifecycleState)); !ok && m.LifecycleState != "" {
  79  		errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for LifecycleState: %s. Supported values are: %s.", m.LifecycleState, strings.Join(GetTsigKeyLifecycleStateEnumStringValues(), ",")))
  80  	}
  81  
  82  	if len(errMessage) > 0 {
  83  		return true, fmt.Errorf("%s", strings.Join(errMessage, "\n"))
  84  	}
  85  	return false, nil
  86  }
  87  
  88  // TsigKeyLifecycleStateEnum Enum with underlying type: string
  89  type TsigKeyLifecycleStateEnum string
  90  
  91  // Set of constants representing the allowable values for TsigKeyLifecycleStateEnum
  92  const (
  93  	TsigKeyLifecycleStateActive   TsigKeyLifecycleStateEnum = "ACTIVE"
  94  	TsigKeyLifecycleStateCreating TsigKeyLifecycleStateEnum = "CREATING"
  95  	TsigKeyLifecycleStateDeleted  TsigKeyLifecycleStateEnum = "DELETED"
  96  	TsigKeyLifecycleStateDeleting TsigKeyLifecycleStateEnum = "DELETING"
  97  	TsigKeyLifecycleStateFailed   TsigKeyLifecycleStateEnum = "FAILED"
  98  	TsigKeyLifecycleStateUpdating TsigKeyLifecycleStateEnum = "UPDATING"
  99  )
 100  
 101  var mappingTsigKeyLifecycleStateEnum = map[string]TsigKeyLifecycleStateEnum{
 102  	"ACTIVE":   TsigKeyLifecycleStateActive,
 103  	"CREATING": TsigKeyLifecycleStateCreating,
 104  	"DELETED":  TsigKeyLifecycleStateDeleted,
 105  	"DELETING": TsigKeyLifecycleStateDeleting,
 106  	"FAILED":   TsigKeyLifecycleStateFailed,
 107  	"UPDATING": TsigKeyLifecycleStateUpdating,
 108  }
 109  
 110  var mappingTsigKeyLifecycleStateEnumLowerCase = map[string]TsigKeyLifecycleStateEnum{
 111  	"active":   TsigKeyLifecycleStateActive,
 112  	"creating": TsigKeyLifecycleStateCreating,
 113  	"deleted":  TsigKeyLifecycleStateDeleted,
 114  	"deleting": TsigKeyLifecycleStateDeleting,
 115  	"failed":   TsigKeyLifecycleStateFailed,
 116  	"updating": TsigKeyLifecycleStateUpdating,
 117  }
 118  
 119  // GetTsigKeyLifecycleStateEnumValues Enumerates the set of values for TsigKeyLifecycleStateEnum
 120  func GetTsigKeyLifecycleStateEnumValues() []TsigKeyLifecycleStateEnum {
 121  	values := make([]TsigKeyLifecycleStateEnum, 0)
 122  	for _, v := range mappingTsigKeyLifecycleStateEnum {
 123  		values = append(values, v)
 124  	}
 125  	return values
 126  }
 127  
 128  // GetTsigKeyLifecycleStateEnumStringValues Enumerates the set of values in String for TsigKeyLifecycleStateEnum
 129  func GetTsigKeyLifecycleStateEnumStringValues() []string {
 130  	return []string{
 131  		"ACTIVE",
 132  		"CREATING",
 133  		"DELETED",
 134  		"DELETING",
 135  		"FAILED",
 136  		"UPDATING",
 137  	}
 138  }
 139  
 140  // GetMappingTsigKeyLifecycleStateEnum performs case Insensitive comparison on enum value and return the desired enum
 141  func GetMappingTsigKeyLifecycleStateEnum(val string) (TsigKeyLifecycleStateEnum, bool) {
 142  	enum, ok := mappingTsigKeyLifecycleStateEnumLowerCase[strings.ToLower(val)]
 143  	return enum, ok
 144  }
 145