steering_policy_health_rule.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  // SteeringPolicyHealthRule The representation of SteeringPolicyHealthRule
  22  type SteeringPolicyHealthRule struct {
  23  
  24  	// A user-defined description of the rule's purpose or behavior.
  25  	Description *string `mandatory:"false" json:"description"`
  26  
  27  	// An array of `caseConditions`. A rule may optionally include a sequence of cases defining alternate
  28  	// configurations for how it should behave during processing for any given DNS query. When a rule has
  29  	// no sequence of `cases`, it is always evaluated with the same configuration during processing. When
  30  	// a rule has an empty sequence of `cases`, it is always ignored during processing. When a rule has a
  31  	// non-empty sequence of `cases`, its behavior during processing is configured by the first matching
  32  	// `case` in the sequence. When a rule has no matching cases the rule is ignored. A rule case with no
  33  	// `caseCondition` always matches. A rule case with a `caseCondition` matches only when that expression
  34  	// evaluates to true for the given query.
  35  	Cases []SteeringPolicyHealthRuleCase `mandatory:"false" json:"cases"`
  36  }
  37  
  38  // GetDescription returns Description
  39  func (m SteeringPolicyHealthRule) GetDescription() *string {
  40  	return m.Description
  41  }
  42  
  43  func (m SteeringPolicyHealthRule) String() string {
  44  	return common.PointerString(m)
  45  }
  46  
  47  // ValidateEnumValue returns an error when providing an unsupported enum value
  48  // This function is being called during constructing API request process
  49  // Not recommended for calling this function directly
  50  func (m SteeringPolicyHealthRule) ValidateEnumValue() (bool, error) {
  51  	errMessage := []string{}
  52  
  53  	if len(errMessage) > 0 {
  54  		return true, fmt.Errorf("%s", strings.Join(errMessage, "\n"))
  55  	}
  56  	return false, nil
  57  }
  58  
  59  // MarshalJSON marshals to json representation
  60  func (m SteeringPolicyHealthRule) MarshalJSON() (buff []byte, e error) {
  61  	type MarshalTypeSteeringPolicyHealthRule SteeringPolicyHealthRule
  62  	s := struct {
  63  		DiscriminatorParam string `json:"ruleType"`
  64  		MarshalTypeSteeringPolicyHealthRule
  65  	}{
  66  		"HEALTH",
  67  		(MarshalTypeSteeringPolicyHealthRule)(m),
  68  	}
  69  
  70  	return json.Marshal(&s)
  71  }
  72