github.com/hashicorp/hcp-sdk-go@v0.94.0/clients/cloud-iam/stable/2019-12-10/client/cloud_iam_client.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package client
     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  	"github.com/go-openapi/runtime"
    10  	httptransport "github.com/go-openapi/runtime/client"
    11  	"github.com/go-openapi/strfmt"
    12  
    13  	"github.com/hashicorp/hcp-sdk-go/clients/cloud-iam/stable/2019-12-10/client/auth_config_service"
    14  	"github.com/hashicorp/hcp-sdk-go/clients/cloud-iam/stable/2019-12-10/client/groups_service"
    15  	"github.com/hashicorp/hcp-sdk-go/clients/cloud-iam/stable/2019-12-10/client/iam_service"
    16  	"github.com/hashicorp/hcp-sdk-go/clients/cloud-iam/stable/2019-12-10/client/invitations_service"
    17  	"github.com/hashicorp/hcp-sdk-go/clients/cloud-iam/stable/2019-12-10/client/profile_service"
    18  	"github.com/hashicorp/hcp-sdk-go/clients/cloud-iam/stable/2019-12-10/client/s_s_o_management_service"
    19  	"github.com/hashicorp/hcp-sdk-go/clients/cloud-iam/stable/2019-12-10/client/service_principals_service"
    20  )
    21  
    22  // Default cloud iam HTTP client.
    23  var Default = NewHTTPClient(nil)
    24  
    25  const (
    26  	// DefaultHost is the default Host
    27  	// found in Meta (info) section of spec file
    28  	DefaultHost string = "api.cloud.hashicorp.com"
    29  	// DefaultBasePath is the default BasePath
    30  	// found in Meta (info) section of spec file
    31  	DefaultBasePath string = "/"
    32  )
    33  
    34  // DefaultSchemes are the default schemes found in Meta (info) section of spec file
    35  var DefaultSchemes = []string{"http"}
    36  
    37  // NewHTTPClient creates a new cloud iam HTTP client.
    38  func NewHTTPClient(formats strfmt.Registry) *CloudIam {
    39  	return NewHTTPClientWithConfig(formats, nil)
    40  }
    41  
    42  // NewHTTPClientWithConfig creates a new cloud iam HTTP client,
    43  // using a customizable transport config.
    44  func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *CloudIam {
    45  	// ensure nullable parameters have default
    46  	if cfg == nil {
    47  		cfg = DefaultTransportConfig()
    48  	}
    49  
    50  	// create transport and client
    51  	transport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes)
    52  	return New(transport, formats)
    53  }
    54  
    55  // New creates a new cloud iam client
    56  func New(transport runtime.ClientTransport, formats strfmt.Registry) *CloudIam {
    57  	// ensure nullable parameters have default
    58  	if formats == nil {
    59  		formats = strfmt.Default
    60  	}
    61  
    62  	cli := new(CloudIam)
    63  	cli.Transport = transport
    64  	cli.AuthConfigService = auth_config_service.New(transport, formats)
    65  	cli.GroupsService = groups_service.New(transport, formats)
    66  	cli.IamService = iam_service.New(transport, formats)
    67  	cli.InvitationsService = invitations_service.New(transport, formats)
    68  	cli.ProfileService = profile_service.New(transport, formats)
    69  	cli.SsoManagementService = s_s_o_management_service.New(transport, formats)
    70  	cli.ServicePrincipalsService = service_principals_service.New(transport, formats)
    71  	return cli
    72  }
    73  
    74  // DefaultTransportConfig creates a TransportConfig with the
    75  // default settings taken from the meta section of the spec file.
    76  func DefaultTransportConfig() *TransportConfig {
    77  	return &TransportConfig{
    78  		Host:     DefaultHost,
    79  		BasePath: DefaultBasePath,
    80  		Schemes:  DefaultSchemes,
    81  	}
    82  }
    83  
    84  // TransportConfig contains the transport related info,
    85  // found in the meta section of the spec file.
    86  type TransportConfig struct {
    87  	Host     string
    88  	BasePath string
    89  	Schemes  []string
    90  }
    91  
    92  // WithHost overrides the default host,
    93  // provided by the meta section of the spec file.
    94  func (cfg *TransportConfig) WithHost(host string) *TransportConfig {
    95  	cfg.Host = host
    96  	return cfg
    97  }
    98  
    99  // WithBasePath overrides the default basePath,
   100  // provided by the meta section of the spec file.
   101  func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig {
   102  	cfg.BasePath = basePath
   103  	return cfg
   104  }
   105  
   106  // WithSchemes overrides the default schemes,
   107  // provided by the meta section of the spec file.
   108  func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig {
   109  	cfg.Schemes = schemes
   110  	return cfg
   111  }
   112  
   113  // CloudIam is a client for cloud iam
   114  type CloudIam struct {
   115  	AuthConfigService auth_config_service.ClientService
   116  
   117  	GroupsService groups_service.ClientService
   118  
   119  	IamService iam_service.ClientService
   120  
   121  	InvitationsService invitations_service.ClientService
   122  
   123  	ProfileService profile_service.ClientService
   124  
   125  	SsoManagementService s_s_o_management_service.ClientService
   126  
   127  	ServicePrincipalsService service_principals_service.ClientService
   128  
   129  	Transport runtime.ClientTransport
   130  }
   131  
   132  // SetTransport changes the transport on the client and all its subresources
   133  func (c *CloudIam) SetTransport(transport runtime.ClientTransport) {
   134  	c.Transport = transport
   135  	c.AuthConfigService.SetTransport(transport)
   136  	c.GroupsService.SetTransport(transport)
   137  	c.IamService.SetTransport(transport)
   138  	c.InvitationsService.SetTransport(transport)
   139  	c.ProfileService.SetTransport(transport)
   140  	c.SsoManagementService.SetTransport(transport)
   141  	c.ServicePrincipalsService.SetTransport(transport)
   142  }