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