fix: correct the 'create' function resource IDs (#29)
This commit is contained in:
Родитель
b493b783ee
Коммит
7efe5bcb04
|
@ -1814,103 +1814,3 @@ func updateAccountsUsageTriggers(ctx context.Context, d *schema.ResourceData, m
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func ResourceAccountsOutgoingCallerIds() *schema.Resource {
|
||||
return &schema.Resource{
|
||||
CreateContext: createAccountsOutgoingCallerIds,
|
||||
ReadContext: readAccountsOutgoingCallerIds,
|
||||
UpdateContext: updateAccountsOutgoingCallerIds,
|
||||
DeleteContext: deleteAccountsOutgoingCallerIds,
|
||||
Schema: map[string]*schema.Schema{
|
||||
"path_account_sid": AsString(SchemaOptional),
|
||||
"call_delay": AsString(SchemaOptional),
|
||||
"extension": AsString(SchemaOptional),
|
||||
"friendly_name": AsString(SchemaOptional),
|
||||
"phone_number": AsString(SchemaOptional),
|
||||
"status_callback": AsString(SchemaOptional),
|
||||
"status_callback_method": AsString(SchemaOptional),
|
||||
"account_sid": AsString(SchemaComputed),
|
||||
"call_sid": AsString(SchemaComputed),
|
||||
"validation_code": AsString(SchemaComputed),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func createAccountsOutgoingCallerIds(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||
params := CreateValidationRequestParams{}
|
||||
if err := UnmarshalSchema(¶ms, d); err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
|
||||
r, err := m.(*client.Config).Client.ApiV2010.CreateValidationRequest(¶ms)
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
|
||||
d.SetId(*r.Sid)
|
||||
err = MarshalSchema(d, r)
|
||||
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func deleteAccountsOutgoingCallerIds(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||
params := DeleteOutgoingCallerIdParams{}
|
||||
if err := UnmarshalSchema(¶ms, d); err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
|
||||
sid := d.Get("sid").(string)
|
||||
|
||||
err := m.(*client.Config).Client.ApiV2010.DeleteOutgoingCallerId(sid, ¶ms)
|
||||
d.SetId("")
|
||||
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func readAccountsOutgoingCallerIds(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||
params := FetchOutgoingCallerIdParams{}
|
||||
if err := UnmarshalSchema(¶ms, d); err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
|
||||
sid := d.Get("sid").(string)
|
||||
|
||||
r, err := m.(*client.Config).Client.ApiV2010.FetchOutgoingCallerId(sid, ¶ms)
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
|
||||
err = MarshalSchema(d, r)
|
||||
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func updateAccountsOutgoingCallerIds(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||
params := UpdateOutgoingCallerIdParams{}
|
||||
if err := UnmarshalSchema(¶ms, d); err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
|
||||
sid := d.Get("sid").(string)
|
||||
|
||||
r, err := m.(*client.Config).Client.ApiV2010.UpdateOutgoingCallerId(sid, ¶ms)
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
|
||||
err = MarshalSchema(d, r)
|
||||
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ func createSubscriptionsSubscribedEvents(ctx context.Context, d *schema.Resource
|
|||
return diag.FromErr(err)
|
||||
}
|
||||
|
||||
d.SetId(*r.Sid)
|
||||
d.SetId(*r.Type)
|
||||
err = MarshalSchema(d, r)
|
||||
|
||||
if err != nil {
|
||||
|
|
|
@ -356,7 +356,7 @@ func createServicesListsItems(ctx context.Context, d *schema.ResourceData, m int
|
|||
return diag.FromErr(err)
|
||||
}
|
||||
|
||||
d.SetId(*r.Sid)
|
||||
d.SetId(*r.Index)
|
||||
err = MarshalSchema(d, r)
|
||||
|
||||
if err != nil {
|
||||
|
@ -565,7 +565,7 @@ func createServicesMapsItems(ctx context.Context, d *schema.ResourceData, m inte
|
|||
return diag.FromErr(err)
|
||||
}
|
||||
|
||||
d.SetId(*r.Sid)
|
||||
d.SetId(*r.Key)
|
||||
err = MarshalSchema(d, r)
|
||||
|
||||
if err != nil {
|
||||
|
|
|
@ -152,7 +152,7 @@ func createServicesMessagingConfigurations(ctx context.Context, d *schema.Resour
|
|||
return diag.FromErr(err)
|
||||
}
|
||||
|
||||
d.SetId(*r.Sid)
|
||||
d.SetId(*r.Country)
|
||||
err = MarshalSchema(d, r)
|
||||
|
||||
if err != nil {
|
||||
|
|
Загрузка…
Ссылка в новой задаче