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 // SteeringPolicyWeightedRule The representation of SteeringPolicyWeightedRule
22 type SteeringPolicyWeightedRule 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 []SteeringPolicyWeightedRuleCase `mandatory:"false" json:"cases"`
36 37 // Defines a default set of answer conditions and values that are applied to an answer when
38 // `cases` is not defined for the rule or a matching case does not have any matching
39 // `answerCondition`s in its `answerData`. `defaultAnswerData` is not applied if `cases` is
40 // defined and there are no matching cases. In this scenario, the next rule will be processed.
41 DefaultAnswerData []SteeringPolicyWeightedAnswerData `mandatory:"false" json:"defaultAnswerData"`
42 }
43 44 // GetDescription returns Description
45 func (m SteeringPolicyWeightedRule) GetDescription() *string {
46 return m.Description
47 }
48 49 func (m SteeringPolicyWeightedRule) 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 SteeringPolicyWeightedRule) 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 SteeringPolicyWeightedRule) MarshalJSON() (buff []byte, e error) {
67 type MarshalTypeSteeringPolicyWeightedRule SteeringPolicyWeightedRule
68 s := struct {
69 DiscriminatorParam string `json:"ruleType"`
70 MarshalTypeSteeringPolicyWeightedRule
71 }{
72 "WEIGHTED",
73 (MarshalTypeSteeringPolicyWeightedRule)(m),
74 }
75 76 return json.Marshal(&s)
77 }
78