github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/mono/mono_client/tiers/tiers_client.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package tiers
     4  
     5  // This file was generated by the swagger tool.
     6  // Editing this file might prove futile when you re-run the swagger generate command
     7  
     8  import (
     9  	"fmt"
    10  
    11  	"github.com/go-openapi/runtime"
    12  	"github.com/go-openapi/strfmt"
    13  )
    14  
    15  // New creates a new tiers API client.
    16  func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
    17  	return &Client{transport: transport, formats: formats}
    18  }
    19  
    20  /*
    21  Client for tiers API
    22  */
    23  type Client struct {
    24  	transport runtime.ClientTransport
    25  	formats   strfmt.Registry
    26  }
    27  
    28  // ClientOption is the option for Client methods
    29  type ClientOption func(*runtime.ClientOperation)
    30  
    31  // ClientService is the interface for Client methods
    32  type ClientService interface {
    33  	GetAddOns(params *GetAddOnsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAddOnsOK, error)
    34  
    35  	GetTiers(params *GetTiersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTiersOK, error)
    36  
    37  	GetTiersPricing(params *GetTiersPricingParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTiersPricingOK, error)
    38  
    39  	SetAddOnDefault(params *SetAddOnDefaultParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*SetAddOnDefaultOK, error)
    40  
    41  	SetTransport(transport runtime.ClientTransport)
    42  }
    43  
    44  /*
    45    GetAddOns gets information about all available add ons
    46  */
    47  func (a *Client) GetAddOns(params *GetAddOnsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAddOnsOK, error) {
    48  	// TODO: Validate the params before sending
    49  	if params == nil {
    50  		params = NewGetAddOnsParams()
    51  	}
    52  	op := &runtime.ClientOperation{
    53  		ID:                 "getAddOns",
    54  		Method:             "GET",
    55  		PathPattern:        "/addons",
    56  		ProducesMediaTypes: []string{"application/json"},
    57  		ConsumesMediaTypes: []string{"application/json"},
    58  		Schemes:            []string{"http", "https"},
    59  		Params:             params,
    60  		Reader:             &GetAddOnsReader{formats: a.formats},
    61  		AuthInfo:           authInfo,
    62  		Context:            params.Context,
    63  		Client:             params.HTTPClient,
    64  	}
    65  	for _, opt := range opts {
    66  		opt(op)
    67  	}
    68  
    69  	result, err := a.transport.Submit(op)
    70  	if err != nil {
    71  		return nil, err
    72  	}
    73  	success, ok := result.(*GetAddOnsOK)
    74  	if ok {
    75  		return success, nil
    76  	}
    77  	// unexpected success response
    78  	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
    79  	msg := fmt.Sprintf("unexpected success response for getAddOns: API contract not enforced by server. Client expected to get an error, but got: %T", result)
    80  	panic(msg)
    81  }
    82  
    83  /*
    84    GetTiers gets information about all available tiers
    85  */
    86  func (a *Client) GetTiers(params *GetTiersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTiersOK, error) {
    87  	// TODO: Validate the params before sending
    88  	if params == nil {
    89  		params = NewGetTiersParams()
    90  	}
    91  	op := &runtime.ClientOperation{
    92  		ID:                 "getTiers",
    93  		Method:             "GET",
    94  		PathPattern:        "/tiers",
    95  		ProducesMediaTypes: []string{"application/json"},
    96  		ConsumesMediaTypes: []string{"application/json"},
    97  		Schemes:            []string{"http", "https"},
    98  		Params:             params,
    99  		Reader:             &GetTiersReader{formats: a.formats},
   100  		AuthInfo:           authInfo,
   101  		Context:            params.Context,
   102  		Client:             params.HTTPClient,
   103  	}
   104  	for _, opt := range opts {
   105  		opt(op)
   106  	}
   107  
   108  	result, err := a.transport.Submit(op)
   109  	if err != nil {
   110  		return nil, err
   111  	}
   112  	success, ok := result.(*GetTiersOK)
   113  	if ok {
   114  		return success, nil
   115  	}
   116  	// unexpected success response
   117  	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
   118  	msg := fmt.Sprintf("unexpected success response for getTiers: API contract not enforced by server. Client expected to get an error, but got: %T", result)
   119  	panic(msg)
   120  }
   121  
   122  /*
   123    GetTiersPricing gets information about all available tiers including their price in dollars per active runtime per year
   124  */
   125  func (a *Client) GetTiersPricing(params *GetTiersPricingParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTiersPricingOK, error) {
   126  	// TODO: Validate the params before sending
   127  	if params == nil {
   128  		params = NewGetTiersPricingParams()
   129  	}
   130  	op := &runtime.ClientOperation{
   131  		ID:                 "getTiersPricing",
   132  		Method:             "GET",
   133  		PathPattern:        "/tiers/pricing",
   134  		ProducesMediaTypes: []string{"application/json"},
   135  		ConsumesMediaTypes: []string{"application/json"},
   136  		Schemes:            []string{"http", "https"},
   137  		Params:             params,
   138  		Reader:             &GetTiersPricingReader{formats: a.formats},
   139  		AuthInfo:           authInfo,
   140  		Context:            params.Context,
   141  		Client:             params.HTTPClient,
   142  	}
   143  	for _, opt := range opts {
   144  		opt(op)
   145  	}
   146  
   147  	result, err := a.transport.Submit(op)
   148  	if err != nil {
   149  		return nil, err
   150  	}
   151  	success, ok := result.(*GetTiersPricingOK)
   152  	if ok {
   153  		return success, nil
   154  	}
   155  	// unexpected success response
   156  	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
   157  	msg := fmt.Sprintf("unexpected success response for getTiersPricing: API contract not enforced by server. Client expected to get an error, but got: %T", result)
   158  	panic(msg)
   159  }
   160  
   161  /*
   162    SetAddOnDefault sets default state of add on for a tier
   163  */
   164  func (a *Client) SetAddOnDefault(params *SetAddOnDefaultParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*SetAddOnDefaultOK, error) {
   165  	// TODO: Validate the params before sending
   166  	if params == nil {
   167  		params = NewSetAddOnDefaultParams()
   168  	}
   169  	op := &runtime.ClientOperation{
   170  		ID:                 "setAddOnDefault",
   171  		Method:             "POST",
   172  		PathPattern:        "/addons/{tierName}",
   173  		ProducesMediaTypes: []string{"application/json"},
   174  		ConsumesMediaTypes: []string{"application/json"},
   175  		Schemes:            []string{"http", "https"},
   176  		Params:             params,
   177  		Reader:             &SetAddOnDefaultReader{formats: a.formats},
   178  		AuthInfo:           authInfo,
   179  		Context:            params.Context,
   180  		Client:             params.HTTPClient,
   181  	}
   182  	for _, opt := range opts {
   183  		opt(op)
   184  	}
   185  
   186  	result, err := a.transport.Submit(op)
   187  	if err != nil {
   188  		return nil, err
   189  	}
   190  	success, ok := result.(*SetAddOnDefaultOK)
   191  	if ok {
   192  		return success, nil
   193  	}
   194  	// unexpected success response
   195  	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
   196  	msg := fmt.Sprintf("unexpected success response for setAddOnDefault: API contract not enforced by server. Client expected to get an error, but got: %T", result)
   197  	panic(msg)
   198  }
   199  
   200  // SetTransport changes the transport on the client
   201  func (a *Client) SetTransport(transport runtime.ClientTransport) {
   202  	a.transport = transport
   203  }