本文整理汇总了Golang中github.com/juju/juju/provider/azure/internal/azuretesting.NewSenderWithValue函数的典型用法代码示例。如果您正苦于以下问题:Golang NewSenderWithValue函数的具体用法?Golang NewSenderWithValue怎么用?Golang NewSenderWithValue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewSenderWithValue函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: getInstances
func (s *instanceSuite) getInstances(c *gc.C, ids ...instance.Id) []instance.Instance {
nicsSender := azuretesting.NewSenderWithValue(&network.InterfaceListResult{
Value: &s.networkInterfaces,
})
nicsSender.PathPattern = ".*/networkInterfaces"
vmsSender := azuretesting.NewSenderWithValue(&compute.VirtualMachineListResult{
Value: &s.virtualMachines,
})
vmsSender.PathPattern = ".*/virtualMachines"
pipsSender := azuretesting.NewSenderWithValue(&network.PublicIPAddressListResult{
Value: &s.publicIPAddresses,
})
pipsSender.PathPattern = ".*/publicIPAddresses"
s.sender = azuretesting.Senders{nicsSender, vmsSender, pipsSender}
instances, err := s.env.Instances(ids)
c.Assert(err, jc.ErrorIsNil)
s.sender = azuretesting.Senders{}
s.requests = nil
return instances
}
示例2: getInstancesSender
func (s *instanceSuite) getInstancesSender() azuretesting.Senders {
deploymentsSender := azuretesting.NewSenderWithValue(&resources.DeploymentListResult{
Value: &s.deployments,
})
deploymentsSender.PathPattern = ".*/deployments"
nicsSender := azuretesting.NewSenderWithValue(&network.InterfaceListResult{
Value: &s.networkInterfaces,
})
nicsSender.PathPattern = ".*/networkInterfaces"
pipsSender := azuretesting.NewSenderWithValue(&network.PublicIPAddressListResult{
Value: &s.publicIPAddresses,
})
pipsSender.PathPattern = ".*/publicIPAddresses"
return azuretesting.Senders{deploymentsSender, nicsSender, pipsSender}
}
示例3: deviceCodeSender
func deviceCodeSender() autorest.Sender {
return azuretesting.NewSenderWithValue(azure.DeviceCode{
DeviceCode: to.StringPtr("device-code"),
Interval: to.Int64Ptr(1), // 1 second between polls
Message: to.StringPtr("open your browser, etc."),
})
}
示例4: passwordCredentialsListSender
func passwordCredentialsListSender() autorest.Sender {
return azuretesting.NewSenderWithValue(ad.PasswordCredentialsListResult{
Value: []ad.PasswordCredential{{
KeyId: "password-credential-key-id",
}},
})
}
示例5: servicePrincipalListSender
func servicePrincipalListSender() autorest.Sender {
return azuretesting.NewSenderWithValue(ad.ServicePrincipalListResult{
Value: []ad.ServicePrincipal{{
ApplicationID: "cbb548f1-5039-4836-af0b-727e8571f6a9",
ObjectID: "sp-object-id",
}},
})
}
示例6: tokenRefreshSender
func tokenRefreshSender() *azuretesting.MockSender {
tokenRefreshSender := azuretesting.NewSenderWithValue(&autorestazure.Token{
AccessToken: "access-token",
ExpiresOn: fmt.Sprint(time.Now().Add(time.Hour).Unix()),
Type: "Bearer",
})
tokenRefreshSender.PathPattern = ".*/oauth2/token"
return tokenRefreshSender
}
示例7: networkSecurityGroupSender
func networkSecurityGroupSender(rules []network.SecurityRule) *azuretesting.MockSender {
nsgSender := azuretesting.NewSenderWithValue(&network.SecurityGroup{
Properties: &network.SecurityGroupPropertiesFormat{
SecurityRules: &rules,
},
})
nsgSender.PathPattern = ".*/networkSecurityGroups/juju-internal"
return nsgSender
}
示例8: roleDefinitionListSender
func roleDefinitionListSender() autorest.Sender {
roleDefinitions := []authorization.RoleDefinition{{
ID: to.StringPtr("owner-role-id"),
Name: to.StringPtr("Owner"),
}}
return azuretesting.NewSenderWithValue(authorization.RoleDefinitionListResult{
Value: &roleDefinitions,
})
}
示例9: accountKeysSender
func (s *storageSuite) accountKeysSender() *azuretesting.MockSender {
keys := []armstorage.AccountKey{{
KeyName: to.StringPtr(fakeStorageAccountKey + "-name"),
Value: to.StringPtr(fakeStorageAccountKey),
Permissions: armstorage.FULL,
}, {
KeyName: to.StringPtr("key2-name"),
Value: to.StringPtr("key2"),
Permissions: armstorage.FULL,
}}
result := armstorage.AccountListKeysResult{Keys: &keys}
keysSender := azuretesting.NewSenderWithValue(&result)
keysSender.PathPattern = ".*/storageAccounts/.*/listKeys"
return keysSender
}
示例10: accountSender
func (s *storageSuite) accountSender() *azuretesting.MockSender {
envTags := map[string]*string{
"juju-model-uuid": to.StringPtr(testing.ModelTag.Id()),
}
account := armstorage.Account{
Name: to.StringPtr(storageAccountName),
Type: to.StringPtr("Standard_LRS"),
Tags: &envTags,
Properties: &armstorage.AccountProperties{
PrimaryEndpoints: &armstorage.Endpoints{
Blob: to.StringPtr(fmt.Sprintf("https://%s.blob.storage.azurestack.local/", storageAccountName)),
},
},
}
accountSender := azuretesting.NewSenderWithValue(account)
accountSender.PathPattern = ".*/storageAccounts/" + storageAccountName + ".*"
return accountSender
}
示例11: makeSender
func (s *environSuite) makeSender(pattern string, v interface{}) *azuretesting.MockSender {
sender := azuretesting.NewSenderWithValue(v)
sender.PathPattern = pattern
return sender
}
示例12: createServicePrincipalSender
func createServicePrincipalSender() autorest.Sender {
return azuretesting.NewSenderWithValue(ad.ServicePrincipal{
ApplicationID: "cbb548f1-5039-4836-af0b-727e8571f6a9",
ObjectID: "sp-object-id",
})
}
示例13: currentUserSender
func currentUserSender() autorest.Sender {
return azuretesting.NewSenderWithValue(ad.AADObject{
DisplayName: "Foo Bar",
})
}
示例14: tokenSender
func tokenSender() autorest.Sender {
return azuretesting.NewSenderWithValue(azure.Token{
RefreshToken: "refresh-token",
ExpiresOn: fmt.Sprint(time.Now().Add(time.Hour).Unix()),
})
}
示例15: roleAssignmentSender
func roleAssignmentSender() autorest.Sender {
return azuretesting.NewSenderWithValue(authorization.RoleAssignment{})
}