本文整理匯總了Golang中k8s/io/kubernetes/federation/pkg/dnsprovider.ResourceRecordSets類的典型用法代碼示例。如果您正苦於以下問題:Golang ResourceRecordSets類的具體用法?Golang ResourceRecordSets怎麽用?Golang ResourceRecordSets使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了ResourceRecordSets類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: addRrsetOrFail
func addRrsetOrFail(t *testing.T, rrsets dnsprovider.ResourceRecordSets, rrset dnsprovider.ResourceRecordSet) dnsprovider.ResourceRecordSet {
result, err := rrsets.Add(rrset)
if err != nil {
t.Fatalf("Failed to add recordsets: %v", err)
}
return result
}
示例2: getRrOrFail
func getRrOrFail(t *testing.T, rrsets dnsprovider.ResourceRecordSets, name string) dnsprovider.ResourceRecordSet {
rrset, err := rrsets.Get(name)
if err != nil {
t.Fatalf("Failed to get recordset: %v", err)
} else if rrset == nil {
t.Logf("Did not Get recordset: %v", name)
} else {
t.Logf("Got recordset: %v", rrset.Name())
}
return rrset
}
示例3: listRrsOrFail
func listRrsOrFail(t *testing.T, rrsets dnsprovider.ResourceRecordSets) []dnsprovider.ResourceRecordSet {
rrset, err := rrsets.List()
if err != nil {
t.Fatalf("Failed to list recordsets: %v", err)
} else {
if len(rrset) < 0 {
t.Fatalf("Record set length=%d, expected >=0", len(rrset))
} else {
t.Logf("Got %d recordsets: %v", len(rrset), rrset)
}
}
return rrset
}
示例4: getRrset
/* getRrset is a hack around the fact that dnsprovider.ResourceRecordSets interface does not yet include a Get() method, only a List() method. TODO: Fix that.
Note that if the named resource record set does not exist, but no error occurred, the returned set, and error, are both nil
*/
func getRrset(dnsName string, rrsetsInterface dnsprovider.ResourceRecordSets) (dnsprovider.ResourceRecordSet, error) {
var returnVal dnsprovider.ResourceRecordSet
rrsets, err := rrsetsInterface.List()
if err != nil {
return nil, err
}
for _, rrset := range rrsets {
if rrset.Name() == dnsName {
returnVal = rrset
break
}
}
return returnVal, nil
}
示例5: addRrsetOrFail
func addRrsetOrFail(t *testing.T, rrsets dnsprovider.ResourceRecordSets, rrset dnsprovider.ResourceRecordSet) {
err := rrsets.StartChangeset().Add(rrset).Apply()
if err != nil {
t.Fatalf("Failed to add recordsets: %v", err)
}
}
示例6: getRrset
// Note that if the named resource record set does not exist, but no error occurred, the returned set, and error, are both nil
func getRrset(dnsName string, rrsetsInterface dnsprovider.ResourceRecordSets) (dnsprovider.ResourceRecordSet, error) {
return rrsetsInterface.Get(dnsName)
}