gcp

package
v0.0.43 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2024 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMockIAMService

func NewMockIAMService(expectFn func(expect Expect)) *iamMock

Types

type CreateServiceAccountKeyRequest

type CreateServiceAccountKeyRequest interface {
	With(keyRequest iam.CreateServiceAccountKeyRequest) CreateServiceAccountKeyRequest
	Returns(key iam.ServiceAccountKey) CreateServiceAccountKeyRequest
	Request
}

create key

type DeleteServiceAccountKeyRequest

type DeleteServiceAccountKeyRequest interface {
	Returns() DeleteServiceAccountKeyRequest
	Request
}

Delete key

type DisableServiceAccountKeyRequest

type DisableServiceAccountKeyRequest interface {
	With(keyRequest iam.DisableServiceAccountKeyRequest) DisableServiceAccountKeyRequest
	Returns() DisableServiceAccountKeyRequest
	Request
}

Disable key

type Expect

type Expect interface {
	// CreateServiceAccountKey configures the mock to expect a request to create a service account key
	CreateServiceAccountKey(project string, serviceAccountEmail string) CreateServiceAccountKeyRequest
	// GetServiceAccountKey configures the mock to expect a request to get a service account key
	GetServiceAccountKey(project string, serviceAccountEmail string, keyId string) GetServiceAccountKeyRequest
	// DisableServiceAccountKey configures the mock to expect a request to disable a service account key
	DisableServiceAccountKey(project string, serviceAccountEmail string, keyId string) DisableServiceAccountKeyRequest
	// DeleteServiceAccountKey configures the mock to expect a request that deletes a service account key
	DeleteServiceAccountKey(project string, serviceAccountEmail string, keyId string) DeleteServiceAccountKeyRequest
}

Expect is an interface for setting expectations on a mock iam.Service

type GetServiceAccountKeyRequest

type GetServiceAccountKeyRequest interface {
	Returns(key iam.ServiceAccountKey) GetServiceAccountKeyRequest
	Request
}

get key

type Mock

type Mock interface {
	// Setup enables httpmock
	Setup()
	// Verify verifies that all expectations on the mock client were met
	AssertExpectations(t *testing.T) bool
	// Cleanup disables httpmock
	Cleanup()
}

type Request

type Request interface {
	// RequestBody requires that any requests matching the url pattern have the given response body (marshalled to JSON)
	RequestBody(requestBody interface{}) Request
	// Status sets status for the mock response (default 200 for requests without a body, 201 for requests with a body)
	Status(status int)
	// CallCount sets the expected about of calls for the mocked request (
	CallCount(callcount int)
	// CallCount sets the expected about of calls for the mocked request (
	Error(error *googleapi.Error)
	// ResponseBody sets the body for the mock response (marshalled to JSON)
	ResponseBody(responseBody interface{}) Request
	// Times sets the number of times this request should be expected
	Times(callCount int) Request
	// contains filtered or unexported methods
}

Request encapsulates a mocked GCP API request & response

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL