github.com/sacloud/iaas-api-go@v1.12.0/types/proxylb_rule.go (about)

     1  // Copyright 2022-2023 The sacloud/iaas-api-go Authors
     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 types
    16  
    17  // EProxyLBRuleAction エンハンスドロードバランサでのルール設定: アクション
    18  type EProxyLBRuleAction string
    19  
    20  func (a EProxyLBRuleAction) String() string {
    21  	return string(a)
    22  }
    23  
    24  // ProxyLBRuleActions エンハンスドロードバランサでのルール設定: アクション
    25  var ProxyLBRuleActions = struct {
    26  	Forward  EProxyLBRuleAction
    27  	Redirect EProxyLBRuleAction
    28  	Fixed    EProxyLBRuleAction
    29  }{
    30  	Forward:  "forward",
    31  	Redirect: "redirect",
    32  	Fixed:    "fixed",
    33  }
    34  
    35  func ProxyLBRuleActionStrings() []string {
    36  	return []string{
    37  		ProxyLBRuleActions.Forward.String(),
    38  		ProxyLBRuleActions.Redirect.String(),
    39  		ProxyLBRuleActions.Fixed.String(),
    40  	}
    41  }
    42  
    43  // EProxyLBRedirectStatusCode エンハンスドロードバランサでのルール設定: リダイレクト時のステータスコード
    44  type EProxyLBRedirectStatusCode StringNumber
    45  
    46  func (c EProxyLBRedirectStatusCode) String() string {
    47  	return StringNumber(c).String()
    48  }
    49  
    50  func (c EProxyLBRedirectStatusCode) Int() int {
    51  	return StringNumber(c).Int()
    52  }
    53  
    54  // ProxyLBRedirectStatusCodes エンハンスドロードバランサでのルール設定: リダイレクト時のステータスコード
    55  var ProxyLBRedirectStatusCodes = struct {
    56  	MovedPermanently EProxyLBRedirectStatusCode
    57  	Found            EProxyLBRedirectStatusCode
    58  }{
    59  	MovedPermanently: EProxyLBRedirectStatusCode(301),
    60  	Found:            EProxyLBRedirectStatusCode(302),
    61  }
    62  
    63  func ProxyLBRedirectStatusCodeStrings() []string {
    64  	return []string{
    65  		ProxyLBRedirectStatusCodes.MovedPermanently.String(),
    66  		ProxyLBRedirectStatusCodes.Found.String(),
    67  	}
    68  }
    69  
    70  // EProxyLBFixedStatusCode エンハンスドロードバランサでのルール設定: 固定レスポンス時のステータスコード
    71  type EProxyLBFixedStatusCode StringNumber
    72  
    73  func (c EProxyLBFixedStatusCode) String() string {
    74  	return StringNumber(c).String()
    75  }
    76  
    77  func (c EProxyLBFixedStatusCode) Int() int {
    78  	return StringNumber(c).Int()
    79  }
    80  
    81  var ProxyLBFixedStatusCodes = struct {
    82  	OK                 EProxyLBFixedStatusCode
    83  	Forbidden          EProxyLBFixedStatusCode
    84  	ServiceUnavailable EProxyLBFixedStatusCode
    85  }{
    86  	OK:                 EProxyLBFixedStatusCode(200),
    87  	Forbidden:          EProxyLBFixedStatusCode(403),
    88  	ServiceUnavailable: EProxyLBFixedStatusCode(503),
    89  }
    90  
    91  func ProxyLBFixedStatusCodeStrings() []string {
    92  	return []string{
    93  		ProxyLBFixedStatusCodes.OK.String(),
    94  		ProxyLBFixedStatusCodes.Forbidden.String(),
    95  		ProxyLBFixedStatusCodes.ServiceUnavailable.String(),
    96  	}
    97  }
    98  
    99  // EProxyLBFixedContentType エンハンスドロードバランサでのルール設定: 固定レスポンス時のContent-Typeヘッダ
   100  type EProxyLBFixedContentType string
   101  
   102  func (t EProxyLBFixedContentType) String() string {
   103  	return string(t)
   104  }
   105  
   106  // ProxyLBFixedContentTypes エンハンスドロードバランサでのルール設定: 固定レスポンス時のContent-Typeヘッダ
   107  var ProxyLBFixedContentTypes = struct {
   108  	Plain      EProxyLBFixedContentType
   109  	HTML       EProxyLBFixedContentType
   110  	JavaScript EProxyLBFixedContentType
   111  	JSON       EProxyLBFixedContentType
   112  }{
   113  	Plain:      "text/plain",
   114  	HTML:       "text/html",
   115  	JavaScript: "application/javascript",
   116  	JSON:       "application/json",
   117  }
   118  
   119  // ProxyLBFixedContentTypeStrings 指定可能なContent-Typeリスト
   120  func ProxyLBFixedContentTypeStrings() []string {
   121  	return []string{
   122  		ProxyLBFixedContentTypes.Plain.String(),
   123  		ProxyLBFixedContentTypes.HTML.String(),
   124  		ProxyLBFixedContentTypes.JavaScript.String(),
   125  		ProxyLBFixedContentTypes.JSON.String(),
   126  	}
   127  }