當前位置: 首頁>>代碼示例>>Golang>>正文


Golang dnsprovider.ResourceRecordSet類代碼示例

本文整理匯總了Golang中k8s/io/kubernetes/federation/pkg/dnsprovider.ResourceRecordSet的典型用法代碼示例。如果您正苦於以下問題:Golang ResourceRecordSet類的具體用法?Golang ResourceRecordSet怎麽用?Golang ResourceRecordSet使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了ResourceRecordSet類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: Remove

func (rrsets ResourceRecordSets) Remove(rrset dnsprovider.ResourceRecordSet) error {
	input := getChangeResourceRecordSetsInput("DELETE", rrset.Name(), string(rrset.Type()), *rrset.(ResourceRecordSet).rrsets.zone.impl.Id, rrset.Rrdatas(), rrset.Ttl())
	_, err := rrsets.zone.zones.interface_.service.ChangeResourceRecordSets(input)
	if err != nil {
		// Cast err to awserr.Error to get the Code and
		// Message from an error.
		return err
	}
	return nil
}
開發者ID:Rushit,項目名稱:kubernetes,代碼行數:10,代碼來源:rrsets.go

示例2: Add

func (rrsets ResourceRecordSets) Add(rrset dnsprovider.ResourceRecordSet) (dnsprovider.ResourceRecordSet, error) {
	service := rrsets.zone.zones.interface_.service
	input := getChangeResourceRecordSetsInput("CREATE", rrset.Name(), string(rrset.Type()), *rrset.(ResourceRecordSet).rrsets.zone.impl.Id, rrset.Rrdatas(), rrset.Ttl())
	_, err := service.ChangeResourceRecordSets(input)
	if err != nil {
		// Cast err to awserr.Error to get the Code and
		// Message from an error.
		return nil, err
	}
	return ResourceRecordSet{input.ChangeBatch.Changes[0].ResourceRecordSet, &rrsets}, nil
}
開發者ID:Rushit,項目名稱:kubernetes,代碼行數:11,代碼來源:rrsets.go

示例3: assertHasRecord

// assertHasRecord tests that rrsets has a record equivalent to rrset
func assertHasRecord(t *testing.T, rrsets dnsprovider.ResourceRecordSets, rrset dnsprovider.ResourceRecordSet) {
	var found dnsprovider.ResourceRecordSet
	for _, r := range listRrsOrFail(t, rrsets) {
		if r.Name() != rrset.Name() || r.Type() != rrset.Type() {
			continue
		}

		if found != nil {
			t.Errorf("found duplicate resource record set: %q and %q", r, found)
		}
		found = r
	}
	if found == nil {
		t.Errorf("resource record set %v not found", rrset)
	} else {
		assertEquivalent(t, found, rrset)
	}
}
開發者ID:humblec,項目名稱:kubernetes,代碼行數:19,代碼來源:commontests.go

示例4: buildChange

// buildChange converts a dnsprovider.ResourceRecordSet to a route53.Change request
func buildChange(action string, rrs dnsprovider.ResourceRecordSet) *route53.Change {
	change := &route53.Change{
		Action: aws.String(action),
		ResourceRecordSet: &route53.ResourceRecordSet{
			Name: aws.String(rrs.Name()),
			Type: aws.String(string(rrs.Type())),
			TTL:  aws.Int64(rrs.Ttl()),
		},
	}

	for _, rrdata := range rrs.Rrdatas() {
		rr := &route53.ResourceRecord{
			Value: aws.String(rrdata),
		}
		change.ResourceRecordSet.ResourceRecords = append(change.ResourceRecordSet.ResourceRecords, rr)
	}
	return change
}
開發者ID:CodeJuan,項目名稱:kubernetes,代碼行數:19,代碼來源:rrchangeset.go

示例5: assertEquivalent

// assertEquivalent tests that l is equal to r, for the methods in ResourceRecordSet
func assertEquivalent(t *testing.T, l, r dnsprovider.ResourceRecordSet) {
	if l.Name() != r.Name() {
		t.Errorf("resource record sets not equal %v vs %v", l, r)
	}
	if l.Type() != r.Type() {
		t.Errorf("resource record sets not equal %v vs %v", l, r)
	}
	if l.Ttl() != r.Ttl() {
		t.Errorf("resource record sets not equal %v vs %v", l, r)
	}
	if !reflect.DeepEqual(l.Rrdatas(), r.Rrdatas()) {
		t.Errorf("resource record sets not equal %v vs %v", l, r)
	}
}
開發者ID:humblec,項目名稱:kubernetes,代碼行數:15,代碼來源:commontests.go


注:本文中的k8s/io/kubernetes/federation/pkg/dnsprovider.ResourceRecordSet類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。