Skip to content

Commit

Permalink
Regenerate client from commit ec3c91a9 of spec repo (#1801)
Browse files Browse the repository at this point in the history
Co-authored-by: ci.datadog-api-spec <[email protected]>
Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
  • Loading branch information
api-clients-generation-pipeline[bot] and ci.datadog-api-spec authored Dec 20, 2022
1 parent 285e2fd commit 676e0d3
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 54 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.4",
"regenerated": "2022-12-19 15:44:02.177148",
"spec_repo_commit": "37d94b14"
"regenerated": "2022-12-20 16:44:27.418644",
"spec_repo_commit": "ec3c91a9"
},
"v2": {
"apigentools_version": "1.6.4",
"regenerated": "2022-12-19 15:44:02.188913",
"spec_repo_commit": "37d94b14"
"regenerated": "2022-12-20 16:44:27.430114",
"spec_repo_commit": "ec3c91a9"
}
}
}
10 changes: 6 additions & 4 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1776,7 +1776,12 @@ components:
type: string
type: object
CloudConfigurationComplianceRuleOptions:
description: Options for cloud_configuration rules.
description: 'Options for cloud_configuration rules.

Fields `resourceType` and `regoRule` are mandatory when managing custom `cloud_configuration`
rules.

'
properties:
complexRule:
description: 'Whether the rule is a complex one.
Expand All @@ -1795,9 +1800,6 @@ components:
'
example: aws_acm
type: string
required:
- resourceType
- regoRule
type: object
CloudConfigurationRegoRule:
description: Rule details.
Expand Down
83 changes: 41 additions & 42 deletions api/datadogV2/model_cloud_configuration_compliance_rule_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,21 @@ package datadogV2

import (
"encoding/json"
"fmt"
)

// CloudConfigurationComplianceRuleOptions Options for cloud_configuration rules.
// Fields `resourceType` and `regoRule` are mandatory when managing custom `cloud_configuration` rules.
//
type CloudConfigurationComplianceRuleOptions struct {
// Whether the rule is a complex one.
// Must be set to true if `regoRule.resourceTypes` contains more than one item. Defaults to false.
//
ComplexRule *bool `json:"complexRule,omitempty"`
// Rule details.
RegoRule CloudConfigurationRegoRule `json:"regoRule"`
RegoRule *CloudConfigurationRegoRule `json:"regoRule,omitempty"`
// Main resource type to be checked by the rule. It should be specified again in `regoRule.resourceTypes`.
//
ResourceType string `json:"resourceType"`
ResourceType *string `json:"resourceType,omitempty"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject map[string]interface{} `json:"-"`
AdditionalProperties map[string]interface{}
Expand All @@ -29,10 +30,8 @@ type CloudConfigurationComplianceRuleOptions struct {
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed.
func NewCloudConfigurationComplianceRuleOptions(regoRule CloudConfigurationRegoRule, resourceType string) *CloudConfigurationComplianceRuleOptions {
func NewCloudConfigurationComplianceRuleOptions() *CloudConfigurationComplianceRuleOptions {
this := CloudConfigurationComplianceRuleOptions{}
this.RegoRule = regoRule
this.ResourceType = resourceType
return &this
}

Expand Down Expand Up @@ -72,50 +71,60 @@ func (o *CloudConfigurationComplianceRuleOptions) SetComplexRule(v bool) {
o.ComplexRule = &v
}

// GetRegoRule returns the RegoRule field value.
// GetRegoRule returns the RegoRule field value if set, zero value otherwise.
func (o *CloudConfigurationComplianceRuleOptions) GetRegoRule() CloudConfigurationRegoRule {
if o == nil {
if o == nil || o.RegoRule == nil {
var ret CloudConfigurationRegoRule
return ret
}
return o.RegoRule
return *o.RegoRule
}

// GetRegoRuleOk returns a tuple with the RegoRule field value
// GetRegoRuleOk returns a tuple with the RegoRule field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CloudConfigurationComplianceRuleOptions) GetRegoRuleOk() (*CloudConfigurationRegoRule, bool) {
if o == nil {
if o == nil || o.RegoRule == nil {
return nil, false
}
return &o.RegoRule, true
return o.RegoRule, true
}

// SetRegoRule sets field value.
// HasRegoRule returns a boolean if a field has been set.
func (o *CloudConfigurationComplianceRuleOptions) HasRegoRule() bool {
return o != nil && o.RegoRule != nil
}

// SetRegoRule gets a reference to the given CloudConfigurationRegoRule and assigns it to the RegoRule field.
func (o *CloudConfigurationComplianceRuleOptions) SetRegoRule(v CloudConfigurationRegoRule) {
o.RegoRule = v
o.RegoRule = &v
}

// GetResourceType returns the ResourceType field value.
// GetResourceType returns the ResourceType field value if set, zero value otherwise.
func (o *CloudConfigurationComplianceRuleOptions) GetResourceType() string {
if o == nil {
if o == nil || o.ResourceType == nil {
var ret string
return ret
}
return o.ResourceType
return *o.ResourceType
}

// GetResourceTypeOk returns a tuple with the ResourceType field value
// GetResourceTypeOk returns a tuple with the ResourceType field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CloudConfigurationComplianceRuleOptions) GetResourceTypeOk() (*string, bool) {
if o == nil {
if o == nil || o.ResourceType == nil {
return nil, false
}
return &o.ResourceType, true
return o.ResourceType, true
}

// HasResourceType returns a boolean if a field has been set.
func (o *CloudConfigurationComplianceRuleOptions) HasResourceType() bool {
return o != nil && o.ResourceType != nil
}

// SetResourceType sets field value.
// SetResourceType gets a reference to the given string and assigns it to the ResourceType field.
func (o *CloudConfigurationComplianceRuleOptions) SetResourceType(v string) {
o.ResourceType = v
o.ResourceType = &v
}

// MarshalJSON serializes the struct using spec logic.
Expand All @@ -127,8 +136,12 @@ func (o CloudConfigurationComplianceRuleOptions) MarshalJSON() ([]byte, error) {
if o.ComplexRule != nil {
toSerialize["complexRule"] = o.ComplexRule
}
toSerialize["regoRule"] = o.RegoRule
toSerialize["resourceType"] = o.ResourceType
if o.RegoRule != nil {
toSerialize["regoRule"] = o.RegoRule
}
if o.ResourceType != nil {
toSerialize["resourceType"] = o.ResourceType
}

for key, value := range o.AdditionalProperties {
toSerialize[key] = value
Expand All @@ -139,25 +152,11 @@ func (o CloudConfigurationComplianceRuleOptions) MarshalJSON() ([]byte, error) {
// UnmarshalJSON deserializes the given payload.
func (o *CloudConfigurationComplianceRuleOptions) UnmarshalJSON(bytes []byte) (err error) {
raw := map[string]interface{}{}
required := struct {
RegoRule *CloudConfigurationRegoRule `json:"regoRule"`
ResourceType *string `json:"resourceType"`
}{}
all := struct {
ComplexRule *bool `json:"complexRule,omitempty"`
RegoRule CloudConfigurationRegoRule `json:"regoRule"`
ResourceType string `json:"resourceType"`
ComplexRule *bool `json:"complexRule,omitempty"`
RegoRule *CloudConfigurationRegoRule `json:"regoRule,omitempty"`
ResourceType *string `json:"resourceType,omitempty"`
}{}
err = json.Unmarshal(bytes, &required)
if err != nil {
return err
}
if required.RegoRule == nil {
return fmt.Errorf("required field regoRule missing")
}
if required.ResourceType == nil {
return fmt.Errorf("required field resourceType missing")
}
err = json.Unmarshal(bytes, &all)
if err != nil {
err = json.Unmarshal(bytes, &raw)
Expand All @@ -168,7 +167,7 @@ func (o *CloudConfigurationComplianceRuleOptions) UnmarshalJSON(bytes []byte) (e
return nil
}
o.ComplexRule = all.ComplexRule
if all.RegoRule.UnparsedObject != nil && o.UnparsedObject == nil {
if all.RegoRule != nil && all.RegoRule.UnparsedObject != nil && o.UnparsedObject == nil {
err = json.Unmarshal(bytes, &raw)
if err != nil {
return err
Expand Down
2 changes: 2 additions & 0 deletions api/datadogV2/model_cloud_configuration_rule_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (
// CloudConfigurationRuleOptions Options on cloud configuration rules.
type CloudConfigurationRuleOptions struct {
// Options for cloud_configuration rules.
// Fields `resourceType` and `regoRule` are mandatory when managing custom `cloud_configuration` rules.
//
ComplianceRuleOptions CloudConfigurationComplianceRuleOptions `json:"complianceRuleOptions"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject map[string]interface{} `json:"-"`
Expand Down
2 changes: 2 additions & 0 deletions api/datadogV2/model_security_monitoring_rule_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (
// SecurityMonitoringRuleOptions Options on rules.
type SecurityMonitoringRuleOptions struct {
// Options for cloud_configuration rules.
// Fields `resourceType` and `regoRule` are mandatory when managing custom `cloud_configuration` rules.
//
ComplianceRuleOptions *CloudConfigurationComplianceRuleOptions `json:"complianceRuleOptions,omitempty"`
// If true, signals in non-production environments have a lower severity than what is defined by the rule case, which can reduce signal noise.
// The severity is decreased by one level: `CRITICAL` in production becomes `HIGH` in non-production, `HIGH` becomes `MEDIUM` and so on. `INFO` remains `INFO`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ func main() {
},
Options: datadogV2.CloudConfigurationRuleOptions{
ComplianceRuleOptions: datadogV2.CloudConfigurationComplianceRuleOptions{
ResourceType: "gcp_compute_disk",
ResourceType: datadog.PtrString("gcp_compute_disk"),
ComplexRule: datadog.PtrBool(false),
RegoRule: datadogV2.CloudConfigurationRegoRule{
RegoRule: &datadogV2.CloudConfigurationRegoRule{
Policy: `package datadog
`,
ResourceTypes: []string{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ func main() {
},
Options: &datadogV2.SecurityMonitoringRuleOptions{
ComplianceRuleOptions: &datadogV2.CloudConfigurationComplianceRuleOptions{
ResourceType: "gcp_compute_disk",
RegoRule: datadogV2.CloudConfigurationRegoRule{
ResourceType: datadog.PtrString("gcp_compute_disk"),
RegoRule: &datadogV2.CloudConfigurationRegoRule{
Policy: `package datadog
`,
ResourceTypes: []string{
Expand Down

0 comments on commit 676e0d3

Please sign in to comment.