yunion.io/x/cloudmux@v0.3.10-0-alpha.1/pkg/multicloud/azure/loadbalancer_props.go (about)

     1  // Copyright 2019 Yunion
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package azure
    16  
    17  type SLoadbalancerProperties struct {
    18  	Sku                                 Sku                                 `json:"sku"`
    19  	ProvisioningState                   string                              `json:"provisioningState"`
    20  	OperationalState                    string                              `json:"operationalState"`
    21  	ResourceGUID                        string                              `json:"resourceGuid"`
    22  	GatewayIPConfigurations             []GatewayIPConfiguration            `json:"gatewayIPConfigurations"`
    23  	SSLCertificates                     []SSLCertificate                    `json:"sslCertificates"`
    24  	FrontendIPConfigurations            []FrontendIPConfiguration           `json:"frontendIPConfigurations"`
    25  	FrontendPorts                       []FrontendPort                      `json:"frontendPorts"`
    26  	BackendAddressPools                 []BackendAddressPool                `json:"backendAddressPools"`
    27  	BackendHTTPSettingsCollection       []BackendHTTPSettingsCollection     `json:"backendHttpSettingsCollection"`
    28  	LoadBalancingRules                  []LoadBalancingRule                 `json:"loadBalancingRules"`
    29  	Probes                              []Probe                             `json:"probes"`
    30  	InboundNatRules                     []InboundNatRule                    `json:"inboundNatRules"`
    31  	HTTPListeners                       []HTTPListener                      `json:"httpListeners"`
    32  	URLPathMaps                         []URLPathMap                        `json:"urlPathMaps"`
    33  	RequestRoutingRules                 []RequestRoutingRule                `json:"requestRoutingRules"`
    34  	RedirectConfigurations              []RedirectConfiguration             `json:"redirectConfigurations"`
    35  	WebApplicationFirewallConfiguration WebApplicationFirewallConfiguration `json:"webApplicationFirewallConfiguration"`
    36  	AutoscaleConfiguration              AutoscaleConfiguration              `json:"autoscaleConfiguration"`
    37  	EnableHttp2                         bool                                `json:"enableHttp2"`
    38  }
    39  
    40  type AutoscaleConfiguration struct {
    41  	MaxCapacity int `json:"maxCapacity"`
    42  	MinCapacity int `json:"minCapacity"`
    43  }
    44  
    45  type BackendAddressPool struct {
    46  	Name       string                       `json:"name"`
    47  	ID         string                       `json:"id"`
    48  	Etag       string                       `json:"etag"`
    49  	Properties BackendAddressPoolProperties `json:"properties"`
    50  	Type       string                       `json:"type"`
    51  }
    52  
    53  type BackendAddressPoolProperties struct {
    54  	ProvisioningState       string                   `json:"provisioningState"`
    55  	LoadBalancingRules      []Subnet                 `json:"loadBalancingRules"`
    56  	BackendIPConfigurations []BackendIPConfiguration `json:"backendIPConfigurations"`
    57  	BackendAddresses        []BackendAddress         `json:"backendAddresses"`
    58  	RequestRoutingRules     []BackendIPConfiguration `json:"requestRoutingRules"`
    59  	URLPathMaps             []BackendIPConfiguration `json:"urlPathMaps"`
    60  	PathRules               []BackendIPConfiguration `json:"pathRules"`
    61  }
    62  
    63  type BackendIPConfiguration struct {
    64  	ID string `json:"id"`
    65  }
    66  
    67  type RedirectConfiguration struct {
    68  	Name       string                          `json:"name"`
    69  	ID         string                          `json:"id"`
    70  	Etag       string                          `json:"etag"`
    71  	Properties RedirectConfigurationProperties `json:"properties"`
    72  	Type       string                          `json:"type"`
    73  }
    74  
    75  type RedirectConfigurationProperties struct {
    76  	ProvisioningState  string                   `json:"provisioningState"`
    77  	RedirectType       string                   `json:"redirectType"`
    78  	TargetUrl          string                   `json:"targetUrl"`
    79  	TargetListener     PublicIPAddressElement   `json:"targetListener"`
    80  	IncludePath        bool                     `json:"includePath"`
    81  	IncludeQueryString bool                     `json:"includeQueryString"`
    82  	URLPathMaps        []PublicIPAddressElement `json:"urlPathMaps,omitempty"`
    83  	PathRules          []PublicIPAddressElement `json:"pathRules,omitempty"`
    84  }
    85  
    86  type WebApplicationFirewallConfiguration struct {
    87  	Enabled            bool          `json:"enabled"`
    88  	FirewallMode       string        `json:"firewallMode"`
    89  	RuleSetType        string        `json:"ruleSetType"`
    90  	RuleSetVersion     string        `json:"ruleSetVersion"`
    91  	DisabledRuleGroups []interface{} `json:"disabledRuleGroups"`
    92  }
    93  
    94  type URLPathMap struct {
    95  	Name       string               `json:"name"`
    96  	ID         string               `json:"id"`
    97  	Etag       string               `json:"etag"`
    98  	Properties URLPathMapProperties `json:"properties"`
    99  	Type       string               `json:"type"`
   100  }
   101  
   102  type URLPathMapProperties struct {
   103  	ProvisioningState            string                   `json:"provisioningState"`
   104  	DefaultBackendAddressPool    *PublicIPAddressElement  `json:"defaultBackendAddressPool,omitempty"`
   105  	DefaultBackendHTTPSettings   *PublicIPAddressElement  `json:"defaultBackendHttpSettings,omitempty"`
   106  	PathRules                    []PathRule               `json:"pathRules"`
   107  	RequestRoutingRules          []PublicIPAddressElement `json:"requestRoutingRules"`
   108  	DefaultRedirectConfiguration *PublicIPAddressElement  `json:"defaultRedirectConfiguration,omitempty"`
   109  }
   110  
   111  type PublicIPAddressElement struct {
   112  	ID string `json:"id"`
   113  }
   114  
   115  type PathRule struct {
   116  	Name       string             `json:"name"`
   117  	ID         string             `json:"id"`
   118  	Etag       string             `json:"etag"`
   119  	Properties PathRuleProperties `json:"properties"`
   120  	Type       string             `json:"type"`
   121  }
   122  
   123  type PathRuleProperties struct {
   124  	ProvisioningState     string                  `json:"provisioningState"`
   125  	Paths                 []string                `json:"paths"`
   126  	BackendAddressPool    *PublicIPAddressElement `json:"backendAddressPool,omitempty"`
   127  	BackendHTTPSettings   *PublicIPAddressElement `json:"backendHttpSettings,omitempty"`
   128  	RedirectConfiguration *PublicIPAddressElement `json:"redirectConfiguration,omitempty"`
   129  }
   130  
   131  type BackendAddress struct {
   132  	IPAddress string `json:"ipAddress"`
   133  }
   134  
   135  type BackendHTTPSettingsCollection struct {
   136  	Name       string                                  `json:"name"`
   137  	ID         string                                  `json:"id"`
   138  	Properties BackendHTTPSettingsCollectionProperties `json:"properties"`
   139  }
   140  
   141  type BackendHTTPSettingsCollectionProperties struct {
   142  	Port                int                `json:"port"`
   143  	Protocol            string             `json:"protocol"`
   144  	Probe               *ProbeId           `json:"probe"`
   145  	ConnectionDraining  ConnectionDraining `json:"connectionDraining"`
   146  	CookieBasedAffinity string             `json:"cookieBasedAffinity"`
   147  	AffinityCookieName  string             `json:"affinityCookieName"`
   148  	HostName            string             `json:"hostName"`
   149  	RequestTimeout      int                `json:"requestTimeout"`
   150  }
   151  
   152  type ConnectionDraining struct {
   153  	Enabled           bool   `json:"enabled"`
   154  	DrainTimeoutInSEC string `json:"drainTimeoutInSec"`
   155  }
   156  
   157  type ProbeId struct {
   158  	ID string `json:"id"`
   159  }
   160  
   161  type FrontendPort struct {
   162  	Name       string                 `json:"name"`
   163  	ID         string                 `json:"id"`
   164  	Properties FrontendPortProperties `json:"properties"`
   165  }
   166  
   167  type FrontendPortProperties struct {
   168  	Port int `json:"port"`
   169  }
   170  
   171  type GatewayIPConfiguration struct {
   172  	Name       string                           `json:"name"`
   173  	ID         string                           `json:"id"`
   174  	Properties GatewayIPConfigurationProperties `json:"properties"`
   175  }
   176  
   177  type GatewayIPConfigurationProperties struct {
   178  	Subnet PublicIPAddress `json:"subnet"`
   179  }
   180  
   181  type RequestRoutingRule struct {
   182  	Name       string                       `json:"name"`
   183  	ID         string                       `json:"id"`
   184  	Properties RequestRoutingRuleProperties `json:"properties"`
   185  }
   186  
   187  type RequestRoutingRuleProperties struct {
   188  	RuleType            string          `json:"ruleType"`
   189  	HTTPListener        PublicIPAddress `json:"httpListener"`
   190  	BackendAddressPool  PublicIPAddress `json:"backendAddressPool"`
   191  	BackendHTTPSettings PublicIPAddress `json:"backendHttpSettings"`
   192  }
   193  
   194  type SSLCertificate struct {
   195  	Name       string                   `json:"name"`
   196  	ID         string                   `json:"id"`
   197  	Properties SSLCertificateProperties `json:"properties"`
   198  }
   199  
   200  type SSLCertificateProperties struct {
   201  	ProvisioningState string `json:"provisioningState"`
   202  	PublicCertData    string `json:"public_cert_data"`
   203  	Data              string `json:"data"`
   204  	Password          string `json:"password"`
   205  }
   206  
   207  type Sku struct {
   208  	Name     string `json:"name"`
   209  	Tier     string `json:"tier"`
   210  	Capacity string `json:"capacity"`
   211  }
   212  
   213  type Subnet struct {
   214  	ID string `json:"id"`
   215  }
   216  
   217  type FrontendIPConfiguration struct {
   218  	Name       string                            `json:"name"`
   219  	ID         string                            `json:"id"`
   220  	Etag       string                            `json:"etag"`
   221  	Type       string                            `json:"type"`
   222  	Zones      []string                          `json:"zones"`
   223  	Properties FrontendIPConfigurationProperties `json:"properties"`
   224  }
   225  
   226  type FrontendIPConfigurationProperties struct {
   227  	ProvisioningState         string           `json:"provisioningState"`
   228  	PrivateIPAddress          string           `json:"privateIPAddress"`
   229  	PublicIPAddress           *PublicIPAddress `json:"publicIPAddress,omitempty"`
   230  	PrivateIPAllocationMethod string           `json:"privateIPAllocationMethod"`
   231  	PrivateIPAddressVersion   string           `json:"privateIPAddressVersion"`
   232  	Subnet                    Subnet           `json:"subnet"`
   233  	LoadBalancingRules        []Subnet         `json:"loadBalancingRules"`
   234  	InboundNatRules           []Subnet         `json:"inboundNatRules"`
   235  }
   236  
   237  type InboundNatRule struct {
   238  	Name       string                   `json:"name"`
   239  	ID         string                   `json:"id"`
   240  	Etag       string                   `json:"etag"`
   241  	Type       string                   `json:"type"`
   242  	Properties InboundNatRuleProperties `json:"properties"`
   243  }
   244  
   245  type InboundNatRuleProperties struct {
   246  	ProvisioningState       string `json:"provisioningState"`
   247  	FrontendIPConfiguration Subnet `json:"frontendIPConfiguration"`
   248  	FrontendPort            int64  `json:"frontendPort"`
   249  	BackendPort             int64  `json:"backendPort"`
   250  	EnableFloatingIP        bool   `json:"enableFloatingIP"`
   251  	IdleTimeoutInMinutes    int64  `json:"idleTimeoutInMinutes"`
   252  	Protocol                string `json:"protocol"`
   253  	EnableTCPReset          bool   `json:"enableTcpReset"`
   254  }
   255  
   256  type SLoadbalancerSku struct {
   257  	Name string `json:"name"`
   258  }
   259  
   260  type Probe struct {
   261  	lb *SLoadbalancer
   262  
   263  	Name       string          `json:"name"`
   264  	ID         string          `json:"id"`
   265  	Etag       string          `json:"etag"`
   266  	Type       string          `json:"type"`
   267  	Properties ProbeProperties `json:"properties"`
   268  }
   269  
   270  type ProbeProperties struct {
   271  	// tcp/udp/http/https
   272  	ProvisioningState string `json:"provisioningState"`
   273  	Protocol          string `json:"protocol"`
   274  	Port              int    `json:"port"`
   275  	RequestPath       string `json:"requestPath"`
   276  	IntervalInSeconds int    `json:"intervalInSeconds"`
   277  	NumberOfProbes    int    `json:"numberOfProbes"`
   278  	// http/ https only
   279  	Host                                string   `json:"host"`
   280  	Path                                string   `json:"path"`
   281  	Interval                            int      `json:"interval"`
   282  	Timeout                             int      `json:"timeout"`
   283  	UnhealthyThreshold                  int      `json:"unhealthyThreshold"`
   284  	PickHostNameFromBackendHTTPSettings bool     `json:"pickHostNameFromBackendHttpSettings"`
   285  	MinServers                          int      `json:"minServers"`
   286  	Match                               Match    `json:"match"`
   287  	LoadBalancingRules                  []Subnet `json:"loadBalancingRules"`
   288  }
   289  
   290  type Match struct {
   291  	Body        string   `json:"body"`
   292  	StatusCodes []string `json:"statusCodes"`
   293  }
   294  
   295  type LoadBalancingRule struct {
   296  	Name       string                      `json:"name"`
   297  	ID         string                      `json:"id"`
   298  	Etag       string                      `json:"etag"`
   299  	Type       string                      `json:"type"`
   300  	Properties LoadBalancingRuleProperties `json:"properties"`
   301  }
   302  
   303  type LoadBalancingRuleProperties struct {
   304  	ProvisioningState       string `json:"provisioningState"`
   305  	FrontendIPConfiguration Subnet `json:"frontendIPConfiguration"`
   306  	FrontendPort            int    `json:"frontendPort"`
   307  	BackendPort             int    `json:"backendPort"`
   308  	EnableFloatingIP        bool   `json:"enableFloatingIP"`
   309  	IdleTimeoutInMinutes    int    `json:"idleTimeoutInMinutes"`
   310  	Protocol                string `json:"protocol"`
   311  	EnableTCPReset          bool   `json:"enableTcpReset"`
   312  	LoadDistribution        string `json:"loadDistribution"`
   313  	BackendAddressPool      Subnet `json:"backendAddressPool"`
   314  	Probe                   Subnet `json:"probe"`
   315  }
   316  
   317  type HTTPListener struct {
   318  	Name       string                 `json:"name"`
   319  	ID         string                 `json:"id"`
   320  	Properties HTTPListenerProperties `json:"properties"`
   321  }
   322  
   323  type HTTPListenerProperties struct {
   324  	FrontendIPConfiguration     PublicIPAddress `json:"frontendIPConfiguration"`
   325  	FrontendPort                PublicIPAddress `json:"frontendPort"`
   326  	HostName                    string          `json:"hostName"`
   327  	Protocol                    string          `json:"protocol"`
   328  	SSLCertificate              PublicIPAddress `json:"sslCertificate"`
   329  	RequestRoutingRules         []Subnet        `json:"requestRoutingRules"`
   330  	RequireServerNameIndication bool            `json:"requireServerNameIndication"`
   331  }
   332  
   333  type ContentProperties struct {
   334  	ProvisioningState           string                            `json:"provisioningState"`
   335  	ResourceGUID                string                            `json:"resourceGuid"`
   336  	IPConfigurations            []NetworkInterfaceIPConfiguration `json:"ipConfigurations"`
   337  	DNSSettings                 DNSSettings                       `json:"dnsSettings"`
   338  	MACAddress                  string                            `json:"macAddress"`
   339  	EnableAcceleratedNetworking bool                              `json:"enableAcceleratedNetworking"`
   340  	EnableIPForwarding          bool                              `json:"enableIPForwarding"`
   341  	NetworkSecurityGroup        NetworkSecurityGroup              `json:"networkSecurityGroup"`
   342  	Primary                     bool                              `json:"primary"`
   343  	VirtualMachine              NetworkSecurityGroup              `json:"virtualMachine"`
   344  	HostedWorkloads             []interface{}                     `json:"hostedWorkloads"`
   345  	TapConfigurations           []interface{}                     `json:"tapConfigurations"`
   346  }
   347  
   348  type DNSSettings struct {
   349  	DNSServers               []interface{} `json:"dnsServers"`
   350  	AppliedDNSServers        []interface{} `json:"appliedDnsServers"`
   351  	InternalDomainNameSuffix string        `json:"internalDomainNameSuffix"`
   352  }
   353  
   354  type NetworkInterfaceIPConfiguration struct {
   355  	Name       string                    `json:"name"`
   356  	ID         string                    `json:"id"`
   357  	Etag       string                    `json:"etag"`
   358  	Type       string                    `json:"type"`
   359  	Properties IPConfigurationProperties `json:"properties"`
   360  }
   361  
   362  type IPConfigurationProperties struct {
   363  	ProvisioningState               string                 `json:"provisioningState"`
   364  	PrivateIPAddress                string                 `json:"privateIPAddress"`
   365  	PrivateIPAllocationMethod       string                 `json:"privateIPAllocationMethod"`
   366  	PublicIPAddress                 NetworkSecurityGroup   `json:"publicIPAddress"`
   367  	Subnet                          NetworkSecurityGroup   `json:"subnet"`
   368  	Primary                         bool                   `json:"primary"`
   369  	PrivateIPAddressVersion         string                 `json:"privateIPAddressVersion"`
   370  	LoadBalancerBackendAddressPools []NetworkSecurityGroup `json:"loadBalancerBackendAddressPools"`
   371  	LoadBalancerInboundNatRules     []NetworkSecurityGroup `json:"loadBalancerInboundNatRules"`
   372  }
   373  
   374  type NetworkSecurityGroup struct {
   375  	ID string `json:"id"`
   376  }