当前位置: 首页>>代码示例>>Golang>>正文


Golang azuretesting.NewSenderWithValue函数代码示例

本文整理汇总了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
}
开发者ID:imoapps,项目名称:juju,代码行数:25,代码来源:instance_test.go

示例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}
}
开发者ID:bac,项目名称:juju,代码行数:15,代码来源:instance_test.go

示例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."),
	})
}
开发者ID:bac,项目名称:juju,代码行数:7,代码来源:interactive_test.go

示例4: passwordCredentialsListSender

func passwordCredentialsListSender() autorest.Sender {
	return azuretesting.NewSenderWithValue(ad.PasswordCredentialsListResult{
		Value: []ad.PasswordCredential{{
			KeyId: "password-credential-key-id",
		}},
	})
}
开发者ID:bac,项目名称:juju,代码行数:7,代码来源:interactive_test.go

示例5: servicePrincipalListSender

func servicePrincipalListSender() autorest.Sender {
	return azuretesting.NewSenderWithValue(ad.ServicePrincipalListResult{
		Value: []ad.ServicePrincipal{{
			ApplicationID: "cbb548f1-5039-4836-af0b-727e8571f6a9",
			ObjectID:      "sp-object-id",
		}},
	})
}
开发者ID:bac,项目名称:juju,代码行数:8,代码来源:interactive_test.go

示例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
}
开发者ID:bac,项目名称:juju,代码行数:9,代码来源:environ_test.go

示例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
}
开发者ID:imoapps,项目名称:juju,代码行数:9,代码来源:instance_test.go

示例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,
	})
}
开发者ID:bac,项目名称:juju,代码行数:9,代码来源:interactive_test.go

示例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
}
开发者ID:bac,项目名称:juju,代码行数:15,代码来源:storage_test.go

示例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
}
开发者ID:bac,项目名称:juju,代码行数:18,代码来源:storage_test.go

示例11: makeSender

func (s *environSuite) makeSender(pattern string, v interface{}) *azuretesting.MockSender {
	sender := azuretesting.NewSenderWithValue(v)
	sender.PathPattern = pattern
	return sender
}
开发者ID:bac,项目名称:juju,代码行数:5,代码来源:environ_test.go

示例12: createServicePrincipalSender

func createServicePrincipalSender() autorest.Sender {
	return azuretesting.NewSenderWithValue(ad.ServicePrincipal{
		ApplicationID: "cbb548f1-5039-4836-af0b-727e8571f6a9",
		ObjectID:      "sp-object-id",
	})
}
开发者ID:bac,项目名称:juju,代码行数:6,代码来源:interactive_test.go

示例13: currentUserSender

func currentUserSender() autorest.Sender {
	return azuretesting.NewSenderWithValue(ad.AADObject{
		DisplayName: "Foo Bar",
	})
}
开发者ID:bac,项目名称:juju,代码行数:5,代码来源:interactive_test.go

示例14: tokenSender

func tokenSender() autorest.Sender {
	return azuretesting.NewSenderWithValue(azure.Token{
		RefreshToken: "refresh-token",
		ExpiresOn:    fmt.Sprint(time.Now().Add(time.Hour).Unix()),
	})
}
开发者ID:bac,项目名称:juju,代码行数:6,代码来源:interactive_test.go

示例15: roleAssignmentSender

func roleAssignmentSender() autorest.Sender {
	return azuretesting.NewSenderWithValue(authorization.RoleAssignment{})
}
开发者ID:bac,项目名称:juju,代码行数:3,代码来源:interactive_test.go


注:本文中的github.com/juju/juju/provider/azure/internal/azuretesting.NewSenderWithValue函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。