steering_policy_limit_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  // SteeringPolicyLimitRule The representation of SteeringPolicyLimitRule
  22  type SteeringPolicyLimitRule 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 []SteeringPolicyLimitRuleCase `mandatory:"false" json:"cases"`
  36  
  37  	// Defines a default count if `cases` is not defined for the rule or a matching case does
  38  	// not define `count`. `defaultCount` is **not** applied if `cases` is defined and there
  39  	// are no matching cases. In this scenario, the next rule will be processed. If no rules
  40  	// remain to be processed, the answer will be chosen from the remaining list of answers.
  41  	DefaultCount *int `mandatory:"false" json:"defaultCount"`
  42  }
  43  
  44  // GetDescription returns Description
  45  func (m SteeringPolicyLimitRule) GetDescription() *string {
  46  	return m.Description
  47  }
  48  
  49  func (m SteeringPolicyLimitRule) String() string {
  50  	return common.PointerString(m)
  51  }
  52  
  53  // ValidateEnumValue returns an error when providing an unsupported enum value
  54  // This function is being called during constructing API request process
  55  // Not recommended for calling this function directly
  56  func (m SteeringPolicyLimitRule) ValidateEnumValue() (bool, error) {
  57  	errMessage := []string{}
  58  
  59  	if len(errMessage) > 0 {
  60  		return true, fmt.Errorf("%s", strings.Join(errMessage, "\n"))
  61  	}
  62  	return false, nil
  63  }
  64  
  65  // MarshalJSON marshals to json representation
  66  func (m SteeringPolicyLimitRule) MarshalJSON() (buff []byte, e error) {
  67  	type MarshalTypeSteeringPolicyLimitRule SteeringPolicyLimitRule
  68  	s := struct {
  69  		DiscriminatorParam string `json:"ruleType"`
  70  		MarshalTypeSteeringPolicyLimitRule
  71  	}{
  72  		"LIMIT",
  73  		(MarshalTypeSteeringPolicyLimitRule)(m),
  74  	}
  75  
  76  	return json.Marshal(&s)
  77  }
  78