本文整理汇总了Golang中github.com/Azure/go-autorest/autorest/to.String函数的典型用法代码示例。如果您正苦于以下问题:Golang String函数的具体用法?Golang String怎么用?Golang String使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了String函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: RegisterResourceProviders
// RegisterResourceProviders registers current subscription to the specified
// resource provider namespaces if they are not already registered. Namespaces
// are case-insensitive.
func (a AzureClient) RegisterResourceProviders(namespaces ...string) error {
l, err := a.providersClient().List(nil)
if err != nil {
return err
}
if l.Value == nil {
return errors.New("Resource Providers list is returned as nil.")
}
m := make(map[string]bool)
for _, p := range *l.Value {
m[strings.ToLower(to.String(p.Namespace))] = to.String(p.RegistrationState) == "Registered"
}
for _, ns := range namespaces {
registered, ok := m[strings.ToLower(ns)]
if !ok {
return fmt.Errorf("Unknown resource provider %q", ns)
}
if registered {
log.Debugf("Already registered for %q", ns)
} else {
log.Info("Registering subscription to resource provider.", logutil.Fields{
"ns": ns,
"subs": a.subscriptionID,
})
if _, err := a.providersClient().Register(ns); err != nil {
return err
}
}
}
return nil
}
示例2: detachVolume
func (v *azureVolumeSource) detachVolume(
vm *compute.VirtualMachine,
p storage.VolumeAttachmentParams,
storageAccount *armstorage.Account,
) (updated bool) {
dataDisksRoot := dataDiskVhdRoot(storageAccount)
dataDiskName := p.VolumeId
vhdURI := dataDisksRoot + dataDiskName + vhdExtension
var dataDisks []compute.DataDisk
if vm.Properties.StorageProfile.DataDisks != nil {
dataDisks = *vm.Properties.StorageProfile.DataDisks
}
for i, disk := range dataDisks {
if to.String(disk.Name) != p.VolumeId {
continue
}
if to.String(disk.Vhd.URI) != vhdURI {
continue
}
dataDisks = append(dataDisks[:i], dataDisks[i+1:]...)
if len(dataDisks) == 0 {
vm.Properties.StorageProfile.DataDisks = nil
} else {
*vm.Properties.StorageProfile.DataDisks = dataDisks
}
return true
}
return false
}
示例3: findStorageAccount
func (a AzureClient) findStorageAccount(resourceGroup, location, prefix string, storageType storage.AccountType) (*storage.AccountProperties, error) {
f := logutil.Fields{
"type": storageType,
"prefix": prefix,
"location": location}
log.Debug("Querying existing storage accounts.", f)
l, err := a.storageAccountsClient().ListByResourceGroup(resourceGroup)
if err != nil {
return nil, err
}
if l.Value != nil {
for _, v := range *l.Value {
log.Debug("Iterating...", logutil.Fields{
"name": to.String(v.Name),
"type": storageType,
"location": to.String(v.Location),
})
if to.String(v.Location) == location && v.Properties.AccountType == storageType && strings.HasPrefix(to.String(v.Name), prefix) {
log.Debug("Found eligible storage account.", logutil.Fields{"name": to.String(v.Name)})
return v.Properties, nil
}
}
}
log.Debug("No account matching the pattern is found.", f)
return nil, err
}
示例4: Addresses
// Addresses is specified in the Instance interface.
func (inst *azureInstance) Addresses() ([]jujunetwork.Address, error) {
addresses := make([]jujunetwork.Address, 0, len(inst.networkInterfaces)+len(inst.publicIPAddresses))
for _, nic := range inst.networkInterfaces {
if nic.Properties.IPConfigurations == nil {
continue
}
for _, ipConfiguration := range *nic.Properties.IPConfigurations {
privateIpAddress := ipConfiguration.Properties.PrivateIPAddress
if privateIpAddress == nil {
continue
}
addresses = append(addresses, jujunetwork.NewScopedAddress(
to.String(privateIpAddress),
jujunetwork.ScopeCloudLocal,
))
}
}
for _, pip := range inst.publicIPAddresses {
if pip.Properties.IPAddress == nil {
continue
}
addresses = append(addresses, jujunetwork.NewScopedAddress(
to.String(pip.Properties.IPAddress),
jujunetwork.ScopePublic,
))
}
return addresses, nil
}
示例5: NodeResourcesPreparer
// NodeResourcesPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client NodeResources) NodeResourcesPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
示例6: ManagementLockListResultPreparer
// ManagementLockListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client ManagementLockListResult) ManagementLockListResultPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
示例7: SharedAccessSignatureAuthorizationRuleListResultPreparer
// SharedAccessSignatureAuthorizationRuleListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client SharedAccessSignatureAuthorizationRuleListResult) SharedAccessSignatureAuthorizationRuleListResultPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
示例8: EventHubConsumerGroupsListResultPreparer
// EventHubConsumerGroupsListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client EventHubConsumerGroupsListResult) EventHubConsumerGroupsListResultPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
示例9: VirtualMachineScaleSetVMListResultPreparer
// VirtualMachineScaleSetVMListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist
func (client VirtualMachineScaleSetVMListResult) VirtualMachineScaleSetVMListResultPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
示例10: ResponseWithContinuationVirtualNetworkPreparer
// ResponseWithContinuationVirtualNetworkPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client ResponseWithContinuationVirtualNetwork) ResponseWithContinuationVirtualNetworkPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
示例11: ClassicAdministratorListResultPreparer
// ClassicAdministratorListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client ClassicAdministratorListResult) ClassicAdministratorListResultPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
示例12: OperationResultCollectionPreparer
// OperationResultCollectionPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client OperationResultCollection) OperationResultCollectionPreparer() (*http.Request, error) {
if client.Nextlink == nil || len(to.String(client.Nextlink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.Nextlink)))
}
示例13: ProviderOperationsMetadataListResultPreparer
// ProviderOperationsMetadataListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client ProviderOperationsMetadataListResult) ProviderOperationsMetadataListResultPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
示例14: StatusesDefaultPreparer
// StatusesDefaultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client StatusesDefault) StatusesDefaultPreparer() (*http.Request, error) {
if client.Nextlink == nil || len(to.String(client.Nextlink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.Nextlink)))
}
示例15: WorkflowTriggerHistoryListResultPreparer
// WorkflowTriggerHistoryListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client WorkflowTriggerHistoryListResult) WorkflowTriggerHistoryListResultPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}