@@ -300,14 +300,6 @@ func mapToStruct(data map[string]interface{}, target interface{}) {
300300 }
301301}
302302
303- func ExtractDomainFromID (id string ) (string , error ) {
304- parts := strings .Split (id , "/" )
305- if len (parts ) != 2 {
306- return "" , fmt .Errorf ("invalid ID format, expected 'projectID/domainName', got: %s" , id )
307- }
308- return parts [1 ], nil
309- }
310-
311303func getStatusTasks (ctx context.Context , api * domain.RegistrarAPI , taskID string ) (domain.TaskStatus , error ) {
312304 var page int32 = 1
313305 var pageSize uint32 = 1000
@@ -562,48 +554,6 @@ func flattenTldOffers(offers map[string]*domain.TldOffer) []map[string]interface
562554 return flattenedOffers
563555}
564556
565- func flattenExternalDomainRegistrationStatus (status * domain.DomainRegistrationStatusExternalDomain ) []string {
566- if status == nil {
567- return []string {}
568- }
569- return []string {status .ValidationToken }
570- }
571-
572- func flattenDNSZones (dnsZones []* domain.DNSZone ) []map [string ]interface {} {
573- if dnsZones == nil {
574- return nil
575- }
576-
577- var zones []map [string ]interface {}
578- for _ , zone := range dnsZones {
579- zones = append (zones , map [string ]interface {}{
580- "domain" : zone .Domain ,
581- "subdomain" : zone .Subdomain ,
582- "ns" : zone .Ns ,
583- "ns_default" : zone .NsDefault ,
584- "ns_master" : zone .NsMaster ,
585- "status" : zone .Status ,
586- "message" : zone .Message ,
587- "updated_at" : zone .UpdatedAt .Format (time .RFC3339 ),
588- "project_id" : zone .ProjectID ,
589- })
590- }
591-
592- return zones
593- }
594-
595- func flattenDomainRegistrationStatusTransfer (transferStatus * domain.DomainRegistrationStatusTransfer ) []string {
596- if transferStatus == nil {
597- return []string {}
598- }
599-
600- return []string {
601- string (transferStatus .Status ),
602- fmt .Sprintf ("%t" , transferStatus .VoteCurrentOwner ),
603- fmt .Sprintf ("%t" , transferStatus .VoteNewOwner ),
604- }
605- }
606-
607557func waitForTaskCompletion (ctx context.Context , registrarAPI * domain.RegistrarAPI , taskID string , duration int ) error {
608558 timeout := time .Duration (duration ) * time .Second
609559 return retry .RetryContext (ctx , timeout , func () * retry.RetryError {
@@ -628,45 +578,6 @@ func waitForTaskCompletion(ctx context.Context, registrarAPI *domain.RegistrarAP
628578 })
629579}
630580
631- func waitForUpdateDomainTaskCompletion (ctx context.Context , registrarAPI * domain.RegistrarAPI , domainName string , duration int ) ([]* domain.Task , error ) {
632- timeout := time .Duration (duration ) * time .Second
633- var completedTasks []* domain.Task
634-
635- err := retry .RetryContext (ctx , timeout , func () * retry.RetryError {
636- tasks , err := registrarAPI .ListTasks (& domain.RegistrarAPIListTasksRequest {
637- Domain : & domainName ,
638- }, scw .WithContext (ctx ), scw .WithAllPages ())
639- if err != nil {
640- return retry .NonRetryableError (fmt .Errorf ("failed to list tasks: %w" , err ))
641- }
642-
643- allSuccess := true
644- completedTasks = tasks .Tasks
645- for _ , task := range tasks .Tasks {
646- if task .Type == domain .TaskTypeUpdateDomain {
647- if task .Status != domain .TaskStatusSuccess {
648- allSuccess = false
649- if task .Status == domain .TaskStatusPending {
650- return retry .RetryableError (errors .New ("update_domain task is still pending, retrying" ))
651- }
652- }
653- }
654- }
655-
656- if allSuccess {
657- return nil
658- }
659-
660- return retry .RetryableError (errors .New ("not all update_domain tasks are successful, retrying" ))
661- })
662-
663- if err != nil {
664- return nil , err
665- }
666-
667- return completedTasks , nil
668- }
669-
670581func ExpandDSRecord (dsRecordList []interface {}) * domain.DSRecord {
671582 if len (dsRecordList ) == 0 || dsRecordList [0 ] == nil {
672583 return nil
@@ -727,7 +638,6 @@ func FlattenDSRecord(dsRecords []*domain.DSRecord) []interface{} {
727638 },
728639 }
729640 }
730- // Le champ "digest" est défini dans le schéma comme une liste contenant un seul élément.
731641 item ["digest" ] = []interface {}{digest }
732642 }
733643
@@ -745,6 +655,87 @@ func FlattenDSRecord(dsRecords []*domain.DSRecord) []interface{} {
745655 return results
746656}
747657
658+ //func flattenDNSZones(dnsZones []*domain.DNSZone) []map[string]interface{} {
659+ // if dnsZones == nil {
660+ // return nil
661+ // }
662+ //
663+ // var zones []map[string]interface{}
664+ // for _, zone := range dnsZones {
665+ // zones = append(zones, map[string]interface{}{
666+ // "domain": zone.Domain,
667+ // "subdomain": zone.Subdomain,
668+ // "ns": zone.Ns,
669+ // "ns_default": zone.NsDefault,
670+ // "ns_master": zone.NsMaster,
671+ // "status": zone.Status,
672+ // "message": zone.Message,
673+ // "updated_at": zone.UpdatedAt.Format(time.RFC3339),
674+ // "project_id": zone.ProjectID,
675+ // })
676+ // }
677+ //
678+ // return zones
679+ //}
680+
681+ //func flattenExternalDomainRegistrationStatus(status *domain.DomainRegistrationStatusExternalDomain) []string {
682+ // if status == nil {
683+ // return []string{}
684+ // }
685+ // return []string{status.ValidationToken}
686+ //}
687+
688+ //func flattenDomainRegistrationStatusTransfer(transferStatus *domain.DomainRegistrationStatusTransfer) []string {
689+ // if transferStatus == nil {
690+ // return []string{}
691+ // }
692+ //
693+ // return []string{
694+ // string(transferStatus.Status),
695+ // fmt.Sprintf("%t", transferStatus.VoteCurrentOwner),
696+ // fmt.Sprintf("%t", transferStatus.VoteNewOwner),
697+ // }
698+ //}
699+
700+ //func waitForUpdateDomainTaskCompletion(ctx context.Context, registrarAPI *domain.RegistrarAPI, domainName string, duration int) ([]*domain.Task, error) {
701+ // timeout := time.Duration(duration) * time.Second
702+ // var completedTasks []*domain.Task
703+ //
704+ // err := retry.RetryContext(ctx, timeout, func() *retry.RetryError {
705+ // tasks, err := registrarAPI.ListTasks(&domain.RegistrarAPIListTasksRequest{
706+ // Domain: &domainName,
707+ // }, scw.WithContext(ctx), scw.WithAllPages())
708+ // if err != nil {
709+ // return retry.NonRetryableError(fmt.Errorf("failed to list tasks: %w", err))
710+ // }
711+ //
712+ // allSuccess := true
713+ // completedTasks = tasks.Tasks
714+ // for _, task := range tasks.Tasks {
715+ // if task.Type == domain.TaskTypeUpdateDomain {
716+ // if task.Status != domain.TaskStatusSuccess {
717+ // allSuccess = false
718+ // if task.Status == domain.TaskStatusPending {
719+ // return retry.RetryableError(errors.New("update_domain task is still pending, retrying"))
720+ // }
721+ // }
722+ // }
723+ // }
724+ //
725+ // if allSuccess {
726+ // return nil
727+ // }
728+ //
729+ // return retry.RetryableError(errors.New("not all update_domain tasks are successful, retrying"))
730+ // })
731+ //
732+ // if err != nil {
733+ // return nil, err
734+ // }
735+ //
736+ // return completedTasks, nil
737+ //}
738+
748739//func ExpandDSRecord(dsRecordList []interface{}) *domain.DSRecord {
749740// if len(dsRecordList) == 0 || dsRecordList[0] == nil {
750741// return nil
0 commit comments