Documentation ¶
Index ¶
- func CreateEmptyHttpResponse(request *http.Request, statusCode int) (*http.Response, error)
- func CreateHttpResponseWithBody[T any](request *http.Request, statusCode int, body T) (*http.Response, error)
- func NewMockUserAgentPolicy(userAgent string) *mockUserAgentPolicy
- func ReadHttpBody(body io.ReadCloser, v any) error
- type MockContext
- type MockCredentials
- type MockMultiTenantCredentialProvider
- type MockSubscriptionCredentialProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateEmptyHttpResponse ¶
Creates a mocked HTTP response with the specified status code and no body
func CreateHttpResponseWithBody ¶
func CreateHttpResponseWithBody[T any](request *http.Request, statusCode int, body T) (*http.Response, error)
Creates a mocked HTTP response with the specified status code and body
func NewMockUserAgentPolicy ¶
func NewMockUserAgentPolicy(userAgent string) *mockUserAgentPolicy
func ReadHttpBody ¶
func ReadHttpBody(body io.ReadCloser, v any) error
ReadHttpBody reads the body of an HTTP request or response and converts it into the specified object
Types ¶
type MockContext ¶
type MockContext struct { Credentials *MockCredentials Context *context.Context Console *mockinput.MockConsole HttpClient *mockhttp.MockHttpClient CoreClientOptions *azcore.ClientOptions ArmClientOptions *arm.ClientOptions CommandRunner *mockexec.MockCommandRunner ConfigManager *mockconfig.MockConfigManager Container *ioc.NestedContainer AlphaFeaturesManager *alpha.FeatureManager SubscriptionCredentialProvider *MockSubscriptionCredentialProvider MultiTenantCredentialProvider *MockMultiTenantCredentialProvider Config config.Config Clock *clock.Mock }
func NewMockContext ¶
func NewMockContext(ctx context.Context) *MockContext
type MockCredentials ¶
type MockCredentials struct {
GetTokenFn func(ctx context.Context, options policy.TokenRequestOptions) (azcore.AccessToken, error)
}
func (*MockCredentials) GetToken ¶
func (c *MockCredentials) GetToken(ctx context.Context, options policy.TokenRequestOptions) (azcore.AccessToken, error)
type MockMultiTenantCredentialProvider ¶
type MockMultiTenantCredentialProvider struct {
TokenMap map[string]MockCredentials
}
func (*MockMultiTenantCredentialProvider) GetTokenCredential ¶
func (c *MockMultiTenantCredentialProvider) GetTokenCredential( ctx context.Context, tenantId string) (azcore.TokenCredential, error)
type MockSubscriptionCredentialProvider ¶
type MockSubscriptionCredentialProvider struct { }
func (*MockSubscriptionCredentialProvider) CredentialForSubscription ¶
func (scp *MockSubscriptionCredentialProvider) CredentialForSubscription( ctx context.Context, subscriptionId string, ) (azcore.TokenCredential, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.