github.com/akamai/AkamaiOPEN-edgegrid-golang/v2@v2.17.0/pkg/appsec/export_configuration.go (about)

     1  package appsec
     2  
     3  import (
     4  	"context"
     5  	"encoding/json"
     6  	"fmt"
     7  	"net/http"
     8  	"reflect"
     9  
    10  	"time"
    11  )
    12  
    13  type (
    14  	// The ExportConfiguration interface supports exporting comprehensive details about a security
    15  	// configuration version. This operation returns more data than Get configuration version details,
    16  	// including rate and security policies, rules, hostnames, and numerous additional settings.
    17  	//
    18  	// https://developer.akamai.com/api/cloud_security/application_security/v1.html#export
    19  	ExportConfiguration interface {
    20  		// https://developer.akamai.com/api/cloud_security/application_security/v1.html#getconfigurationversionexport
    21  		// Deprecated: this method will be removed in a future release. Use GetExportConfiguration instead.
    22  		GetExportConfigurations(ctx context.Context, params GetExportConfigurationsRequest) (*GetExportConfigurationsResponse, error)
    23  
    24  		GetExportConfiguration(ctx context.Context, params GetExportConfigurationRequest) (*GetExportConfigurationResponse, error)
    25  	}
    26  
    27  	// ConditionsValue is a slice of strings that describe conditions.
    28  	ConditionsValue []string
    29  
    30  	// GetExportConfigurationRequest is used to call GetExportConfiguration.
    31  	GetExportConfigurationRequest struct {
    32  		ConfigID int `json:"configId"`
    33  		Version  int `json:"version"`
    34  	}
    35  
    36  	// EvaluatingSecurityPolicy is returned from a call to GetExportConfiguration.
    37  	EvaluatingSecurityPolicy struct {
    38  		EffectiveSecurityControls struct {
    39  			ApplyApplicationLayerControls bool `json:"applyApplicationLayerControls,omitempty"`
    40  			ApplyRateControls             bool `json:"applyRateControls,omitempty"`
    41  			ApplySlowPostControls         bool `json:"applySlowPostControls,omitempty"`
    42  		}
    43  		Hostnames        []string `json:"hostnames,omitempty"`
    44  		SecurityPolicyID string   `json:"id"`
    45  	}
    46  
    47  	// GetExportConfigurationResponse is returned from a call to GetExportConfiguration.
    48  	GetExportConfigurationResponse struct {
    49  		ConfigID   int    `json:"configId"`
    50  		ConfigName string `json:"configName"`
    51  		Version    int    `json:"version"`
    52  		BasedOn    int    `json:"basedOn"`
    53  		Staging    struct {
    54  			Status string `json:"status"`
    55  		} `json:"staging"`
    56  		Production struct {
    57  			Status string `json:"status"`
    58  		} `json:"production"`
    59  		CreateDate      time.Time `json:"-"`
    60  		CreatedBy       string    `json:"createdBy"`
    61  		SelectedHosts   []string  `json:"selectedHosts"`
    62  		SelectableHosts []string  `json:"selectableHosts"`
    63  		RatePolicies    []struct {
    64  			AdditionalMatchOptions []struct {
    65  				PositiveMatch bool     `json:"positiveMatch"`
    66  				Type          string   `json:"type"`
    67  				Values        []string `json:"values"`
    68  			} `json:"additionalMatchOptions"`
    69  			AllTraffic            bool                         `json:"allTraffic,omitempty"`
    70  			AverageThreshold      int                          `json:"averageThreshold"`
    71  			BurstThreshold        int                          `json:"burstThreshold"`
    72  			ClientIdentifier      string                       `json:"clientIdentifier"`
    73  			CreateDate            time.Time                    `json:"-"`
    74  			Description           string                       `json:"description,omitempty"`
    75  			FileExtensions        *RatePolicyFileExtensions    `json:"fileExtensions,omitempty"`
    76  			Hosts                 *RatePoliciesHosts           `json:"hosts,omitempty"`
    77  			Hostnames             []string                     `json:"hostnames,omitempty"`
    78  			ID                    int                          `json:"id"`
    79  			MatchType             string                       `json:"matchType"`
    80  			Name                  string                       `json:"name"`
    81  			Path                  *RatePoliciesPath            `json:"path,omitempty"`
    82  			PathMatchType         string                       `json:"pathMatchType,omitempty"`
    83  			PathURIPositiveMatch  bool                         `json:"pathUriPositiveMatch"`
    84  			QueryParameters       *RatePoliciesQueryParameters `json:"queryParameters,omitempty"`
    85  			RequestType           string                       `json:"requestType"`
    86  			SameActionOnIpv6      bool                         `json:"sameActionOnIpv6"`
    87  			Type                  string                       `json:"type"`
    88  			UpdateDate            time.Time                    `json:"-"`
    89  			UseXForwardForHeaders bool                         `json:"useXForwardForHeaders"`
    90  			Used                  bool                         `json:"-"`
    91  		} `json:"ratePolicies"`
    92  		ReputationProfiles []struct {
    93  			Condition       *ConditionReputationProfile `json:"condition,omitempty"`
    94  			Context         string                      `json:"context,omitempty"`
    95  			ContextReadable string                      `json:"-"`
    96  
    97  			Enabled          bool   `json:"-"`
    98  			ID               int    `json:"id"`
    99  			Name             string `json:"name"`
   100  			SharedIPHandling string `json:"sharedIpHandling"`
   101  			Threshold        int    `json:"threshold"`
   102  		} `json:"reputationProfiles"`
   103  		CustomRules []struct {
   104  			ID            int      `json:"id"`
   105  			Name          string   `json:"name"`
   106  			Description   string   `json:"description,omitempty"`
   107  			Version       int      `json:"-"`
   108  			RuleActivated bool     `json:"-"`
   109  			Structured    bool     `json:"-"`
   110  			Tag           []string `json:"tag,omitempty"`
   111  			Conditions    []struct {
   112  				Name                  *json.RawMessage `json:"name,omitempty"`
   113  				NameCase              *bool            `json:"nameCase,omitempty"`
   114  				NameWildcard          *bool            `json:"nameWildcard,omitempty"`
   115  				PositiveMatch         bool             `json:"positiveMatch"`
   116  				Type                  string           `json:"type"`
   117  				Value                 *json.RawMessage `json:"value,omitempty"`
   118  				ValueCase             *bool            `json:"valueCase,omitempty"`
   119  				ValueExactMatch       *bool            `json:"valueExactMatch,omitempty"`
   120  				ValueIgnoreSegment    *bool            `json:"valueIgnoreSegment,omitempty"`
   121  				ValueNormalize        *bool            `json:"valueNormalize,omitempty"`
   122  				ValueRecursive        *bool            `json:"valueRecursive,omitempty"`
   123  				ValueWildcard         *bool            `json:"valueWildcard,omitempty"`
   124  				UseXForwardForHeaders *bool            `json:"useXForwardForHeaders,omitempty"`
   125  			} `json:"conditions,omitempty"`
   126  
   127  			EffectiveTimePeriod *CustomRuleEffectivePeriod `json:"effectiveTimePeriod,omitempty"`
   128  			SamplingRate        int                        `json:"samplingRate,omitempty"`
   129  			LoggingOptions      *json.RawMessage           `json:"loggingOptions,omitempty"`
   130  			Operation           string                     `json:"operation,omitempty"`
   131  		} `json:"customRules"`
   132  		Rulesets []struct {
   133  			ID               int            `json:"id"`
   134  			RulesetVersionID int            `json:"rulesetVersionId"`
   135  			Type             string         `json:"type"`
   136  			ReleaseDate      time.Time      `json:"releaseDate"`
   137  			Rules            *RulesetsRules `json:"rules,omitempty"`
   138  			AttackGroups     []struct {
   139  				Group     string `json:"group"`
   140  				GroupName string `json:"groupName"`
   141  				Threshold int    `json:"threshold,omitempty"`
   142  			} `json:"attackGroups,omitempty"`
   143  		} `json:"rulesets"`
   144  		MatchTargets struct {
   145  			APITargets []struct {
   146  				Sequence int    `json:"sequence"`
   147  				ID       int    `json:"id,omitempty"`
   148  				TargetID int    `json:"targetId"`
   149  				Type     string `json:"type,omitempty"`
   150  				Apis     []struct {
   151  					ID   int    `json:"id,omitempty"`
   152  					Name string `json:"name,omitempty"`
   153  				} `json:"apis,omitempty"`
   154  				SecurityPolicy struct {
   155  					PolicyID string `json:"policyId,omitempty"`
   156  				} `json:"securityPolicy,omitempty"`
   157  				BypassNetworkLists []struct {
   158  					Name string `json:"name,omitempty"`
   159  					ID   string `json:"id,omitempty"`
   160  				} `json:"bypassNetworkLists,omitempty"`
   161  			} `json:"apiTargets,omitempty"`
   162  			WebsiteTargets []struct {
   163  				Type               string `json:"type"`
   164  				BypassNetworkLists []struct {
   165  					ID   string `json:"id"`
   166  					Name string `json:"name"`
   167  				} `json:"bypassNetworkLists,omitempty"`
   168  				DefaultFile                  string   `json:"defaultFile"`
   169  				FilePaths                    []string `json:"filePaths,omitempty"`
   170  				FileExtensions               []string `json:"fileExtensions,omitempty"`
   171  				Hostnames                    []string `json:"hostnames,omitempty"`
   172  				ID                           int      `json:"id"`
   173  				IsNegativeFileExtensionMatch bool     `json:"isNegativeFileExtensionMatch"`
   174  				IsNegativePathMatch          bool     `json:"isNegativePathMatch"`
   175  				SecurityPolicy               struct {
   176  					PolicyID string `json:"policyId"`
   177  				} `json:"securityPolicy"`
   178  				Sequence int `json:"-"`
   179  			} `json:"websiteTargets"`
   180  		} `json:"matchTargets"`
   181  		SecurityPolicies []struct {
   182  			ID                      string `json:"id"`
   183  			Name                    string `json:"name"`
   184  			HasRatePolicyWithAPIKey bool   `json:"hasRatePolicyWithApiKey"`
   185  			SecurityControls        struct {
   186  				ApplyAPIConstraints           bool `json:"applyApiConstraints"`
   187  				ApplyApplicationLayerControls bool `json:"applyApplicationLayerControls"`
   188  				ApplyBotmanControls           bool `json:"applyBotmanControls"`
   189  				ApplyNetworkLayerControls     bool `json:"applyNetworkLayerControls"`
   190  				ApplyRateControls             bool `json:"applyRateControls"`
   191  				ApplyReputationControls       bool `json:"applyReputationControls"`
   192  				ApplySlowPostControls         bool `json:"applySlowPostControls"`
   193  				ApplyMalwareControls          bool `json:"applyMalwareControls"`
   194  			} `json:"securityControls"`
   195  			WebApplicationFirewall struct {
   196  				RuleActions []struct {
   197  					Action                 string              `json:"action"`
   198  					ID                     int                 `json:"id"`
   199  					RulesetVersionID       int                 `json:"rulesetVersionId"`
   200  					Conditions             *RuleConditions     `json:"conditions,omitempty"`
   201  					AdvancedExceptionsList *AdvancedExceptions `json:"advancedExceptions,omitempty"`
   202  					Exception              *RuleException      `json:"exception,omitempty"`
   203  				} `json:"ruleActions,omitempty"`
   204  				AttackGroupActions []struct {
   205  					Action                 string                         `json:"action"`
   206  					Group                  string                         `json:"group"`
   207  					RulesetVersionID       int                            `json:"rulesetVersionId"`
   208  					AdvancedExceptionsList *AttackGroupAdvancedExceptions `json:"advancedExceptions,omitempty"`
   209  					Exception              *AttackGroupException          `json:"exception,omitempty"`
   210  				} `json:"attackGroupActions,omitempty"`
   211  				Evaluation  *WebApplicationFirewallEvaluation `json:"evaluation,omitempty"`
   212  				ThreatIntel string                            `json:"threatIntel"`
   213  			} `json:"webApplicationFirewall"`
   214  			CustomRuleActions []struct {
   215  				Action string `json:"action"`
   216  				ID     int    `json:"id"`
   217  			} `json:"customRuleActions,omitempty"`
   218  			APIRequestConstraints *APIRequestConstraintsexp `json:"apiRequestConstraints,omitempty"`
   219  			ClientReputation      struct {
   220  				ReputationProfileActions *ClientReputationReputationProfileActions `json:"reputationProfileActions,omitempty"`
   221  			} `json:"clientReputation"`
   222  			RatePolicyActions    *SecurityPoliciesRatePolicyActions `json:"ratePolicyActions,omitempty"`
   223  			MalwarePolicyActions []MalwarePolicyActionBody          `json:"malwarePolicyActions,omitempty"`
   224  			IPGeoFirewall        *IPGeoFirewall                     `json:"ipGeoFirewall,omitempty"`
   225  			PenaltyBox           *SecurityPoliciesPenaltyBox        `json:"penaltyBox,omitempty"`
   226  			EvaluationPenaltyBox *SecurityPoliciesPenaltyBox        `json:"evaluationPenaltyBox,omitempty"`
   227  			SlowPost             *SlowPostexp                       `json:"slowPost,omitempty"`
   228  			LoggingOverrides     *LoggingOverridesexp               `json:"loggingOverrides,omitempty"`
   229  			PragmaHeader         *GetAdvancedSettingsPragmaResponse `json:"pragmaHeader,omitempty"`
   230  			EvasivePathMatch     *EvasivePathMatchexp               `json:"evasivePathMatch,omitempty"`
   231  		} `json:"securityPolicies"`
   232  		Siem            *Siemexp            `json:"siem,omitempty"`
   233  		AdvancedOptions *AdvancedOptionsexp `json:"advancedOptions,omitempty"`
   234  		CustomDenyList  *CustomDenyListexp  `json:"customDenyList,omitempty"`
   235  		Evaluating      struct {
   236  			SecurityPolicies []EvaluatingSecurityPolicy `json:"securityPolicies,omitempty"`
   237  		} `json:"evaluating,omitempty"`
   238  		MalwarePolicies []MalwarePolicyBody `json:"malwarePolicies,omitempty"`
   239  	}
   240  
   241  	// GetExportConfigurationsRequest is used to call GetExportConfigurations.
   242  	// Deprecated: this struct will be removed in a future release.
   243  	GetExportConfigurationsRequest struct {
   244  		ConfigID int `json:"configId"`
   245  		Version  int `json:"version"`
   246  	}
   247  
   248  	// GetExportConfigurationsResponse is returned from a call to GetExportConfigurations.
   249  	// Deprecated: this struct will be removed in a future release.
   250  	GetExportConfigurationsResponse struct {
   251  		ConfigID   int    `json:"configId"`
   252  		ConfigName string `json:"configName"`
   253  		Version    int    `json:"version"`
   254  		BasedOn    int    `json:"basedOn"`
   255  		Staging    struct {
   256  			Status string `json:"status"`
   257  		} `json:"staging"`
   258  		Production struct {
   259  			Status string `json:"status"`
   260  		} `json:"production"`
   261  		CreateDate      time.Time `json:"-"`
   262  		CreatedBy       string    `json:"createdBy"`
   263  		SelectedHosts   []string  `json:"selectedHosts"`
   264  		SelectableHosts []string  `json:"selectableHosts"`
   265  		RatePolicies    []struct {
   266  			AdditionalMatchOptions []struct {
   267  				PositiveMatch bool     `json:"positiveMatch"`
   268  				Type          string   `json:"type"`
   269  				Values        []string `json:"values"`
   270  			} `json:"additionalMatchOptions"`
   271  			AllTraffic            bool                         `json:"allTraffic,omitempty"`
   272  			AverageThreshold      int                          `json:"averageThreshold"`
   273  			BurstThreshold        int                          `json:"burstThreshold"`
   274  			ClientIdentifier      string                       `json:"clientIdentifier"`
   275  			CreateDate            time.Time                    `json:"-"`
   276  			Description           string                       `json:"description,omitempty"`
   277  			FileExtensions        *RatePolicyFileExtensions    `json:"fileExtensions,omitempty"`
   278  			Hosts                 *RatePoliciesHosts           `json:"hosts,omitempty"`
   279  			Hostnames             []string                     `json:"hostnames,omitempty"`
   280  			ID                    int                          `json:"id"`
   281  			MatchType             string                       `json:"matchType"`
   282  			Name                  string                       `json:"name"`
   283  			Path                  *RatePoliciesPath            `json:"path,omitempty"`
   284  			PathMatchType         string                       `json:"pathMatchType,omitempty"`
   285  			PathURIPositiveMatch  bool                         `json:"pathUriPositiveMatch"`
   286  			QueryParameters       *RatePoliciesQueryParameters `json:"queryParameters,omitempty"`
   287  			RequestType           string                       `json:"requestType"`
   288  			SameActionOnIpv6      bool                         `json:"sameActionOnIpv6"`
   289  			Type                  string                       `json:"type"`
   290  			UpdateDate            time.Time                    `json:"-"`
   291  			UseXForwardForHeaders bool                         `json:"useXForwardForHeaders"`
   292  			Used                  bool                         `json:"-"`
   293  		} `json:"ratePolicies"`
   294  		ReputationProfiles []struct {
   295  			Condition        *ConditionReputationProfile `json:"condition,omitempty"`
   296  			Context          string                      `json:"context,omitempty"`
   297  			ContextReadable  string                      `json:"-"`
   298  			Enabled          bool                        `json:"-"`
   299  			ID               int                         `json:"id"`
   300  			Name             string                      `json:"name"`
   301  			SharedIPHandling string                      `json:"sharedIpHandling"`
   302  			Threshold        int                         `json:"threshold"`
   303  		} `json:"reputationProfiles"`
   304  		CustomRules []struct {
   305  			Conditions    *ConditionsExp `json:"conditions,omitempty"`
   306  			Description   string         `json:"description,omitempty"`
   307  			ID            int            `json:"id"`
   308  			Name          string         `json:"name"`
   309  			RuleActivated bool           `json:"-"`
   310  			Structured    bool           `json:"-"`
   311  			Tag           []string       `json:"tag"`
   312  			Version       int            `json:"-"`
   313  		} `json:"customRules"`
   314  		Rulesets []struct {
   315  			ID               int            `json:"id"`
   316  			RulesetVersionID int            `json:"rulesetVersionId"`
   317  			Type             string         `json:"type"`
   318  			ReleaseDate      time.Time      `json:"releaseDate"`
   319  			Rules            *RulesetsRules `json:"rules,omitempty"`
   320  			AttackGroups     []struct {
   321  				Group     string `json:"group"`
   322  				GroupName string `json:"groupName"`
   323  				Threshold int    `json:"threshold,omitempty"`
   324  			} `json:"attackGroups,omitempty"`
   325  		} `json:"rulesets"`
   326  		MatchTargets struct {
   327  			APITargets []struct {
   328  				Sequence int    `json:"-"`
   329  				ID       int    `json:"id,omitempty"`
   330  				Type     string `json:"type,omitempty"`
   331  				Apis     []struct {
   332  					ID   int    `json:"id,omitempty"`
   333  					Name string `json:"name,omitempty"`
   334  				} `json:"apis,omitempty"`
   335  				SecurityPolicy struct {
   336  					PolicyID string `json:"policyId,omitempty"`
   337  				} `json:"securityPolicy,omitempty"`
   338  				BypassNetworkLists []struct {
   339  					Name string `json:"name,omitempty"`
   340  					ID   string `json:"id,omitempty"`
   341  				} `json:"bypassNetworkLists,omitempty"`
   342  			} `json:"apiTargets,omitempty"`
   343  			WebsiteTargets []struct {
   344  				Type               string `json:"type"`
   345  				BypassNetworkLists []struct {
   346  					ID   string `json:"id"`
   347  					Name string `json:"name"`
   348  				} `json:"bypassNetworkLists,omitempty"`
   349  				DefaultFile                  string   `json:"defaultFile"`
   350  				FilePaths                    []string `json:"filePaths,omitempty"`
   351  				FileExtensions               []string `json:"fileExtensions,omitempty"`
   352  				Hostnames                    []string `json:"hostnames,omitempty"`
   353  				ID                           int      `json:"id"`
   354  				IsNegativeFileExtensionMatch bool     `json:"isNegativeFileExtensionMatch"`
   355  				IsNegativePathMatch          bool     `json:"isNegativePathMatch"`
   356  				SecurityPolicy               struct {
   357  					PolicyID string `json:"policyId"`
   358  				} `json:"securityPolicy"`
   359  				Sequence int `json:"-"`
   360  			} `json:"websiteTargets"`
   361  		} `json:"matchTargets"`
   362  		SecurityPolicies []struct {
   363  			ID                      string `json:"id"`
   364  			Name                    string `json:"name"`
   365  			HasRatePolicyWithAPIKey bool   `json:"hasRatePolicyWithApiKey"`
   366  			SecurityControls        struct {
   367  				ApplyAPIConstraints           bool `json:"applyApiConstraints"`
   368  				ApplyApplicationLayerControls bool `json:"applyApplicationLayerControls"`
   369  				ApplyBotmanControls           bool `json:"applyBotmanControls"`
   370  				ApplyNetworkLayerControls     bool `json:"applyNetworkLayerControls"`
   371  				ApplyRateControls             bool `json:"applyRateControls"`
   372  				ApplyReputationControls       bool `json:"applyReputationControls"`
   373  				ApplySlowPostControls         bool `json:"applySlowPostControls"`
   374  				ApplyMalwareControls          bool `json:"applyMalwareControls"`
   375  			} `json:"securityControls"`
   376  			WebApplicationFirewall struct {
   377  				RuleActions []struct {
   378  					Action           string          `json:"action"`
   379  					ID               int             `json:"id"`
   380  					RulesetVersionID int             `json:"rulesetVersionId"`
   381  					Conditions       *RuleConditions `json:"conditions,omitempty"`
   382  					Exception        *RuleException  `json:"exception,omitempty"`
   383  				} `json:"ruleActions,omitempty"`
   384  				AttackGroupActions []struct {
   385  					Action                 string                         `json:"action"`
   386  					Group                  string                         `json:"group"`
   387  					RulesetVersionID       int                            `json:"rulesetVersionId"`
   388  					AdvancedExceptionsList *AttackGroupAdvancedExceptions `json:"advancedExceptions,omitempty"`
   389  					Exception              *AttackGroupException          `json:"exception,omitempty"`
   390  				} `json:"attackGroupActions,omitempty"`
   391  				Evaluation  *WebApplicationFirewallEvaluation `json:"evaluation,omitempty"`
   392  				ThreatIntel string                            `json:"threatIntel"`
   393  			} `json:"webApplicationFirewall"`
   394  			CustomRuleActions []struct {
   395  				Action string `json:"action"`
   396  				ID     int    `json:"id"`
   397  			} `json:"customRuleActions,omitempty"`
   398  			APIRequestConstraints *APIRequestConstraintsexp `json:"apiRequestConstraints,omitempty"`
   399  			ClientReputation      struct {
   400  				ReputationProfileActions *ClientReputationReputationProfileActions `json:"reputationProfileActions,omitempty"`
   401  			} `json:"clientReputation"`
   402  			RatePolicyActions *SecurityPoliciesRatePolicyActions `json:"ratePolicyActions,omitempty"`
   403  			IPGeoFirewall     struct {
   404  				Block       string `json:"block"`
   405  				GeoControls struct {
   406  					BlockedIPNetworkLists struct {
   407  						NetworkList []string `json:"networkList,omitempty"`
   408  					} `json:"blockedIPNetworkLists"`
   409  				} `json:"geoControls"`
   410  				IPControls struct {
   411  					AllowedIPNetworkLists struct {
   412  						NetworkList []string `json:"networkList,omitempty"`
   413  					} `json:"allowedIPNetworkLists"`
   414  					BlockedIPNetworkLists struct {
   415  						NetworkList []string `json:"networkList,omitempty"`
   416  					} `json:"blockedIPNetworkLists"`
   417  				} `json:"ipControls"`
   418  			} `json:"ipGeoFirewall,omitempty"`
   419  			PenaltyBox           *SecurityPoliciesPenaltyBox        `json:"penaltyBox,omitempty"`
   420  			EvaluationPenaltyBox *SecurityPoliciesPenaltyBox        `json:"evaluationPenaltyBox,omitempty"`
   421  			SlowPost             *SlowPostexp                       `json:"slowPost,omitempty"`
   422  			LoggingOverrides     *LoggingOverridesexp               `json:"loggingOverrides,omitempty"`
   423  			PragmaHeader         *GetAdvancedSettingsPragmaResponse `json:"pragmaHeader,omitempty"`
   424  			EvasivePathMatch     *EvasivePathMatchexp               `json:"evasivePathMatch,omitempty"`
   425  		} `json:"securityPolicies"`
   426  		Siem            *Siemexp            `json:"siem,omitempty"`
   427  		AdvancedOptions *AdvancedOptionsexp `json:"advancedOptions,omitempty"`
   428  		CustomDenyList  *CustomDenyListexp  `json:"customDenyList,omitempty"`
   429  		Evaluating      struct {
   430  			SecurityPolicies []struct {
   431  				EffectiveSecurityControls struct {
   432  					ApplyApplicationLayerControls bool `json:"applyApplicationLayerControls,omitempty"`
   433  					ApplyRateControls             bool `json:"applyRateControls,omitempty"`
   434  					ApplySlowPostControls         bool `json:"applySlowPostControls,omitempty"`
   435  				}
   436  				Hostnames        []string `json:"hostnames,omitempty"`
   437  				SecurityPolicyID string   `json:"id"`
   438  			}
   439  		} `json:"evaluating"`
   440  	}
   441  
   442  	// RatePoliciesPath is returned as part of GetExportConfigurationResponse.
   443  	RatePoliciesPath struct {
   444  		PositiveMatch bool                    `json:"positiveMatch"`
   445  		Values        *RatePoliciesPathValues `json:"values,omitempty"`
   446  	}
   447  
   448  	// ReputationProfileActionsexp is returned as part of GetExportConfigurationResponse.
   449  	ReputationProfileActionsexp []struct {
   450  		Action string `json:"action"`
   451  		ID     int    `json:"id"`
   452  	}
   453  
   454  	// RatePolicyActionsexp is returned as part of GetExportConfigurationResponse.
   455  	RatePolicyActionsexp []struct {
   456  		ID         int    `json:"id"`
   457  		Ipv4Action string `json:"ipv4Action"`
   458  		Ipv6Action string `json:"ipv6Action"`
   459  	}
   460  
   461  	// SlowRateThresholdExp is returned as part of GetExportConfigurationResponse.
   462  	SlowRateThresholdExp struct {
   463  		Period int `json:"period"`
   464  		Rate   int `json:"rate"`
   465  	}
   466  
   467  	// DurationThresholdExp is returned as part of GetExportConfigurationResponse.
   468  	DurationThresholdExp struct {
   469  		Timeout int `json:"timeout"`
   470  	}
   471  
   472  	// SlowPostexp is returned as part of GetExportConfigurationResponse.
   473  	SlowPostexp struct {
   474  		Action            string                `json:"action"`
   475  		SlowRateThreshold *SlowRateThresholdExp `json:"slowRateThreshold,omitempty"`
   476  		DurationThreshold *DurationThresholdExp `json:"durationThreshold,omitempty"`
   477  	}
   478  
   479  	// AdvancedOptionsexp is returned as part of GetExportConfigurationResponse.
   480  	AdvancedOptionsexp struct {
   481  		Logging          *Loggingexp          `json:"logging"`
   482  		EvasivePathMatch *EvasivePathMatchexp `json:"evasivePathMatch,omitempty"`
   483  		Prefetch         struct {
   484  			AllExtensions      bool     `json:"allExtensions"`
   485  			EnableAppLayer     bool     `json:"enableAppLayer"`
   486  			EnableRateControls bool     `json:"enableRateControls"`
   487  			Extensions         []string `json:"extensions,omitempty"`
   488  		} `json:"prefetch"`
   489  		PragmaHeader *GetAdvancedSettingsPragmaResponse `json:"pragmaHeader,omitempty"`
   490  	}
   491  
   492  	// CustomDenyListexp is returned as part of GetExportConfigurationResponse.
   493  	CustomDenyListexp []struct {
   494  		Description string `json:"description,omitempty"`
   495  		Name        string `json:"name"`
   496  		ID          string `json:"id"`
   497  		Parameters  []struct {
   498  			DisplayName string `json:"-"`
   499  			Name        string `json:"name"`
   500  			Value       string `json:"value"`
   501  		} `json:"parameters"`
   502  	}
   503  
   504  	// CustomRuleActionsexp  is returned as part of GetExportConfigurationResponse.
   505  	CustomRuleActionsexp []struct {
   506  		Action string `json:"action"`
   507  		ID     int    `json:"id"`
   508  	}
   509  
   510  	// Siemexp is returned as part of GetExportConfigurationResponse.
   511  	Siemexp struct {
   512  		EnableForAllPolicies    bool     `json:"enableForAllPolicies,omitempty"`
   513  		EnableSiem              bool     `json:"enableSiem"`
   514  		EnabledBotmanSiemEvents bool     `json:"enabledBotmanSiemEvents,omitempty"`
   515  		FirewallPolicyIds       []string `json:"firewallPolicyIds,omitempty"`
   516  		SiemDefinitionID        int      `json:"siemDefinitionId,omitempty"`
   517  	}
   518  
   519  	// PenaltyBoxexp is returned as part of GetExportConfigurationResponse.
   520  	PenaltyBoxexp struct {
   521  		Action               string `json:"action"`
   522  		PenaltyBoxProtection bool   `json:"penaltyBoxProtection"`
   523  	}
   524  
   525  	// APIRequestConstraintsexp is returned as part of GetExportConfigurationResponse.
   526  	APIRequestConstraintsexp struct {
   527  		Action       string `json:"action,omitempty"`
   528  		APIEndpoints []struct {
   529  			Action string `json:"action"`
   530  			ID     int    `json:"id"`
   531  		} `json:"apiEndpoints,omitempty"`
   532  	}
   533  
   534  	// Evaluationexp is returned as part of GetExportConfigurationResponse.
   535  	Evaluationexp struct {
   536  		AttackGroupActions []struct {
   537  			Action string `json:"action"`
   538  			Group  string `json:"group"`
   539  		} `json:"attackGroupActions"`
   540  		EvaluationID      int `json:"evaluationId"`
   541  		EvaluationVersion int `json:"evaluationVersion"`
   542  		RuleActions       []struct {
   543  			Action     string          `json:"action"`
   544  			ID         int             `json:"id"`
   545  			Conditions *RuleConditions `json:"conditions,omitempty"`
   546  			Exception  *RuleException  `json:"exception,omitempty"`
   547  		} `json:"ruleActions"`
   548  		RulesetVersionID int `json:"rulesetVersionId"`
   549  	}
   550  
   551  	// ConditionReputationProfile is returned as part of GetExportConfigurationResponse.
   552  	ConditionReputationProfile struct {
   553  		AtomicConditions *AtomicConditionsexp `json:"atomicConditions,omitempty"`
   554  		CanDelete        bool                 `json:"-"`
   555  		ConfigVersionID  int                  `json:"-"`
   556  		ID               int                  `json:"-"`
   557  		Name             string               `json:"-"`
   558  		PositiveMatch    *json.RawMessage     `json:"positiveMatch,omitempty"`
   559  		UUID             string               `json:"-"`
   560  		Version          int64                `json:"-"`
   561  	}
   562  
   563  	// HeaderCookieOrParamValuesattackgroup is returned as part of GetExportConfigurationResponse.
   564  	HeaderCookieOrParamValuesattackgroup []struct {
   565  		Criteria []struct {
   566  			Hostnames []string `json:"hostnames,omitempty"`
   567  			Paths     []string `json:"paths,omitempty"`
   568  			Values    []string `json:"values,omitempty"`
   569  		} `json:"criteria"`
   570  		ValueWildcard bool     `json:"valueWildcard,omitempty"`
   571  		Values        []string `json:"values,omitempty"`
   572  	}
   573  
   574  	// SpecificHeaderCookieOrParamNameValueexp is returned as part of GetExportConfigurationResponse.
   575  	SpecificHeaderCookieOrParamNameValueexp struct {
   576  		Name     *json.RawMessage `json:"name,omitempty"`
   577  		Selector string           `json:"selector,omitempty"`
   578  		Value    *json.RawMessage `json:"value,omitempty"`
   579  	}
   580  
   581  	// AtomicConditionsexp is returned as part of GetExportConfigurationResponse.
   582  	AtomicConditionsexp []struct {
   583  		CheckIps      *json.RawMessage `json:"checkIps,omitempty"`
   584  		ClassName     string           `json:"className,omitempty"`
   585  		Index         int              `json:"index,omitempty"`
   586  		PositiveMatch *json.RawMessage `json:"positiveMatch,omitempty"`
   587  		Value         []string         `json:"value,omitempty"`
   588  		Name          *json.RawMessage `json:"name,omitempty"`
   589  		NameCase      bool             `json:"nameCase,omitempty"`
   590  		NameWildcard  *json.RawMessage `json:"nameWildcard,omitempty"`
   591  		ValueCase     bool             `json:"valueCase,omitempty"`
   592  		ValueWildcard *json.RawMessage `json:"valueWildcard,omitempty"`
   593  		Host          []string         `json:"host,omitempty"`
   594  	}
   595  
   596  	// Loggingexp is returned as part of GetExportConfigurationResponse.
   597  	Loggingexp struct {
   598  		AllowSampling bool `json:"allowSampling"`
   599  		Cookies       struct {
   600  			Type   string   `json:"type"`
   601  			Values []string `json:"values,omitempty"`
   602  		} `json:"cookies"`
   603  		CustomHeaders struct {
   604  			Type   string   `json:"type"`
   605  			Values []string `json:"values,omitempty"`
   606  		} `json:"customHeaders"`
   607  		StandardHeaders struct {
   608  			Type   string   `json:"type"`
   609  			Values []string `json:"values,omitempty"`
   610  		} `json:"standardHeaders"`
   611  	}
   612  
   613  	// LoggingOverridesexp is returned as part of GetExportConfigurationResponse.
   614  	LoggingOverridesexp struct {
   615  		AllowSampling bool `json:"allowSampling"`
   616  		Cookies       struct {
   617  			Type   string   `json:"type"`
   618  			Values []string `json:"values,omitempty"`
   619  		} `json:"cookies"`
   620  		CustomHeaders struct {
   621  			Type   string   `json:"type"`
   622  			Values []string `json:"values,omitempty"`
   623  		} `json:"customHeaders"`
   624  		Override        bool `json:"override"`
   625  		StandardHeaders struct {
   626  			Type   string   `json:"type"`
   627  			Values []string `json:"values,omitempty"`
   628  		} `json:"standardHeaders"`
   629  	}
   630  
   631  	// EvasivePathMatchexp contains the EnablePathMatch setting
   632  	EvasivePathMatchexp struct {
   633  		EnablePathMatch bool `json:"enabled"`
   634  	}
   635  
   636  	// ConditionsExp is returned as part of GetExportConfigurationResponse.
   637  	ConditionsExp []struct {
   638  		Type          string           `json:"type"`
   639  		PositiveMatch bool             `json:"positiveMatch"`
   640  		Name          *json.RawMessage `json:"name,omitempty"`
   641  		NameCase      *json.RawMessage `json:"nameCase,omitempty"`
   642  		NameWildcard  *json.RawMessage `json:"nameWildcard,omitempty"`
   643  		Value         *json.RawMessage `json:"value,omitempty"`
   644  		ValueCase     *json.RawMessage `json:"valueCase,omitempty"`
   645  		ValueWildcard *json.RawMessage `json:"valueWildcard,omitempty"`
   646  	}
   647  
   648  	// RatePoliciesPathValues is returned as part of GetExportConfigurationResponse.
   649  	RatePoliciesPathValues []string
   650  
   651  	// RatePoliciesQueryParameters is returned as part of GetExportConfigurationResponse.
   652  	RatePoliciesQueryParameters []struct {
   653  		Name          string                             `json:"name"`
   654  		PositiveMatch bool                               `json:"positiveMatch"`
   655  		ValueInRange  bool                               `json:"valueInRange"`
   656  		Values        *RatePoliciesQueryParametersValues `json:"values,omitempty"`
   657  	}
   658  
   659  	// RatePoliciesQueryParametersValues is returned as part of GetExportConfigurationResponse.
   660  	RatePoliciesQueryParametersValues []string
   661  
   662  	// SecurityPoliciesPenaltyBox is returned as part of GetExportConfigurationResponse.
   663  	SecurityPoliciesPenaltyBox struct {
   664  		Action               string `json:"action,omitempty"`
   665  		PenaltyBoxProtection bool   `json:"penaltyBoxProtection,omitempty"`
   666  	}
   667  
   668  	// WebApplicationFirewallEvaluation is returned as part of GetExportConfigurationResponse.
   669  	WebApplicationFirewallEvaluation struct {
   670  		AttackGroupActions []struct {
   671  			Action                 string              `json:"action"`
   672  			Group                  string              `json:"group"`
   673  			Exception              *RuleException      `json:"exception,omitempty"`
   674  			AdvancedExceptionsList *AdvancedExceptions `json:"advancedExceptions,omitempty"`
   675  		} `json:"attackGroupActions,omitempty"`
   676  		EvaluationID      int `json:"evaluationId"`
   677  		EvaluationVersion int `json:"evaluationVersion"`
   678  		RuleActions       []struct {
   679  			Action                 string              `json:"action"`
   680  			ID                     int                 `json:"id"`
   681  			Conditions             *RuleConditions     `json:"conditions,omitempty"`
   682  			Exception              *RuleException      `json:"exception,omitempty"`
   683  			AdvancedExceptionsList *AdvancedExceptions `json:"advancedExceptions,omitempty"`
   684  		} `json:"ruleActions,omitempty"`
   685  		RulesetVersionID int `json:"rulesetVersionId"`
   686  	}
   687  
   688  	// RulesetsRules is returned as part of GetExportConfigurationResponse.
   689  	RulesetsRules []struct {
   690  		ID                  int      `json:"id"`
   691  		InspectRequestBody  bool     `json:"inspectRequestBody"`
   692  		InspectResponseBody bool     `json:"inspectResponseBody"`
   693  		Outdated            bool     `json:"outdated"`
   694  		RuleVersion         int      `json:"ruleVersion"`
   695  		Score               int      `json:"score"`
   696  		Tag                 string   `json:"tag"`
   697  		Title               string   `json:"title"`
   698  		AttackGroups        []string `json:"attackGroups,omitempty"`
   699  	}
   700  
   701  	// ClientReputationReputationProfileActions is returned as part of GetExportConfigurationResponse.
   702  	ClientReputationReputationProfileActions []struct {
   703  		Action string `json:"action"`
   704  		ID     int    `json:"id"`
   705  	}
   706  
   707  	// SecurityPoliciesRatePolicyActions is returned as part of GetExportConfigurationResponse.
   708  	SecurityPoliciesRatePolicyActions []struct {
   709  		ID         int    `json:"id"`
   710  		Ipv4Action string `json:"ipv4Action"`
   711  		Ipv6Action string `json:"ipv6Action"`
   712  	}
   713  )
   714  
   715  // UnmarshalJSON reads a ConditionsValue struct from its data argument.
   716  func (c *ConditionsValue) UnmarshalJSON(data []byte) error {
   717  	var nums interface{}
   718  	err := json.Unmarshal(data, &nums)
   719  	if err != nil {
   720  		return err
   721  	}
   722  
   723  	items := reflect.ValueOf(nums)
   724  	switch items.Kind() {
   725  	case reflect.String:
   726  		*c = append(*c, items.String())
   727  
   728  	case reflect.Slice:
   729  		*c = make(ConditionsValue, 0, items.Len())
   730  		for i := 0; i < items.Len(); i++ {
   731  			item := items.Index(i)
   732  			switch item.Kind() {
   733  			case reflect.String:
   734  				*c = append(*c, item.String())
   735  			case reflect.Interface:
   736  				*c = append(*c, item.Interface().(string))
   737  			}
   738  		}
   739  	}
   740  	return nil
   741  }
   742  
   743  func (p *appsec) GetExportConfiguration(ctx context.Context, params GetExportConfigurationRequest) (*GetExportConfigurationResponse, error) {
   744  	logger := p.Log(ctx)
   745  	logger.Debug("GetExportConfiguration")
   746  
   747  	uri := fmt.Sprintf(
   748  		"/appsec/v1/export/configs/%d/versions/%d",
   749  		params.ConfigID,
   750  		params.Version)
   751  
   752  	req, err := http.NewRequestWithContext(ctx, http.MethodGet, uri, nil)
   753  	if err != nil {
   754  		return nil, fmt.Errorf("failed to create GetExportConfiguration request: %w", err)
   755  	}
   756  
   757  	var result GetExportConfigurationResponse
   758  	resp, err := p.Exec(req, &result)
   759  	if err != nil {
   760  		return nil, fmt.Errorf("get export configuration request failed: %w", err)
   761  	}
   762  	if resp.StatusCode != http.StatusOK {
   763  		return nil, p.Error(resp)
   764  	}
   765  
   766  	return &result, nil
   767  }
   768  
   769  // Deprecated: this method will be removed in a future release.
   770  func (p *appsec) GetExportConfigurations(ctx context.Context, params GetExportConfigurationsRequest) (*GetExportConfigurationsResponse, error) {
   771  	logger := p.Log(ctx)
   772  	logger.Debug("GetExportConfigurations")
   773  
   774  	uri := fmt.Sprintf(
   775  		"/appsec/v1/export/configs/%d/versions/%d",
   776  		params.ConfigID,
   777  		params.Version)
   778  
   779  	req, err := http.NewRequestWithContext(ctx, http.MethodGet, uri, nil)
   780  	if err != nil {
   781  		return nil, fmt.Errorf("failed to create GetExportConfigurations request: %w", err)
   782  	}
   783  
   784  	var result GetExportConfigurationsResponse
   785  	resp, err := p.Exec(req, &result)
   786  	if err != nil {
   787  		return nil, fmt.Errorf("get export configurations request failed: %w", err)
   788  	}
   789  	if resp.StatusCode != http.StatusOK {
   790  		return nil, p.Error(resp)
   791  	}
   792  
   793  	return &result, nil
   794  }