// Code generated by azure-service-operator-codegen. DO NOT EDIT.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
package arm

import "github.com/Azure/azure-service-operator/v2/pkg/genruntime"

type Backend_Spec struct {
	Name string `json:"name,omitempty"`

	// Properties: Backend entity contract properties.
	Properties *BackendContractProperties `json:"properties,omitempty"`
}

var _ genruntime.ARMResourceSpec = &Backend_Spec{}

// GetAPIVersion returns the ARM API version of the resource. This is always "2023-05-01-preview"
func (backend Backend_Spec) GetAPIVersion() string {
	return "2023-05-01-preview"
}

// GetName returns the Name of the resource
func (backend *Backend_Spec) GetName() string {
	return backend.Name
}

// GetType returns the ARM Type of the resource. This is always "Microsoft.ApiManagement/service/backends"
func (backend *Backend_Spec) GetType() string {
	return "Microsoft.ApiManagement/service/backends"
}

// Parameters supplied to the Create Backend operation.
type BackendContractProperties struct {
	// CircuitBreaker: Backend Circuit Breaker Configuration
	CircuitBreaker *BackendCircuitBreaker `json:"circuitBreaker,omitempty"`

	// Credentials: Backend Credentials Contract Properties
	Credentials *BackendCredentialsContract `json:"credentials,omitempty"`

	// Description: Backend Description.
	Description *string `json:"description,omitempty"`

	// Pool: Backend pool information
	Pool *BackendPool `json:"pool,omitempty"`

	// Properties: Backend Properties contract
	Properties *BackendProperties `json:"properties,omitempty"`

	// Protocol: Backend communication protocol. Required when backend type is 'Single'.
	Protocol *BackendContractProperties_Protocol `json:"protocol,omitempty"`

	// Proxy: Backend gateway Contract Properties
	Proxy *BackendProxyContract `json:"proxy,omitempty"`

	// ResourceId: Management Uri of the Resource in External System. This URL can be the Arm Resource Id of Logic Apps,
	// Function Apps or API Apps.
	ResourceId *string `json:"resourceId,omitempty"`

	// Title: Backend Title.
	Title *string `json:"title,omitempty"`

	// Tls: Backend TLS Properties
	Tls *BackendTlsProperties `json:"tls,omitempty"`

	// Type: Type of the backend. A backend can be either Single or Pool.
	Type *BackendContractProperties_Type `json:"type,omitempty"`

	// Url: Runtime Url of the Backend. Required when backend type is 'Single'.
	Url *string `json:"url,omitempty"`
}

// The configuration of the backend circuit breaker
type BackendCircuitBreaker struct {
	// Rules: The rules for tripping the backend.
	Rules []CircuitBreakerRule `json:"rules,omitempty"`
}

// +kubebuilder:validation:Enum={"http","soap"}
type BackendContractProperties_Protocol string

const (
	BackendContractProperties_Protocol_Http = BackendContractProperties_Protocol("http")
	BackendContractProperties_Protocol_Soap = BackendContractProperties_Protocol("soap")
)

// Mapping from string to BackendContractProperties_Protocol
var backendContractProperties_Protocol_Values = map[string]BackendContractProperties_Protocol{
	"http": BackendContractProperties_Protocol_Http,
	"soap": BackendContractProperties_Protocol_Soap,
}

// +kubebuilder:validation:Enum={"Pool","Single"}
type BackendContractProperties_Type string

const (
	BackendContractProperties_Type_Pool   = BackendContractProperties_Type("Pool")
	BackendContractProperties_Type_Single = BackendContractProperties_Type("Single")
)

// Mapping from string to BackendContractProperties_Type
var backendContractProperties_Type_Values = map[string]BackendContractProperties_Type{
	"pool":   BackendContractProperties_Type_Pool,
	"single": BackendContractProperties_Type_Single,
}

// Details of the Credentials used to connect to Backend.
type BackendCredentialsContract struct {
	// Authorization: Authorization header authentication
	Authorization *BackendAuthorizationHeaderCredentials `json:"authorization,omitempty"`

	// Certificate: List of Client Certificate Thumbprints. Will be ignored if certificatesIds are provided.
	Certificate []string `json:"certificate,omitempty"`

	// CertificateIds: List of Client Certificate Ids.
	CertificateIds []string `json:"certificateIds,omitempty"`

	// Header: Header Parameter description.
	Header map[string][]string `json:"header,omitempty"`

	// Query: Query Parameter description.
	Query map[string][]string `json:"query,omitempty"`
}

// Backend pool information
type BackendPool struct {
	// Services: The list of backend entities belonging to a pool.
	Services []BackendPoolItem `json:"services,omitempty"`
}

// Properties specific to the Backend Type.
type BackendProperties struct {
	// ServiceFabricCluster: Backend Service Fabric Cluster Properties
	ServiceFabricCluster *BackendServiceFabricClusterProperties `json:"serviceFabricCluster,omitempty"`
}

// Details of the Backend WebProxy Server to use in the Request to Backend.
type BackendProxyContract struct {
	// Password: Password to connect to the WebProxy Server
	Password *string `json:"password,omitempty"`

	// Url: WebProxy Server AbsoluteUri property which includes the entire URI stored in the Uri instance, including all
	// fragments and query strings.
	Url *string `json:"url,omitempty"`

	// Username: Username to connect to the WebProxy server
	Username *string `json:"username,omitempty"`
}

// Properties controlling TLS Certificate Validation.
type BackendTlsProperties struct {
	// ValidateCertificateChain: Flag indicating whether SSL certificate chain validation should be done when using self-signed
	// certificates for this backend host.
	ValidateCertificateChain *bool `json:"validateCertificateChain,omitempty"`

	// ValidateCertificateName: Flag indicating whether SSL certificate name validation should be done when using self-signed
	// certificates for this backend host.
	ValidateCertificateName *bool `json:"validateCertificateName,omitempty"`
}

// Authorization header information.
type BackendAuthorizationHeaderCredentials struct {
	// Parameter: Authentication Parameter value.
	Parameter *string `json:"parameter,omitempty"`

	// Scheme: Authentication Scheme name.
	Scheme *string `json:"scheme,omitempty"`
}

// Backend pool service information
type BackendPoolItem struct {
	// Id: The unique ARM id of the backend entity. The ARM id should refer to an already existing backend entity.
	Id *string `json:"id,omitempty"`
}

// Properties of the Service Fabric Type Backend.
type BackendServiceFabricClusterProperties struct {
	// ClientCertificateId: The client certificate id for the management endpoint.
	ClientCertificateId *string `json:"clientCertificateId,omitempty"`

	// ClientCertificatethumbprint: The client certificate thumbprint for the management endpoint. Will be ignored if
	// certificatesIds are provided
	ClientCertificatethumbprint *string `json:"clientCertificatethumbprint,omitempty"`

	// ManagementEndpoints: The cluster management endpoint.
	ManagementEndpoints []string `json:"managementEndpoints,omitempty"`

	// MaxPartitionResolutionRetries: Maximum number of retries while attempting resolve the partition.
	MaxPartitionResolutionRetries *int `json:"maxPartitionResolutionRetries,omitempty"`

	// ServerCertificateThumbprints: Thumbprints of certificates cluster management service uses for tls communication
	ServerCertificateThumbprints []string `json:"serverCertificateThumbprints,omitempty"`

	// ServerX509Names: Server X509 Certificate Names Collection
	ServerX509Names []X509CertificateName `json:"serverX509Names,omitempty"`
}

// Rule configuration to trip the backend.
type CircuitBreakerRule struct {
	// FailureCondition: The conditions for tripping the circuit breaker.
	FailureCondition *CircuitBreakerFailureCondition `json:"failureCondition,omitempty"`

	// Name: The rule name.
	Name *string `json:"name,omitempty"`

	// TripDuration: The duration for which the circuit will be tripped.
	TripDuration *string `json:"tripDuration,omitempty"`
}

// The trip conditions of the circuit breaker
type CircuitBreakerFailureCondition struct {
	// Count: The threshold for opening the circuit.
	Count *int `json:"count,omitempty"`

	// ErrorReasons: The error reasons which are considered as failure.
	ErrorReasons []string `json:"errorReasons,omitempty"`

	// Interval: The interval during which the failures are counted.
	Interval *string `json:"interval,omitempty"`

	// Percentage: The threshold for opening the circuit.
	Percentage *int `json:"percentage,omitempty"`

	// StatusCodeRanges: The status code ranges which are considered as failure.
	StatusCodeRanges []FailureStatusCodeRange `json:"statusCodeRanges,omitempty"`
}

// Properties of server X509Names.
type X509CertificateName struct {
	// IssuerCertificateThumbprint: Thumbprint for the Issuer of the Certificate.
	IssuerCertificateThumbprint *string `json:"issuerCertificateThumbprint,omitempty"`

	// Name: Common Name of the Certificate.
	Name *string `json:"name,omitempty"`
}

// The failure http status code range
type FailureStatusCodeRange struct {
	// Max: The maximum http status code.
	Max *int `json:"max,omitempty"`

	// Min: The minimum http status code.
	Min *int `json:"min,omitempty"`
}
